Page 1 of 1
Newbie little problem: completion sound triggered w Applescr

Posted:
Sat Feb 28, 2015 1:06 pm
by Stingo
Hello all,
first issue I'm asking about on this forum - be gentle
As the last part of rule, I have a "Run Applescript" command like this:
- Code: Select all
tell application "Finder"
display notification "Moved & Copied" with title "Wallpaper" subtitle "Image" sound name "Basso"
end tell
Now, in the Script Editor this performs flawlessly, but in Hazel nothing happens, not even a fail/error etc... The log shows everything happened correctly, but that last action, the simple applescript - it just doesn't seem to exist.
('Display Notification' is not an option since an auditive cue is impossible.)
Any thoughts?
Steven
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Mon Mar 02, 2015 3:48 pm
by Mr_Noodle
Try turning on debug mode to see if there's more info in the logs. Also, does this do a Notification Center type notification? If so, keep in mind that notification center will coalesce messages so if you are doing the exact same message over and over, you probably won't get an alert each time.
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Thu Mar 05, 2015 7:02 am
by Stingo
OK, I've done some testing
A little background:
I disabled all other rules except the relevant one of course
the rule runs on my Downloads folder, and only 3/4 files are in there, none with applicable rules
my rule does something simple: it parses the comment of the file dropped into Downloads, and based on a term moves the file to one location, makes a copy to another location & subsequently triggers an alert
Both the Move & Copy of that one file get shown in Notifications, but the Applescript not...
In the debug console output I see an OSAscript executing successfully...
the DEBUG results:
- Code: Select all
2015-03-05 11:50:56.146 HazelHelper[469] DEBUG: Thread 0x60000006c3c0: Received events (
{
date = "2015-03-05 10:50:56 +0000";
path = "/Users/Steven/Downloads/";
shouldDoFullScan = 0;
}
) for stream at path: /Users/Steven/Downloads
2015-03-05 11:50:56.147 HazelHelper[469] DEBUG: Thread 0x60000006c3c0: Run worker for folder: /Users/Steven/Downloads
2015-03-05 11:50:56.194 hazelworker[32598] ###main load address: 0x1097b9000
2015-03-05 11:50:56.195 hazelworker[32598] ###Noodle load address: 0x1098c5000
2015-03-05 11:50:56.195 hazelworker[32598] ###CK load address: 0x10988c000
2015-03-05 11:50:56.225 hazelworker[32598] DEBUG: Program is licensed.
2015-03-05 11:50:56.262 hazelworker[32598] Processing folder Downloads
2015-03-05 11:50:56.262 hazelworker[32598] DEBUG: Initialized
2015-03-05 11:50:56.262 hazelworker[32598] DEBUG: Pausing to wait for things to settle down.
2015-03-05 11:50:58.361 hazelworker[32598] DEBUG: Processing directories: (
"/Users/Steven/Downloads"
)
2015-03-05 11:50:58.371 HazelHelper[469] DEBUG: Checking events for path /Users/Steven/Downloads, folder <ComNoodlesoft_HazelConcreteFolder: 0x60000026f440> "Downloads"
2015-03-05 11:50:58.373 hazelworker[32598] DEBUG: Received file event: {
date = "2015-03-05 10:50:56 +0000";
path = "<ComNoodlesoft_NoodlePathSet: 0x7ffa4a70ad30> - (\n \"/Users/Steven/Downloads\"\n)";
}
2015-03-05 11:50:58.373 hazelworker[32598] DEBUG: About to process directory /Users/Steven/Downloads
2015-03-05 11:50:58.376 hazelworker[32598] DEBUG: $RECYCLE.BIN: File is hidden/invisible. Skipping.
2015-03-05 11:50:58.376 hazelworker[32598] DEBUG: .DS_Store: File is hidden/invisible. Skipping.
2015-03-05 11:50:58.376 hazelworker[32598] DEBUG: .localized: File is hidden/invisible. Skipping.
2015-03-05 11:50:58.377 hazelworker[32598] DEBUG: desktop.ini: File is hidden/invisible. Skipping.
2015-03-05 11:50:58.378 hazelworker[32598] DEBUG: Frank.ogg: Did not match any rules.
2015-03-05 11:50:58.379 hazelworker[32598] DEBUG: Tempo: Did not match any rules.
2015-03-05 11:50:58.380 hazelworker[32598] TESJE.jpg: Rule Move to Wallpaper matched.
2015-03-05 11:50:58.380 hazelworker[32598] DEBUG: New rule signature. Executing actions.
Old signatures: (
)
New Signature:{finderComment hazelContainsObject: "#wallpaper"}:{(move:/Users/Steven/Pictures/WALLPAPER,{
keepFolderStructure = 0;
replaceExisting = 0;
throwAwayDupes = 0;
})(copy:/Library/Desktop Pictures,{
keepFolderStructure = 0;
replaceExisting = 0;
throwAwayDupes = 0;
})(applescript:,{
})}
2015-03-05 11:50:58.393 HazelHelper[469] DEBUG: Thread 0x60000006c3c0: Received events (
{
date = "2015-03-05 10:50:58 +0000";
path = "/Users/Steven/Downloads/";
shouldDoFullScan = 0;
}
) for stream at path: /Users/Steven/Downloads
2015-03-05 11:50:58.394 HazelHelper[469] DEBUG: Thread 0x60000006c3c0: Run worker for folder: /Users/Steven/Downloads
2015-03-05 11:50:58.394 HazelHelper[469] DEBUG: Task already running for folder: /Users/Steven/Downloads
2015-03-05 11:50:58.502 hazelworker[32598] [File Event] File moved: TESJE-1.jpg moved from folder /Users/Steven/Downloads to folder /Users/Steven/Pictures/WALLPAPER.
2015-03-05 11:50:58.551 hazelworker[32598] [File Event] File copied: TESJE-1.jpg copied from folder /Users/Steven/Pictures/WALLPAPER to folder /Library/Desktop Pictures.
2015-03-05 11:50:58.854 hazelworker[32598] DEBUG: OSAScript executed successfully with file /Library/Desktop Pictures/TESJE-1.jpg. Result: <NSAppleEventDescriptor: null()>
2015-03-05 11:50:58.854 hazelworker[32598] DEBUG: Action changed file: TESJE-1.jpg
2015-03-05 11:50:58.868 hazelworker[32598] DEBUG: •Mail Attachments: Did not match any rules.
2015-03-05 11:50:58.869 hazelworker[32598] DEBUG: Writing out DB file: /Users/Steven/Downloads
2015-03-05 11:50:58.895 hazelworker[32598] DEBUG: Directory /Users/Steven/Downloads processed in 0.521862 seconds
2015-03-05 11:50:58.896 HazelHelper[469] DEBUG: Checking events for path /Users/Steven/Downloads, folder <ComNoodlesoft_HazelConcreteFolder: 0x60000026f440> "Downloads"
2015-03-05 11:50:58.897 hazelworker[32598] DEBUG: Received file event: {
date = "2015-03-05 10:50:58 +0000";
path = "<ComNoodlesoft_NoodlePathSet: 0x7ffa4a507af0> - (\n \"/Users/Steven/Downloads\"\n)";
}
2015-03-05 11:50:58.897 hazelworker[32598] DEBUG: Sleeping
2015-03-05 11:51:00.993 hazelworker[32598] DEBUG: About to process directory /Users/Steven/Downloads
2015-03-05 11:51:00.995 hazelworker[32598] DEBUG: $RECYCLE.BIN: File is hidden/invisible. Skipping.
2015-03-05 11:51:00.996 hazelworker[32598] DEBUG: .DS_Store: File is hidden/invisible. Skipping.
2015-03-05 11:51:00.996 hazelworker[32598] DEBUG: .localized: File is hidden/invisible. Skipping.
2015-03-05 11:51:00.996 hazelworker[32598] DEBUG: desktop.ini: File is hidden/invisible. Skipping.
2015-03-05 11:51:00.997 hazelworker[32598] DEBUG: Frank.ogg: Did not match any rules.
2015-03-05 11:51:00.998 hazelworker[32598] DEBUG: Tempo: Did not match any rules.
2015-03-05 11:51:00.999 hazelworker[32598] DEBUG: •Mail Attachments: Did not match any rules.
2015-03-05 11:51:00.999 hazelworker[32598] DEBUG: Writing out DB file: /Users/Steven/Downloads
2015-03-05 11:51:01.025 hazelworker[32598] DEBUG: Directory /Users/Steven/Downloads processed in 0.031564 seconds
2015-03-05 11:51:01.026 HazelHelper[469] DEBUG: Checking events for path /Users/Steven/Downloads, folder <ComNoodlesoft_HazelConcreteFolder: 0x60000026f440> "Downloads"
2015-03-05 11:51:01.026 hazelworker[32598] DEBUG: Sending metrics to scheduler. Next scheduled run:
2015-03-05 11:51:01.027 HazelHelper[469] DEBUG: Received metrics for folder /Users/Steven/Downloads: {
directoryDepth = 0;
requestedSchedulingTime = "";
triggerPaths = "<ComNoodlesoft_NoodlePathSet: 0x60000023cd40> - (\n)";
unavailablePaths = "{(\n)}";
}
2015-03-05 11:51:01.027 HazelHelper[469] DEBUG: Timer scheduled for folder /Users/Steven/Downloads at
2015-03-05 11:51:01.027 hazelworker[32598] Done processing folder Downloads
2015-03-05 11:51:01.030 HazelHelper[469] DEBUG: Thread 0x60000006c3c0: Task removed: [32598]
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Thu Mar 05, 2015 3:29 pm
by Mr_Noodle
Again, is this doing a notification center notification? See my points earlier as to why it may not appear.
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Mon Mar 09, 2015 9:59 am
by Stingo
Yes, this is performing a notification center notification.
I understand about the "maybe-not-appearing" notification, but that's not really an issue - I just want to hear a sound.
Anyway, the hazel-rule is only ever performed on 1 file at the time.
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Mon Mar 09, 2015 12:03 pm
by Mr_Noodle
If this is via Notification Center, then it's not something you can control. You might be better off bringing up your own non-Notification Center UI to do this. Or just play the sound separately from the notification.
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Tue Mar 17, 2015 11:29 am
by Stingo

This is the super simple rule.
I frankly don't understand how to proceed now & why it doesn't work - it would be helpful if certain rules have their specific sound attached. If this is the wrong way to get to a solution, any suggestions appreciated.
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Tue Mar 17, 2015 1:57 pm
by Mr_Noodle
As I mentioned, if this is notification center, it might get coalesced with previous notifications. It's not something that I can control. Your script has the sound as part of the notification. You should re-work the script to play a sound independently.
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Wed Mar 18, 2015 11:01 am
by Stingo
I solved it by eliminating the embedded applescript from the rule & setting up a os x folder action that displays a notification + sound whenever a new file is being added to it.
It works & is elegant enough for this particular rule, but in other situations where I'd like to hear a particular sound upon completion of a rule -> your comment "re-work the script to play a sound independently" mystifies me : how do I tackle that?
Re: Newbie little problem: completion sound triggered w Appl

Posted:
Wed Mar 18, 2015 12:57 pm
by Mr_Noodle
In the AppleScript, don't stick the sound in the same alert. Have it on a separate line. I don't know the AppleScript off-hand for it but I'm sure you can find it by googling around.