on optionKeyDown()
try
tell application "System Events"
if not ((some process whose name contains "KeyboardViewerServer") exists) then
tell application "KeyboardViewerServer" to activate
end if
end tell
on error
try
tell application "KeyboardViewerServer" to activate
on error
return false
end try
end try
tell application "System Events"
return (get value of checkbox "⌥" of window 1 of application process "KeyboardViewerServer") as boolean
end tell
end optionKeyDown
For users who don't want or know about the alternate 'option key down' behavior, this works. The problem with this handler is that I CAN get it to work properly, so I know what's involved in rewriting the documentation so that my user will know how to get the alternate behavior, and it's not something I want any user to have to read. It's just confusing.
Standard behavior is to begin processing files with a limit of about 5 min. Alternate behavior is to allow file processing for about an hour, if the user has the files and the time. The problem with the handler, above, is that if it does not work (detect option key), the user can't know it until 5 min later, but expecting the process to run for an hour the user may no longer be in front of his computer. Not good!
I am now looking into having the user open a folder associated with my application and testing for existence of its window. Too bad the option key isn't available, it would so nice and simple!