Applescript that halts hazel rule when an proces is running

Hello,
I am trying to make an apple script that will delay hazel executing progress until a process is no longer active in activity monitor.
The situation is that I am running drop folder to shrink videos with HandBrakeCLI. Problem is that the destination folder wants to copy it even though the file is nog finished. I have tried to put a "last modified" line in there to prevent this type of behaviour but it does not work.
I have noticed that the HandBrakeCLi proces appears as soon as its converting and closes when its done.
For some reason the script i am trying is not working. Bit of a novice with apple script.
I found two scripts that i modified but they don't run when I embed them in the rule.
and this
hope someone could help me out.
I am trying to make an apple script that will delay hazel executing progress until a process is no longer active in activity monitor.
The situation is that I am running drop folder to shrink videos with HandBrakeCLI. Problem is that the destination folder wants to copy it even though the file is nog finished. I have tried to put a "last modified" line in there to prevent this type of behaviour but it does not work.
I have noticed that the HandBrakeCLi proces appears as soon as its converting and closes when its done.
For some reason the script i am trying is not working. Bit of a novice with apple script.
I found two scripts that i modified but they don't run when I embed them in the rule.
- Code: Select all
on is_running(appName)
tell application "System Events" to (HandBrakeCLI) contains appName
end is_running
set safRunning to is_running("HandBrakeCLI")
if safRunning then
delay 240
end tell
return "Running"
else
return "Not running"
end if
and this
- Code: Select all
tell application "System Events"
-- is it running?
if true (application process “HandBrakeCLI” exists) then
delay 240
then repeat
if false
end tell
hope someone could help me out.