set ASusername to "a"
set ASpassword to "b"
tell application "Safari"
open location ASURL
end tell
delay 5
inputByID("apl-username", ASusername)
inputByID("apl-password", ASpassword)
delay 3
clickthebutton("apl-btn-login")
to inputByID(theId, theValue)
tell application "Safari"
do _javascript_ " document.getElementById('" & theId & "').value ='" & theValue & "';" in document 1
end tell -- stops using safari
end inputByID --marks the end of the function
to clickthebutton(theId)
tell application "Safari"
do _javascript_ " document.getElementByID('" & theId & "').click();" in document 1
end tell
end clickthebutton
Script events:
tell application "Safari"
do _javascript_ " document.getElementById('apl-username').value ='a';" in document 1
do _javascript_ " document.getElementById('apl-password').value ='b';" in document 1
do _javascript_ " document.getElementByID('apl-btn-login').click();" in document 1
end tell