Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Repeat not working inside another tell block

I'm writing a script that will check that an external drive is mounted on boot, and then when it is to run drop box. I noticed when I first wrote the script with


tell application id "com.getdropbox.dropbox" to activate


It didn't always activate? So I found this to make sure it did


on is_running(appName)

tell application "System Events" to (name of processes) contains appName

end is_running


repeat

set safRunning to is_running("Dropbox")

if safRunning then

exit repeat

else

tell application id "com.getdropbox.dropbox" to activate

end if

end repeat

Then I put it inside a check for the volume drive. Then I get this? Any ideas please?

is_running("Dropbox")


--> error number -1708

Result:

error "Finder got an error: Can’t continue is_running." number -1708


on is_running(appName)

tell application "System Events" to (name of processes) contains appName

end is_running


tell application "Finder"

set allDisks to disks


repeat with theDisk in allDisks

if name of theDisk starts with "CloudStorage" then

repeat

set safRunning to is_running("Dropbox")

if safRunning then

exit repeat

else

tell application id "com.getdropbox.dropbox" to activate

end if

end repeat



end if

end repeat

endtell

Mac Pro, OS X El Capitan (10.11.1)

Posted on Nov 30, 2015 1:37 AM

Reply
Question marked as Best reply

Posted on Nov 30, 2015 7:29 AM

when you call a script-defined handler from within a tell block, you need to use the my keyword to tell the script that the handler is in the script, and not an app-defined handler.


set safRunning to my is_running("Dropbox")

1 reply

Repeat not working inside another tell block

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.