I would like to convert this applescript to Javascript to gain this utility on a cross platform website…
I have played some with it and I have managed to obtain the prompt and the answer of the prompt, but I cannot find the way to link the variable from the prompt with the variables (ipList).
I am sure it is a very simple solution, but I seem to be brainblocked… I am sorry if I am posting this and I should not be incorporating JavaScript to the forum.
thanks
htakeuchi
property codeList : {"AZGB", "AZPC", "AZPV", "AZSD", "AZTP", "COCN", "COCS", "COLV", "COPK", "COWM", "FLBR", "GAAL", "GAJC", "GAMB", "GASL", "ILAQ", "ILBD", "ILBR", "ILOP", "ILRV", "ILSB", "ILSK", "ILVH", "ILWV", "ININ", "KSLX", "KSOP", "MDCL", "MDRV", "MICM", "MICT", "MINV", "MIRH", "MISH", "MITR", "MNBL", "MNCH", "MNCN", "MNCR", "MNEA", "MNED", "MNHP", "MNLV", "MNMG", "MNMK", "MNML", "MNMN", "MNNH", "MNNS", "MNOD", "MNPL", "MNRV", "MNSL", "MNSV", "MNWB", "MNWH", "MNXT", "MOWC", "NCCY", "NEOH", "NJBH", "NJFP", "NVSL", "NYSY", "OHBW", "OHCL", "OHDB", "OHDF", "TNCV", "TXAL", "TXAT", "TXAU", "TXCC", "TXCR", "TXCV", "TXDA", "TXFM", "TXGL", "TXMF", "TXND", "TXNW", "TXPL", "TXSA", "TXSL", "TXSO", "TXWB", "UTSV", "VACV", "VAFF", "VALC"}
property ipList : {"10.129.244.11", "10.133.68.11", "10.131.36.11", "10.131.52.11", "10.129.212.11", "10.133.132.11", "10.134.4.11", "10.192.164.11", "10.131.212.11", "10.133.4.11", "10.132.116.11", "10.131.84.11", "10.132.196.11", "10.132.212.11", "10.131.196.11", "10.129.68.11", "10.129.36.11", "10.129.116.11", "10.129.84.11", "10.130.196.11", "10.129.20.11", "10.129.148.11", "10.132.164.11", "10.129.52.11", "10.128.228.11", "10.133.116.11", "10.131.68.11", "10.130.228.11", "10.132.180.11", "10.130.116.11", "10.129.164.11", "10.128.180.11", "10.129.196.11", "10.128.196.11", "10.128.244.11", "10.128.84.11", "10.129.132.11", "10.130.180.11", "10.128.68.11", "10.128.4.11", "10.132.52.11", "10.128.52.11", "10.131.148.11", "10.131.20.11", "10.130.212.11", "10.131.244.11", "10.128.148.11", "10.130.20.11", "10.132.68.11", "10.132.36.11", "10.128.116.11", "10.128.36.11", "10.132.100.11", "10.129.180.11", "10.128.20.11", "10.128.164.11", "10.132.20.11", "10.132.132.11", "10.131.100.11", "10.131.164.11", "10.133.52.11", "10.133.20.11", "10.134.20.11", "10.133.244.11", "10.133.100.11", "10.128.212.11", "10.131.116.11", "10.131.132.11", "10.133.84.11", "10.130.244.11", "10.133.36.11", "10.130.132.11", "10.132.148.11", "10.130.148.11", "10.130.68.11", "10.132.84.11", "10.130.100.11", "10.130.36.11", "10.132.228.11", "10.130.84.11", "10.131.228.11", "10.129.228.11", "10.130.164.11", "10.130.52.11", "10.131.180.11", "10.130.4.11", "10.131.4.11", "10.129.4.11", "10.129.100.11"}
set ipAddress to missing value
repeat
set {text returned:APCsite} to display dialog "What location code you want to visit?" default answer ""
if APCsite is not in codeList then
display dialog "Code does not exist" buttons {"Cancel", "Try Again"} default button 2 with icon 2
else
exit repeat
end if
end repeat
repeat with i from 1 to count codeList
if APCsite is item i of codeList then
set ipAddress to item i of ipList
exit repeat
end if
end repeat
if ipAddress is not missing value then
tell application "Safari"
activate
open location "http://" & ipAddress
end tell
end if
tell application "Safari"
activate
delay 1
set the bounds of the first window to {10, 20, 765, 850}
delay 5
tell application "System Events"
keystroke "adminid"
delay 0.3
key code 48
keystroke "adminpassword"
key code 36
end tell
end tell
delay 3
do shell script "/usr/local/bin/cliclick 150 160"
delay 2.5
do shell script "/usr/local/bin/cliclick 65 250"
delay 2.5
do shell script "/usr/local/bin/cliclick 440 256"
delay 1
do shell script "/usr/local/bin/cliclick 400 340"
delay 2.5