image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
LinkBack Thread Tools
  #9  
Old August 12th, 2003, 08:29 AM
Registered User
 
Join Date: Jun 2002
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
kalantna is on a distinguished road
what about a script that will prompt the user for the URL they want to open and then open that URL in say IE, Camino, Safari, and Netscape?

Now, that would be a useful script for me when developing websites.
__________________
Kalantna

10.3.3
iMac 800 mhz, 768 MB RAM, 60 GB HD,
nVidia Gforce2

10.3.3
Titanium Powerbook 800 mhz, 1 gig RAM,
30 GB HD, ATI Radeon 8500

Windows XP
Dimension 8300 2.66 ghz, 1256 MB RAM, 120 GB HD, 64 MB Gforce4
Reply With Quote
  #10  
Old August 12th, 2003, 12:26 PM
dlloyd's Avatar
Official Pianist
 
Join Date: Dec 2002
Location: At a keyboard. One or the other.
Posts: 2,978
Thanks: 0
Thanked 0 Times in 0 Posts
dlloyd is on a distinguished road
Code:
display dialog "Open in" buttons {"Cancel", "All Browsers", "Just Safari"} default button 3
copy the result as list to {the button_pressed}

if the button_pressed is equal to "All Browsers" then
	display dialog "Enter the URL to go to:" default answer "http://" buttons {"Choose Local File", "Cancel", "OK"} default button 3
	copy the result as list to {the empty_var, the button_pressed}
	if the button_pressed is equal to "OK" then
		copy the result as list to {the goto_URL}
		tell application "Finder"
			launch application "Safari"
			launch application "Camino"
			launch application "OmniWeb"
			launch application "iCab"
			launch application "Internet Explorer"
			launch application "Netscape"
			launch application "Mozilla"
			wait
		end tell
		tell application "Safari"
			activate
			make new document at beginning of documents
			open location goto_URL
		end tell
		tell application "Camino"
			activate
			make new document at beginning of documents
			open location goto_URL
		end tell
		tell application "OmniWeb"
			activate
			make new document at beginning of documents
			GetURL goto_URL
		end tell
		tell application "iCab"
			Activate
			make new window
			OpenURL goto_URL
		end tell
		tell application "Internet Explorer"
			Activate
			GetURL goto_URL
		end tell
		tell application "Netscape"
			activate
			Get URL goto_URL
		end tell
		tell application "Mozilla"
			activate
			Get URL goto_URL
		end tell
	else if the button_pressed is equal to "Choose Local File" then
		set the local_file to choose file with prompt "Choose a local file to open:"
		tell application "Finder"
			launch application "Safari"
			launch application "Camino"
			launch application "OmniWeb"
			launch application "iCab"
			launch application "Internet Explorer"
			launch application "Netscape"
			launch application "Mozilla"
		end tell
		tell application "Safari"
			activate
			make new document at beginning of documents
			open local_file
		end tell
		tell application "Camino"
			activate
			make new document at beginning of documents
			open local_file
		end tell
		tell application "OmniWeb"
			activate
			make new document at beginning of documents
			open local_file
		end tell
		tell application "iCab"
			Activate
			make new window
			ShowFile local_file
		end tell
		tell application "Internet Explorer"
			Activate
			open local_file
		end tell
		tell application "Netscape"
			activate
			open local_file
		end tell
		tell application "Mozilla"
			activate
			open local_file
		end tell
	end if
else if the button_pressed is equal to "Just Safari" then
	display dialog "Enter the URL to go to:" default answer "http://" buttons {"Choose Local File", "Cancel", "OK"} default button 3
	copy the result as list to {the empty_var, the button_pressed}
	if the button_pressed is equal to "OK" then
		copy the result as list to {the goto_URL}
		tell application "Safari"
			activate
			make new document at beginning of documents
			open location goto_URL
		end tell
	else if the button_pressed is equal to "Choose Local File" then
		set the local_file to choose file with prompt "Choose a local file to open:"
		tell application "Safari"
			activate
			make new document at beginning of documents
			open local_file
		end tell
	end if
end if
This is something I wrote in a few hours this morning, you better be grateful, it took me so long :P
Really though, I haven't done AppleScript for so long, it was kinda cool to get back to it!
Oh, and I know that all those browser actions work on their own, but the IE, Netscape, and Mozilla ones don't work with all those others in front of them. What you'll need to do is take out the ones you don't need (iCab, Omniweb, etc.) and just leave the others. You can also change the 'Default' browser. I assume you know a little Applescript, so I won't describe how to do it unless you need me to
__________________
< Also Known As aeromusek in places >

< PowerBook | 1.67GHz | 1024MB RAM | 120GB | 17" High Res >
< iPod | 20GB | 3rd gen >


"the show must go on" - the artists of the world
Reply With Quote
  #11  
Old September 27th, 2008, 11:19 AM
Registered User
 
Join Date: Sep 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Killian 42 is on a distinguished road
Thumbs up Hi

No, No

All you have to do is say:

open location "http://www.youtube.com/watch?v=QFCSXr6qnv4&feature=user"

Or something along those lines.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting 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 Off
Pingbacks are Off
Refbacks are Off

Forum Jump


All times are GMT -5. The time now is 11:18 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.