I’m having problems calling an application tell block within an AppleScript Studio event handler, and am wondering if this is even possible?
I have written a script which I would like to do the following:
on launched theObject
--This works no problem
tell window "main"
set allDisks to do shell script "cd //volumes ;ls -1"
set olddelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to (return)
set allDisks to the text items of allDisks
set AppleScript's text item delimiters to olddelimiter
end tell
--Now I would like to call "System Events" to check each entry in allDisks to see if it is the startup disk, something like:
repeat with d in allDisks
tell application "System Events"
get startup of disk d
return result
end tell
end repeat
--This doesn't work though
end launched
(I realize my tell application “System Events” block is not doing anything useful in the above example, it’s just for testing)
In this example, nothing within the tell application “System Events” block gets executed.
I tried changing it to “Finder” and just inserted a log statement to see if the tell was running, but it does not.
Does this mean I cannot embed tell application blocks within event handlers?
If not, how can I (at startup) build a list of disks, then omit from that list any disk that is the startup disk?