I'm using OSX Server 10.5, Workgroup Manager 10.5 and Apple Remote Desktop (ARD) 3.3.2
I mix Unix scripts and AppleScripts together to operate and maintain the lab of 32 eMacs in a school of ~70 eMacs all PowerPC
The school's Mac are running 10.5 I'm running 10.6.5 on my teacher's mac an Intel core 2 Duo
I have about 2-3 mins between classes to set up for the next class hence the use of ARD, AppleScript and Unix scripts
The setup usually requires login into a web site with ( group ) user name and passwords. I have a script that does that using "System Events" and tabs
I looking for pointers (technical resources) to develop a more general solution using _javascript_ and its forms to set variables and submit in Applescript
OBTW I have to delay to launch of Safari on each lab compute, starting Safari on all 32 lab computers swamps the server and bad thing happen, that is the first part of the script.
# This task has two parts which are run on the target machines:
# 1st part: Kills Safari if it is running and delay for a calculated amount of time based on the name of the target machines
# 2nd part: enable GUI scripting (Human Interface Scripting) and login to ClickN Read web page and set it up for a specific Clas of students
# 1st part
# Assuming each machine is named with 1 set of consecutive digits in the name,
# and those digits are ordered from 1->n. This scrip takes the digits part of the name, set it to x,
# sleep for x*10 seconds
# The CP Mac Lab has 32 computers named: CP-LAB-01 , CP-LAB-02 , CP-LAB-03 ... CP-LAB-32
killall "Safari"
x=`hostname | grep -o -e "[0-9]."`
let s=10#$x*5
sleep $s
#2nd part
osascript <<EndOfMyScript
--This script will lanuch the 'ClickN Read' member-login-web-page and login, then it will launch the lesson center ready for students to click their button
--GUIScripting_status()
enabledGUIScripting(true)
tell application "Safari"
activate
delay 3
end tell
tell application "System Events"
tell application process "Safari"
tell application "System Events"
keystroke tab
delay 0.5
keystroke tab
delay 0.5
keystroke "username"
delay 0.5
keystroke tab
delay 0.5
keystroke "password"
delay 0.5
keystroke return
delay 4
end tell
end tell
end tell
on GUIScripting_status()
-- check to see if assistive devices is enabled
tell application "System Events"
set UI_enabled to UI elements enabled
end tell
if UI_enabled is false then
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.universalaccess"
display dialog "This script utilizes the built-in Graphic User Interface Scripting architecture of Mac OS x which is currently disabled." & return & return & "You can activate GUI Scripting by selecting the checkbox \"Enable access for assistive devices\" in the Universal Access preference pane." with icon 1 buttons {"Cancel"} default button 1
end tell
end if
end GUIScripting_status
on enabledGUIScripting(switch)
-- Call this handler and pass 'true' in the switch parameter to enable GUI Scripting before your script executes any GUI Scripting commands, or pass 'false' to disable GUI Scripting. You need not test the 'UI elements enabled' setting before calling this handler, because authorization is required only if 'UI elements enabled' will be changed. Returns the final setting of 'UI elements enabled', even if unchanged.
tell application "System Events"
activate -- brings System Events authentication dialog to front
set UI elements enabled to switch
return UI elements enabled
end tell
end enabledGUIScripting
EndOfMyScript
Cheers
Gifford
c.650.868.5725
h.650.631.1820