Advertisement
Guest User

Untitled

a guest
Jul 8th, 2013
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- ABOUT --
  2. -- This runs & emulates key strokes entering search terms. Whilst it's running you can't really use the computer it's running on I'm afraid.
  3. -- It was written and tested on OS X 10.8.4 Mountain Lion & with FF 22.0
  4. -- There are no guarantees using this. Run at your own risk.
  5.  
  6. -- SETUP --
  7. -- To use this you must have FULL KEYBOARD ACCESS enabled in system preferences!
  8. -- System Prefs > Keyboard > Keyboard Shortcuts
  9. -- Put dot next to "All controls" at the bottom of the window
  10.  
  11. -- How many presses of the tab key does it take to get from Firefox's address bar to the QANTAS Frequent Flyer search box?
  12. set tabPresses to 2
  13.  
  14.  
  15. -- Get number of words in Unix dict file
  16. set numberOfWords to (do shell script "wc -l /usr/share/dict/words | sed 's/[^0-9]//g'") as number
  17.  
  18. -- Loop through 150 times (1 months worth)
  19. repeat 150 times
  20.     -- Get a random word
  21.     set randomNumber to random number from 1 to numberOfWords
  22.     set randomWord to do shell script "sed -n '" & randomNumber & "p' /usr/share/dict/words"
  23.    
  24.     -- Open Firefox
  25.     tell application "Firefox" to activate
  26.     tell application "System Events"
  27.         keystroke "l" using {command down} -- Select the main URL bar
  28.         delay 1
  29.         -- Tab to the FF search box
  30.         repeat tabPresses times
  31.             keystroke tab
  32.         end repeat
  33.        
  34.        
  35.         -- Enter random word
  36.         keystroke randomWord
  37.         keystroke return
  38.        
  39.         -- Delay a random time (wait for point to be counted) and avoid it looking like a computer
  40.         delay (random number from 10 to 40)
  41.     end tell
  42. end repeat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement