Apps and database events

Started by Carlo Didier, June 12, 2017, 03:56:54 PM

Previous topic - Next topic

Carlo Didier

I'm trying to find out how to catch database events when new files or file changes are detected.
The App Spy does not show me any such event. When iMatch detects a new file, I only see filewindow events about "selectionChanged", "FocusChanged", etc but no event saying "file added" or "file modified".
What I need are the equivalents of the old database events "Database_FileAdded" and "Database_FileUpdated".

Mario

1. Such events are sent by IMWS, not IMatch. Make sure you monitor the right events in App Spy.

2. Read the very detailed information, with examples, about working with IMatch and IMWS events in the IMatch Developer Center

Handling IMatch Messages
Handling IMatch WebServices™ Messages
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Ah, that leads me in a better direction!
I tried the IMWS events but saw only cryptic codes, so I thought that wasn't what I was looking for. The page about the EVENT_CODES is what I needed.
Thanks!

Carlo Didier

As small success! I modified a copy of the AppSpy to only show the events I'm looking for. Seems to work (see attachment).
So that app detects those events, but only if the app is running, right? I'd need it to be running all the time as soon as iMatch is started to automatically detect and react to those events, right?

Mario

Very good.
Only apps which are running can receive events.
App Panels load the last loaded app automatically when IMatch restarts.

I did not implement ways to start apps automatically and I did not implement hidden apps. Trying to keep the technology simple and maintainable and waiting for feedback from users about what is missing and required via the FR board.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Ok, so my monitoring app would have to be in an app panel which is always there. Does it also have to be visible?

Mario

Yes. And yes. At least once. The user interface framework delays loading panel "contents" (in this case, the browser) until the panel is visible. This is an optimization feature.
Tip: You can try out such things quickly by just writing a console.log("I'm here") in your app. It will show in the output panel so you know if your app is running and what it does.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

So I suppose there is no way to guarantee that an app panel is always opened with iMatch and to hide the panel through the script once it's started?
As I normally don't need any interaction with it nor its output, there is absolutely no need for it to be visible and take screen space that I could better use otherwise.

Carlo Didier

This also means that events can not really trigger scripts, but the script must be running to catch events. That's more like monitoring a log file, not event processing ...

Mario

If you dock the panel open and front, it will be automatically load.

QuoteThat's more like monitoring a log file, not event processing ...
A script which is not running cannot monitor anything.
IMatch does not launch apps itself.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Quote from: Mario on June 12, 2017, 07:47:12 PM
If you dock the panel open and front, it will be automatically load.

Carlo, this should be a good message for you?
When you then load IMatch, the script will be automatically load and you could move the app in the background, so that the panel is hidden.
(If I understand it correctly).

Best wishes from Switzerland! :-)
Markus

Carlo Didier

Quote from: Mario on June 12, 2017, 07:47:12 PMIMatch does not launch apps itself.

But the old iMatch could start a script automatically when an event occured  :(

Carlo Didier

Quote from: sinus on June 12, 2017, 08:15:44 PMCarlo, this should be a good message for you?

Not at all. It's a huge step backwards from the old iMatch. There, I just had that database event script set and it was automatically triggered when files were added or modified.

Now, I'll have to first open an app panel with a certain script so it is running and monitoring.

If I put that panel in the background, it will be in the background when I next start iMatch and it won't work.
If I always leave it in the foreground, I'll lose a huge space in the user interface for something that doesn't need any user interface at all ... It drives the whole idea of event scripts ad absurdum.

As it is, it's just useless, even if I could get together the whole script because I could never be sure it would be triggered when it should, unless I do a fully manual procedure (opening that app panel and then hiding it again) each time when I open iMatch.

Mario

Quote from: Carlo Didier on June 12, 2017, 09:18:19 PM
Quote from: Mario on June 12, 2017, 07:47:12 PMIMatch does not launch apps itself.

But the old iMatch could start a script automatically when an event occured  :(
Yes, it did. Your point?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Quote from: Mario on June 12, 2017, 09:26:12 PMYes, it did. Your point?

That is the point. The old iMatch could do it. This is a complete deal breaker for me. It's essential to my workflow.

I'll stick with IM 5.8.4 until something similar is implemented in IM 2017 (I'll post a feature request)