More Minnesota Testing Woes: Scripting MN ACT Compass Test

While not nearly as awful as Pearson’s TestNav, the Web-based MN ACT Compass Test still requires manual intervention before students are able to test–enough that some scripting is warranted.

The technical requirements are much better than Pearson’s, but this test requires that each workstation needs to be registered before anyone can take a test on it.  So imagine if you wanted to test 100 students.  Each of them need a computer.  Before they can test, the technical staff needs to:

  • log into each machine as a user
  • open a Web browser and navigate to a long URL
  • make the browser full-screen
  • enter a unique machine name
  • enter a username (authorized to register machines)
  • enter a password

While this may not take long on one machine, multiply that by 100 and you are in for a lot of manual work.  Unless, of course, you throw some scripts into the mix.

Log Into Each Machine As A User

I have mentioned how to do this many times before.  You will need to give ARDAgent.app and System Events access to assistive devices.  If you are running Mavericks or higher, use tccutil.py:

tccutil.py --insert com.apple.RemoteDesktopAgent
tccutil.py --insert com.apple.systemevents

If you are on an earlier OS, you can run this command on your devices:

touch /private/var/db/.AccessibilityAPIEnabled

Once accessibility is enabled, you can run this script from ARD to log in a user from the login window:

osascript -e 'tell application "System Events"
keystroke "student"
keystroke tab
keystroke "student"
keystroke return
keystroke return
end tell'

Navigate To The Test Site

Now that you are logged in as a user.  You can open the URL and make it full screen:

open -a /Applications/Google\ Chrome.app

osascript -e 'tell application "Google Chrome"
open location "https://actcompass.org/test"
end tell'

osascript -e 'tell application "System Events"
keystroke "f" using {command down, shift down}
end tell'

Enter the Machine Name, Username, And Password To Register The Machine

Finally, this is the part that will save the most time.  The script below types in the computer name, username, and password, effectively registering all the machines with a unique name in a matter of seconds (probably faster than you could manually set up one machine)!

machine=$(hostname)
osascript -e 'tell application "System Events"
keystroke "'$machine'"
keystroke tab
keystroke "username"
keystroke tab
keystroke "password"
keystroke return
end tell'

 

act-registration

Leave a Reply