Im not really familiar with applescript (using C/Python/Pacsal atm). So far did the autoclicker for my WoW ore prospection.

I would like to use the script on safari to click the link with name "1st Text goes here" to open new tab, then click other link "2nd Text goes here" and then close tab. (repeat n number of times)

My knowledges led me to the following.

tell application "Safari"

end tell

Hints and tips are also appreciated.


Assuming these links are going to be in the same place every time, I'd try Watch Me Do (open up Automator, tell it you want an application. There are lots of built-in actions in the "Internet" subsection of Library, Website Popup looks promising for you.

If that all fails or you want something quick and dirty, pressing the Record button up at the top right will record your screen and keyboard inputs, as well as events for you. You could just code a loop to run the generated code over and over again N times, but be warned that Watch Me Do (the thing activated by record) is only screen scraping. If those links ever move or your window isn't in the same place, the script will bomb, probably clicking on things you don't want it to at all, so be careful!

  • i got it, but the all stuff is about looking for the text on page, its coordinates change after each cycle :/ – DvaNapasa Jun 13 '14 at 21:26
  • Could you elaborate more on what you're trying to do? Do you need to go to a given URL every time, or click a given button on a web page or in a different application? – agentroadkill Jun 14 '14 at 0:02
  • press two links in sequence, links have specific names(not url), that dont change after cycle. then close opened tabs. repeat – DvaNapasa Jun 14 '14 at 5:21
  • Sounds like this might help: stackoverflow.com/questions/3369073/… Is there a reason you're using AppleScript rather than python or java? – agentroadkill Jun 14 '14 at 10:42
  • I can't install python on my mac or make c work outside the terminal with safari, know this is stupid but thats how it is :D thnx for the link, willing to + it, but have to permission yet) – DvaNapasa Jun 14 '14 at 10:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .