Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Applescript - Safari to Camino?

Applescript - Safari to Camino?
Thread Tools
Mac Elite
Join Date: Jan 2001
Status: Offline
Reply With Quote
Nov 20, 2005, 08:09 PM
 
Anyone have any applescript code that will look at all open windows and tabs in Safari, grab the links, and open them up in tabs and windows in Camino?

Thanks!
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Nov 21, 2005, 04:40 AM
 
[php]
set urlsList to {}

tell application "Safari"
repeat with i from 1 to number of documents
set thisDoc to item i of documents
tell thisDoc
copy URL to end of urlsList
end tell
end repeat
end tell

tell application "Camino"
repeat with i from 1 to number of items in urlsList
set thisURL to item i of urlsList
make new document with properties {URL:thisURL}
end repeat
end tell
[/php]

That should do it - but my copy of camino complains when trying to make a new document with props:

Code:
2005-11-21 10:37:32.346 Camino[2680] A key or value could not be handled while converting an Apple event record to an NSDictionary.
     
timmerk  (op)
Mac Elite
Join Date: Jan 2001
Status: Offline
Reply With Quote
Nov 21, 2005, 04:43 AM
 
Thanks! In case you were wondering what I needed it for... sometimes Safari gets way too bogged down with tons of tabs, so I need to start to use Camino.. but copying and pasting each link would be a pain. Thanks!
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Nov 21, 2005, 05:33 AM
 
Hmmm - actually my script doesn't do tabs - I thought Safari's tabs had become scriptable - i must have imagined it - you'll have to use UI scripting to go through the tabs.

e.g.:

http://www.macosxhints.com/article.p...30913153245341
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:43 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2