Author Topic: No more database events for scripts???  (Read 3219 times)

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1632
No more database events for scripts???
« on: June 08, 2017, 02:44:05 PM »
Hey guys, from lack of time, I somehow didn't realize that the old scripting engine is gone from iMatch 2017. Not sure if I should try to go back (database already converted and many files added ... lots of work to go back, even from a good backup) or try to get a week off work to learn javascript and rewrite my stuff from scratch ... I actually hate both alternatives.

BIG question if I'll stay with iMatch 2017: in the old scripting engine we had database events to trigger scripts. Is there anything equivalent with javascript?

This feature was always the biggest advantage of iMatch for me and it's very, very important in my workflow. Anything I can automate, I will. A script doesn't forget to do something. I do  8)

And is there some guide to help converting old scripts to javascript, showing equivalent functions?

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27474
Re: No more database events for scripts???
« Reply #1 on: June 08, 2017, 02:51:51 PM »
Hi, Carlo

we started discussing the retirement of the old BASIC scripting language around January here in the community: https://www.photools.com/community/index.php?board=128.0

No, there are currently no features which run a script when IMatch starts or shuts down. I decided to remove this because it caused so much trouble with the BASIC scripts in the past. Quite happy that these are gone, really.

But, I could add a similar feature (to run an app when IMatch starts or ends) again if there is demand.
For "1.0" version of the IMWS-based scripting system included in IMatch 2017 I tried to design and implement everything that is required to write useful and cool apps. We already have a lot more than we ever had in BASIC.

I'm open to feature requests for new methods to add or new features.
I'm sure when users starting writing scripts they will tell me what is missing.

Did you know that you can also "program" IMatch scripts now in Windows PowerShell, curl, Python, .NET, Office or other programming languages which can utilize web services...?

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1632
Re: No more database events for scripts???
« Reply #2 on: June 08, 2017, 03:56:08 PM »
Hi Mario!
I remember the discussion. It's just that I don't have much time for this right now and so I somehow missed the fact that with 2017 it was all gone. I would have waited with the upgrade, had I realized this.

I don't use much scripting, but I do (did) use an important script triggered by the adding or modification of files in the database. That was very useful.
Even when I get the time to rewrite that, it'll be half as useful if I have to trigger it manually.

The fact that iMatch automatically detects file events is a huge advantage to Lightroom and triggering a script for add or change events is for me the logical next step. I'll post a feature request for it.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27474
Re: No more database events for scripts???
« Reply #3 on: June 08, 2017, 04:20:11 PM »
You can write apps which monitor IMatch and IMWS for messages, including file added, updated or removed.

Check out the App Spy app to see how it's done and how it looks.

The dedicated sections in the IMatch Developer Documentation explain the available events:

Handling IMatch Messages
Handling IMatch WebServices™ Messages

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1632
Re: No more database events for scripts???
« Reply #4 on: June 08, 2017, 06:10:00 PM »
Thanks for that starting point!

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1632
Re: No more database events for scripts???
« Reply #5 on: June 08, 2017, 07:24:18 PM »
Hmm, just ran the spy app, but no trace of files added events, even when I rescan a folder where I added a file ...

Also had a look at the developer doc and samples. I think I'll quit. This is several levels beyond simple scripts as in the old iMatch. I'll need a full week course just to get the basics of developing anything with these tools, let alone use it with iMatch.

For now, to keep on working, I'll go back to the old version. I just don't have the time for this. Sorry, but it just got way too complicated to do simple things in scripts.

