Experts!
I'm new to apple script and struggling with its complexity...But maybe someone can help. The thing I want to do my iMac:
The iMac is used to work as a HighEnd slideshow for an artist work. Its extremely important that the iMac gets the correct time for displaying the slideshow.
So what the iMac needs to do:
iMac wakes up every morning at 8 AM and gets to sleep at 11 PM (done by Energysaver)
iMac toggles Wifi on and off (see script1 below)
- Starting Safari (script 2)
- iMac finds the correct Wifi and logs in (missing)
- Login Page of Wifi needs a "click in checkbox" to accept terms of use (SCRIPT 3 I tried to adapt a script found on the net, but doesn't really work)
- iMac waits until a dedicated time (9 AM) and launches screensaver. (SCRIPT 4 is launching, but waiting until specific time is missing)
Any helps & suggestions would be very much appreciated!! Andreas
What I have:
--SCRIPT 1
set status to do shell script "networksetup -getairportpower en1"
if status ends with "On" then
do shell script "networksetup -setairportpower en1 off; sleep 2"
end if
set status to do shell script "networksetup -getairportpower en1"
if status ends with "Off" then
do shell script "networksetup -setairportpower en1 on"
end if
--SCRIPT 2
tell application "Safari" activate
end tell
--SCRIPT 3 clicking the box to accept terms of use
to clickID(theId)
tell application "Safari"
do JavaScript "document.getElementById('" & theId & "').click();" in document 1
end tell
end clickID
--SCRIPT 4 is needed to get the time, wait and launch screensaver
set ntpdPID to do shell script "pgrep ntpd; exit 0"
if ntpdPID is not "" then
do shell script "systemsetup -setusingnetworktime On" with administrator privileges
end if
try
tell application id "com.apple.Screensaver.engine" to launch
end try