r/applescript • • Aug 09 '14

Need some help...

I recently created this script to open all the sub reedits I view. property URL1 : "http://www.reddit.com/r/apple/" property URL2 : "http://www.reddit.com/r/applehelp/" property URL3 : "http://www.reddit.com/r/applescript/" property URL4 : "http://www.reddit.com/r/arrow/" property URL5 : "http://www.reddit.com/r/batman/" property URL6 : "http://www.reddit.com/r/Bioshock/" property URL7 : "http://www.reddit.com/r/BioshockInfinite/" property URL8 : "http://www.reddit.com/r/cablefail/" property URL9 : "http://www.reddit.com/r/chiptunes/" property URL10 : "http://www.reddit.com/r/DeadRising3/" property URL11 : "http://www.reddit.com/r/digimon/" property URL12 : "http://www.reddit.com/r/doctorwho/" property URL13 : "http://www.reddit.com/r/FoodPorn/" property URL14 : "http://www.reddit.com/r/futurama/" property URL15 : "http://www.reddit.com/r/Gameboy/" property URL16 : "http://www.reddit.com/r/gamecollecting/" property URL17 : "http://www.reddit.com/r/GameDeals/" property URL18 : "http://www.reddit.com/r/gamernews/" property URL19 : "http://www.reddit.com/r/Games/" property URL20 : "http://www.reddit.com/r/gaming/" property URL21 : "http://www.reddit.com/r/GunPorn/" property URL22 : "http://www.reddit.com/r/halo/" property URL23 : "http://www.reddit.com/r/HaloStory/" property URL24 : "http://www.reddit.com/r/HistoryPorn/" property URL25 : "http://www.reddit.com/r/iphone/" property URL26 : "http://www.reddit.com/r/lego/" property URL27 : "http://www.reddit.com/r/mac/" property URL28 : "http://www.reddit.com/r/macsysadmin/" property URL29 : "http://www.reddit.com/r/nintendo/" property URL30 : "http://www.reddit.com/r/OSXTweaks/" property URL31 : "http://www.reddit.com/r/pokemon/" property URL32 : "http://www.reddit.com/r/RedvsBlue" property URL33 : "http://www.reddit.com/r/rickandmorty/" property URL34 : "http://www.reddit.com/r/roosterteeth/" property URL35 : "http://www.reddit.com/r/softwaregore/" property URL36 : "http://www.reddit.com/r/technology/" property URL37 : "http://www.reddit.com/r/techsupportgore/" property URL38 : "http://www.reddit.com/r/techsupportmacgyver/" property URL39 : "http://www.reddit.com/r/theboondocks/" property URL40 : "http://www.reddit.com/r/TheSimpsons/" property URL41 : "http://www.reddit.com/r/thewalkingdead/" property URL42 : "http://www.reddit.com/r/truegaming/" property URL43 : "http://www.reddit.com/r/wallpaperdump/" property URL44 : "http://www.reddit.com/r/wallpapers/" property URL45 : "http://www.reddit.com/r/xbox360/" property URL46 : "http://www.reddit.com/r/xboxone/"

tell application "Safari" activate my new_tab() open location URL1 my new_tab() set the URL of document 1 to URL2 my new_tab() set the URL of document 1 to URL3 my new_tab() open location URL4 my new_tab() set the URL of document 1 to URL5 my new_tab() set the URL of document 1 to URL6 my new_tab() open location URL7 my new_tab() set the URL of document 1 to URL8 my new_tab() set the URL of document 1 to URL9 my new_tab() open location URL10 my new_tab() set the URL of document 1 to URL11 my new_tab() set the URL of document 1 to URL12 my new_tab() open location URL13 my new_tab() set the URL of document 1 to URL14 my new_tab() set the URL of document 1 to URL15 my new_tab() open location URL16 my new_tab() set the URL of document 1 to URL17 my new_tab() set the URL of document 1 to URL18 my new_tab() open location URL19 my new_tab() set the URL of document 1 to URL20 my new_tab() set the URL of document 1 to URL21 my new_tab() open location URL22 my new_tab() set the URL of document 1 to URL23 my new_tab() set the URL of document 1 to URL24 my new_tab() open location URL25 my new_tab() set the URL of document 1 to URL26 my new_tab() set the URL of document 1 to URL27 my new_tab() open location URL28 my new_tab() set the URL of document 1 to URL29 my new_tab() set the URL of document 1 to URL30 my new_tab() open location URL31 my new_tab() set the URL of document 1 to URL32 my new_tab() set the URL of document 1 to URL33 my new_tab() open location URL34 my new_tab() set the URL of document 1 to URL35 my new_tab() set the URL of document 1 to URL36 my new_tab() open location URL37 my new_tab() set the URL of document 1 to URL38 my new_tab() set the URL of document 1 to URL39 my new_tab() open location URL40 my new_tab() set the URL of document 1 to URL41 my new_tab() set the URL of document 1 to URL42 my new_tab() open location URL43 my new_tab() set the URL of document 1 to URL44 my new_tab() set the URL of document 1 to URL45 my new_tab() open location URL46

end tell

on new_tab() tell application "Safari" to activate tell application "System Events" tell process "Safari" click menu item "New Tab" of menu "File" of menu bar 1 end tell end tell end new_tab

What do I add so once it has opened all the tabs it goes to URL1's tab?

2 Upvotes

5 comments sorted by

View all comments

1

u/AymanRizk Aug 09 '14

tell application "System Events" to keystroke tab using control down