document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. -- You must have UI scripting enabled for this to work.
  2. -- Originally written by Nathan Henrie Sep 07, 2012
  3. -- Originally posted at http://n8henrie.com/2012/09/applescript-to-automate-checking-checkboxes-in-your-web-browser/
  4.  
  5. display dialog "This script will try to simulate manually ticking off checkboxes in a web browser using \\"tab\\" and \\"spacebar\\" clicks. It seems to be working okay in the most recent stable versions of Safari and Chrome as of Sep 07, 2012.  That said, you could unintentionally submit a form or otherwise screw something up, so please don\'t use it on anything important." & return & return & "Click \\"Cancel\\" below to exit the script, or \\"OK\\" to assume all risk for use of the script." with title "Disclaimer: USE AT YOUR OWN RISK"
  6. tell application "Finder" to set RunningProcesses to name of every process
  7. set numberBoxes to 0
  8. set numberBoxes to text returned of (display dialog "Guess LOW! You can run this script again if it wasn\'t enough, but too much and you may accidentally click something." default answer "Enter only the number." with title "About how many evenly spaced boxes do you need to check?")
  9.  
  10. set numberTabs to text returned of (display dialog "Step 1: Open the page you\'d like to check." & return & "Step 2: Hit *tab* until you\'re at the first checkbox." & return & "Step 3: Make sure you\'re there by hitting the spacebar, which should toggle the box." & return & "Step 4: From there, count the number of tabs it takes you to hit the next checkbox." & return & return & "How many tabs did it take you to get from the first checkbox to the second?" default answer "Enter only the number." with title "How many tabs between checkboxes?")
  11. set theProcess to (choose from list RunningProcesses with prompt "Choose the process for the browser you\'re using. (Working with \\"Safari\\" and \\"Google Chrome\\")" multiple selections allowed no OK button name "Shift + Tab back to the first checkbox and make it \\"checked\\" with the spacebar, then click here.") as string
  12.  
  13. try
  14.     tell application "System Events"
  15.         tell my application theProcess to activate
  16.         delay 1
  17.         tell process theProcess
  18.             repeat (numberBoxes - 1) times
  19.                 repeat numberTabs times
  20.                     keystroke tab
  21.                 end repeat
  22.                 keystroke space
  23.                 delay 0.25
  24.             end repeat
  25.         end tell
  26.     end tell
  27. end try
');