I just have to look up how to downgrade the database or just re-enter any changes since the upgrade to a restored version.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27474
Re: No more database events for scripts???
« Reply #6 on: June 08, 2017, 08:08:31 PM »
Downgrade is not possible.
I don't know what you need to do in your scripts, but maybe look into using PowerShell, curl or even VisualBasic.NET.

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1632
Re: No more database events for scripts???
« Reply #7 on: June 08, 2017, 10:22:36 PM »
My event scripts do this:
- check image pixel dimensions and assign categories according to my criteria concerning aspect ratios
- automatically stack images from stitched pictures and HDRs (see https://www.photools.com/community/index.php?topic=5358.0) according to my naming convention (can't do this any other way, like automatic stacking, etc), propagating categories from the source images to the stitched/HDR image. In a next step I also planned to copy GPS info.
- automatically assign images to event categories
See attached Photos.bas file

It's not much code and I don't want to spend weeks learning new languages and tools just to convert this. I've never used javascript, JSON (?), Visual Studio Code (used Visual Basic and Visual C++ 10 years ago), don't know what a "promise" is, don't need a visual interface (no HTML), ... It's just too much. It feels like using a hypercomplex supercomputer as a desktop calculator.

If I get past the database error I now receive with the restored db and iMatch 5.8, I'll stick with that for as long as possible. It just worked.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27474
Re: No more database events for scripts???
« Reply #8 on: June 08, 2017, 11:46:40 PM »
Part two sounds like a normal job for the built-in versioning in IMatch.

Assigning categories based on custom aspect ratios needs a purpose-built script. Or you grab them via a data-driven category and just reference them into other categories via a formula. Easy to do.

sinus

  • Global Moderator
  • *****
  • Posts: 4254
  • IMatch-User since 2001 (IMatch 3.6)
Re: No more database events for scripts???
« Reply #9 on: June 09, 2017, 08:45:21 AM »
My event scripts do this:
- check image pixel dimensions and assign categories according to my criteria concerning aspect ratios
- automatically stack images from stitched pictures and HDRs (see https://www.photools.com/community/index.php?topic=5358.0) according to my naming convention (can't do this any other way, like automatic stacking, etc), propagating categories from the source images to the stitched/HDR image. In a next step I also planned to copy GPS info.
- automatically assign images to event categories
See attached Photos.bas file

It's not much code and I don't want to spend weeks learning new languages and tools just to convert this. I've never used javascript, JSON (?), Visual Studio Code (used Visual Basic and Visual C++ 10 years ago), don't know what a "promise" is, don't need a visual interface (no HTML), ... It's just too much. It feels like using a hypercomplex supercomputer as a desktop calculator.

If I get past the database error I now receive with the restored db and iMatch 5.8, I'll stick with that for as long as possible. It just worked.

Hi Carlo
I feel with you. I have also some scripts, what are really good for my workflow and they work  not more with IMatch2017.
Hence I do work still with IMatch 5. There all is good.

Finally I do not need really something from the new 2017-version.
But the day will come, when it works not more, for example if a new windows-version comes out, or I do not know. But I think, that IMatch 5 will work for me still without problems this year and almost for sure also the next year, even without official support from Mario.

On the other hand new stuff comes out with IMatch2017, what I do not really need, but what is fancy. For example the speed is much better with IMatch2017, I have read. And some other things, what is not really essential for me, but nice to have.
And if Mario does for example enhance some other stuff (design & print or calculate attributes-fields or whatever), then I will be out also.

Hence my personal way is to use the "old" good IMatch 5.
In the mean time, parallel, as often as I have time, I do think about my workflow, if I can make it easier.
And I do lern for me some basic of JavaScript, what gives me some good possibilities, because I can JS also use on my website or personally.

And on my laptop I have the new IMatch2017 as trial (for now), and I have a look at the apps and JS and yes, it can be overhelming, all the stuff. But I will concentrate on that things, what I need, not the other (fancy) things, becasue it can be simply too much for me, finally I am a photographer and not a programmer.  ;D
In my case I do concentrate on how I can pull out attributes - fields, calculate them and put it into word-doc.
If I can get this (what can be end of the year or whenever), then I will change to 2017, not before.

In your case I do not know, if you could rethink about your workflow (data-driven-categories?) and try maybe an easy script in JS, that you can use your workflow, like you do now.

Check image pixels and add them to categories, I do not know (now), but I guess, this should not be a very difficult task for JS (but yes, what is easy for scripters, can be difficult for us "poor scripters").
I hope, you can find a way, now or later for your good old workflow or a new (better) one.  :)

S
Best wishes from Switzerland! :-)
Markus

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1632
Re: No more database events for scripts???
« Reply #10 on: June 09, 2017, 09:37:43 AM »
Part two sounds like a normal job for the built-in versioning in IMatch.

I tried hard to do that, but it just won't work with my naming convention. And I'm not going to change that and rename a good part of 92000+ files ...

Carlo Didier

  • Super Hero
  • ****
  • Posts: 1632
Re: No more database events for scripts???
« Reply #11 on: June 09, 2017, 09:43:59 AM »
Check image pixels and add them to categories, I do not know (now), but I guess, this should not be a very difficult task for JS (but yes, what is easy for scripters, can be difficult for us "poor scripters").
I hope, you can find a way, now or later for your good old workflow or a new (better) one.  :)
S

I'm sure that's right, but the problem is that I'll need LOTS of time to get to the point where it becomes simple to do. I don't have that time, and if I had, I'd rather spend it on something else, like taking pictures  :)

As to my workflow, it's based on a naming convention I've been using for a long time and that I won't change (because it would mean to rename lots of files, creating the problem of legacy references to old names, etc).

sinus

  • Global Moderator
  • *****
  • Posts: 4254
  • IMatch-User since 2001 (IMatch 3.6)
Re: No more database events for scripts???
« Reply #12 on: June 09, 2017, 10:26:33 AM »
Check image pixels and add them to categories, I do not know (now), but I guess, this should not be a very difficult task for JS (but yes, what is easy for scripters, can be difficult for us "poor scripters").
I hope, you can find a way, now or later for your good old workflow or a new (better) one.  :)
S

I'm sure that's right, but the problem is that I'll need LOTS of time to get to the point where it becomes simple to do. I don't have that time, and if I had, I'd rather spend it on something else, like taking pictures  :)

As to my workflow, it's based on a naming convention I've been using for a long time and that I won't change (because it would mean to rename lots of files, creating the problem of legacy references to old names, etc).

I wish you very good luck for whatever you will do.
BTW: changing all filenames I did really several times. My naming system has been every time improved, really. The only thing, yes, some references (for InDesign-pages for example) has been broken, but the advantages in my case have been bigger then the disadvantages.

Good luck anyway and yes, "Gut Licht" for taking picutures.  :D
Best wishes from Switzerland! :-)
Markus