Page 1 of 1

External JavaScript issue

PostPosted: Sun Nov 04, 2018 11:09 pm
by kireevco
Hello,

First of all thanks a lot for such a great piece of software!

I'm trying to use external JavaScript with a wrapper-function:
Code: Select all
function hazelMatchFile(theFile, inputAttributes) {
...
}

I am selecting a scpt file, but I'm still getting

Code: Select all
[Error] JavaScript failed: Error executing JavaScript on file /redacted/05350001.MOV.
2018-11-04 16:10:38.884 hazelworker[12100] OSAScript error: {
    OSAScriptErrorNumberKey = "-1708";
}


Embedded script works (without the wrapper function) but that is highly inconvenient and creates lots of code duplication.

Thanks

Re: External JavaScript issue

PostPosted: Mon Nov 05, 2018 12:16 pm
by Mr_Noodle
Is this in a condition or action?

Re: External JavaScript issue

PostPosted: Mon Nov 05, 2018 12:37 pm
by kireevco
This is an action. FYI, I'm trying to figure out correct dates for the files that have wrong timestamps (based on EXIF, Filesystem, etc).

Re: External JavaScript issue

PostPosted: Mon Nov 05, 2018 12:47 pm
by Mr_Noodle
For actions, the handler should be hazelProcessFile. Check the manual as it should have more details.

Re: External JavaScript issue

PostPosted: Mon Nov 05, 2018 1:02 pm
by kireevco
Ah, they look so similar, forum articles were prevailed with match, so I didn't even notice process-one. Thanks!

Re: External JavaScript issue

PostPosted: Mon Nov 05, 2018 1:04 pm
by kireevco
Another question on topic,

When I change external scpt file, does it get re-read automatically or I need to re-open it in Hazel?

Re: External JavaScript issue

PostPosted: Mon Nov 05, 2018 1:45 pm
by Mr_Noodle
It will always load the latest version.