getting the status of call to favoriteExecute()

Started by bnewman, December 29, 2020, 09:31:02 PM

Previous topic - Next topic

bnewman

I am using favoriteExecute() to perform an batch image processing operation to convert selected files from tif to jpg. The operation works fine, but I'm typically using this to convert 70-100+ selected files at a time. The method is invoked and the next line in the script simply notifies that the function was executed, and the script ends. But typically, this actual file conversion operation takes many seconds until it is actually completed. Is there some way for the script to monitor the status of what is actually happening after the launch of the favoriteExecute() until the last file is actually written?

Looking forward to some advice.

Mario

#1
This endpoint just executes the favorite with your parameter and returns. It does not even have an idea of what the favorite you execute does.
There is no waiting for the Batch Processor to finish (blocking endpoints are always bad) and there are no events related to the the BP you could monitor in your app.
This is just a very rarely used sideline endpoint.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

bnewman

Thanks for the clear answer. I didn't know that favoriteExecute is a "rarely used sideline endpoint".

Earlier versions of IMatch, before the conversion to the current scripting method, had a function that specifically converted a tif to jpg, and I had used that to monitor the progress of the conversions done to a set of files. But now, the only way to do such a conversion that I could find was to create an Batch Image Processing Preset, which I then made into a Favorite, and is the argument for a favoriteExecute within a script. Maybe there is a way to do this conversion with a function that is equivalent to the earlier one that has been obsoleted, but I couldn't find one. Is there another way to do this conversion in a script without using such a rarely used sideline, i.e. favoriteExecute? I'd be happy to try it.

Bernie.

Mario

Many things that required scripts in the olden days are now integrated into IMatch - like the Batch Processor. Since version 5 of IMatch.
Users run less and less custom scripts. Because all that you need is right there.

Why not just click on your favorite or run it via the user-defined keyboard shortcut.
Apps which run Batch Processor presets via a Favorite are so rare. Maybe even you are the only IMatch user who does that...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

bnewman

ha, ha... what a distinction: the only user who runs a preset in a script; I'm not sure I want that distinction. I guess I could just press the favorites and run the Batch processor. In my case, I am using iMatch as the basis for creating/maintaining my website. I assign images to various subcategories of a category I called "Web" and a script generates the include php files I need to maintain the site. The script also uses two runs of the Batch Image processor: one to create the 700px images and another to create 170px thumbnail images. So, I guess I was lazy to run two presets manually, and preferred to bundle it in a script. I guess I can press two shortcut keys just as well.

I also assign each category a thumbnail image and use that as the way to identify each "gallery" on the webpage, and I provide a category description that I parse into information that serves as a title for each "gallery", a narrative, and an order sequencing. It's all thanks to the power of IMatch and scripting. I can update my website in minutes each time. If you are interested it's www.bernienewman.com

Thanks for the advice.

Bernie.

Mario

QuoteI guess I can press two shortcut keys just as well.

This is likely. Many users have adaped to features like favorites or metadata templates to do things for which IMatch scripts were needed in the old days.
Clicking a favorite to produce the output images and then pressing another to run your app to create the gallery after the BP has finished is certainly doable. Not 100% automated. But comfy enough I guess.

When I've designed and introduced (BASIC) scripting in IMatch 3 (and 5 ...) many users wrote scripts to automate things, enhance IMatch, do amazing stuff.
But, as I percive it, less and less users are willing or able to create scripts/apps. As far as I can tell from this community and, especially, the access counters for the IMatch Developer Center and documentation...

I constantly enhance the capabilities of IMWS to support the new IMatch features and apps introduced over time.
There will be some amazing new features in IMatch 2021 based on IMWS and apps.

But making endpoints super-flexible to support a wide-range of potential uses, documenting everything in fine detail etc. are all things I think about twice, given the very small number of users who implement their own apps. It's just a matter of amount of work for Mario to do vs. number of users who benefit from this.

I suggest you post a feature request to make the Batch Processor emit events. This is not much work and I'm willing to look into this.
You can then monitor IMatch messages (see https://www.photools.com/dev-center/doc/imatch/tutorial-imatch-messages.html) in your app and you will know then the Batch Processor starts, what it is doing and when it finished (and if there were errors).
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mario

I have added a global import-export event which can be monitored in apps.
There is a start and finish event and, depending on the module used, also a progress event.
If you monitor these events in your app, your app will know when the BP has finished.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook