'AppleScript For Multiple Safari Tabs And Mouse Click?
Complete noob to AppleScript here with a rather complex one:
I would like automate a script that can do the following:
After launching, waits for 61 minutes without doing anything, then:
Opens Safari with 16 tabs (and 16 separate URLS)
Clicks a “Roll!” button on each of the 16 tabs, then pauses for 10 seconds, then:
Closes Safari
Waits another 61 minutes, then:
Performs 2 through 5 over again for a total of 15 repetitions.
One thing to note:
Each URL is unique to the other 15, but they are the same for every repetition.
Is this even possible? From my research into AppleScript I understand there will need to be a little Javascript in there too?
All help appreciated!! Cheers
UPDATE: Ok, I've been tinkering and I found a script to open the 16 tabs (set to generic URLS at the mo):
set urlList to {"http://www.macintouch.com/", "http://www.macnn.com/", "http://www.macworld.com/", "http://www.thinksecret.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/", "http://www.tuaw.com/"}
set numURLs to (count urlList)
tell application "Safari"
activate
-- create all the tabs that are needed
tell application "System Events"
-- enter the url in the open window
keystroke (item 1 of urlList)
key code 36
repeat with i from 2 to (numURLs)
-- for each additional url, first create a tab
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
-- now enter the url
keystroke (item i of urlList)
key code 36
end repeat
end tell
end tell
Can someone help me from here in? The first thing I need is the delay function. So, before this script does anything it waits for 61 minutes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
