AppleScript Ignoring "with timeout" Comma…
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi all. I'm experimenting with the idea of using my screensaver as my Desktop Background. In order to continue using a script in the macosxhints site that locks the screen via the keychain menubar item (so I'm not forced to have it require a password when it normally accesses the screensaver), I need to modify it so that it turns the said feature off and displays a dialog enabling me to turn it back on when I return.
Here's the problem: By the time I do return, the script times out on me, preventing me from accessing its dialog. I've applied the "with timeout" command, but it doesn't seem to have any effect on the script at all. Even a "with timeout of 1 second" command does not change its behavior from the default timeout time. Any help here? Here's what I've been able to come up with thus far:
with timeout of 86400 seconds
tell application "System Events"
if process "ScreenSaverEngine" exists then tell application "ScreenSaverEngine" to quit
end tell
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
repeat with i from 1 to number of menu bar items of menu bar 1
tell menu bar item i of menu bar 1
click
try
if name of menu item 1 of front menu is "Lock Screen" then
click menu item "Lock Screen" of front menu
exit repeat
end if
end try
end tell
end repeat
end tell
end tell
display dialog "Select the desktop background type:" buttons {"Normal", "ScreenSaver"} default button 2
if button returned of result = "ScreenSaver" then
do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.a pp/Contents/MacOS/ScreenSaverEngine -background > /dev/null 2>&1 &"
else
tell application "System Events"
if process "ScreenSaverEngine" exists then tell application "ScreenSaverEngine" to quit
end tell
end if
end timeout
Thanks in advanced!
7 replies
Sign in or join Beachball Help to reply.
- 0
- 0
- 0
- 0
- 0
- 0
- 0