AppleScript: complex script for WIFI login, getting time and launch screensaver 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 &amp; 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('" &amp; theId &amp; "').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
WIP



Script 1

repeat 2 times
    set status to do shell script "networksetup -getairportpower en0"
    if status ends with "On" then
        do shell script "networksetup -setairportpower en1 off"
        delay 2
    else
        do shell script "networksetup -setairportpower en1 on"
    end if
end repeat




Script 2

tell application "Safari" to activate




Script 2.5

Use @CJK code to connect. Then use Script 3 to accept terms and conditions.



Script 3


Safari > Preferences > Advanced > Show Develop menu in menu bar
Develop > Allow JavaScript from Apple Events


3.

tell application "Safari"
    activate
    make new document with properties {URL: "http://captive.apple.com"}
    if not (exists document 1) then reopen
    tell current tab of window 1 to set URL to "https://stackoverflow.com/questions/24500011/how-to-wait-for-webpage-to-fully-load-before-proceeding-script"
    set the_state to missing value
    repeat until the_state is "complete"
        set the_state to (do JavaScript "document.readyState" in document 1)
        delay 0.2
    end repeat
    set theId to "WillBeAddedOnceCodeIsAddedInQuestion"
    do JavaScript "document.getElementById('" &amp; theId &amp; "').click();" in document 1
end tell




Script 4

If the script is working then do the following:

Cron Method (Depreciated)

1.

export VISUAL=nano; crontab -e


2. Copy and paste the following

0 9 * * * osascript /path/to/YourAppleScript.scpt


3. Press ^O (Control + O)


Press Enter


Note: Cron will not execute if the computer is asleep

launchd


sudo nano /Library/LaunchDaemons/com.mycompany.plist
Copy and paste the following:




&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.mycompany.daemon&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
        &lt;string&gt;/path/to/YourAppleScript.scpt&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;StartCalendarInterval&lt;/key&gt;
    &lt;dict&gt;
        &lt;key&gt;Hour&lt;/key&gt;
        &lt;integer&gt;9&lt;/integer&gt;
        &lt;key&gt;Minute&lt;/key&gt;
        &lt;integer&gt;0&lt;/integer&gt;
    &lt;/dict&gt;
&lt;/dict&gt;
&lt;/plist&gt;



Press ^O (Control + O)
Press Enter


5.

 sudo launchctl load -w /Library/LaunchDaemons/com.mycompany.plist