Hello!
Being new to Applescript, I am inquiring on how to modify a script (pasted below). The script will allow iWeb to automtically publish every fifteen minutes (so I can update a blog while on the road via iPhone). When the script first opens, a window requires my making a selection, “Stop” or “Begin”. Because I want to “Begin”, is there a way to modify the script to automatically begin the program without interacting with this window first?
Thanks,
Doug Ramsey
SCRIPT
on run
set the icon_file to path to resource "applet.icns"
display dialog "This script will attempt to publish your iWeb website every 15 minutes." buttons {"Stop", "Begin"} default button 1 with title "Auto-Publsih iWeb" with icon icon_file
if button returned of the result is "Stop" then
tell me to quit
end if
end run
on idle
try
tell application "iWeb" to activate
tell application "System Events"
-- enable UI scripting if it is off
if UI elements enabled is false then
set UI elements enabled to true
if UI elements enabled is false then error "NO_PASSWORD"
end if
tell process "iWeb"
if enabled of menu item "Publish to .Mac" of menu "File" of menu bar item "File" of menu bar 1 is true then
click menu item "Publish to .Mac" of menu "File" of menu bar item "File" of menu bar 1
set the loop_counter to 0
repeat
set the loop_counter to loop_counter + 1
if the loop_counter is 60 then
error "The script gave up trying to click the sheet OK button after one minute."
else if exists sheet 1 of window 1 then
click button "OK" of sheet 1 of window 1
exit repeat
else
delay 1
end if
end repeat
end if
end tell
end tell
on error error_message
display dialog error_message with title "Publishing Error" giving up after 15 buttons {"Stop", "Continue"} default button 2
if button returned of the result is "Stop" or gave up of the result is true then
tell me to quit
end if
end try
return 900 -- 15 minutes
end idle
Model: Mac Pro
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)