External JavaScript issue

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

External JavaScript issue 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
kireevco
 
Posts: 5
Joined: Sun Nov 04, 2018 11:06 pm

Re: External JavaScript issue Mon Nov 05, 2018 12:16 pm • by Mr_Noodle
Is this in a condition or action?
Mr_Noodle
Site Admin
 
Posts: 11230
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: External JavaScript issue 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).
kireevco
 
Posts: 5
Joined: Sun Nov 04, 2018 11:06 pm

Re: External JavaScript issue 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.
Mr_Noodle
Site Admin
 
Posts: 11230
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: External JavaScript issue 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!
kireevco
 
Posts: 5
Joined: Sun Nov 04, 2018 11:06 pm

Re: External JavaScript issue 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?
kireevco
 
Posts: 5
Joined: Sun Nov 04, 2018 11:06 pm

Re: External JavaScript issue Mon Nov 05, 2018 1:45 pm • by Mr_Noodle
It will always load the latest version.
Mr_Noodle
Site Admin
 
Posts: 11230
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support