• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Safari Scripting Help (Newbie stuff) Complete!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Safari Scripting Help (Newbie stuff) Complete!


  • Subject: Re: Safari Scripting Help (Newbie stuff) Complete!
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 28 Dec 2007 15:18:32 -0700

On Dec 28, 2007, at 2:40 PM, Mark J. Reed wrote:

tell application "Safari"
activate
if not (document 1 exists) then tell (make new document) to set URL
to "http://www.macscripter.net/";
end tell

If document 1 does exist, that doesn't do anything; presumably the OP would like to set its URL in that case.

Whoops. Got lost in the forest and didn't see the trees. In other words, you're right.


tell application "Safari"
	activate
	if not (document 1 exists) then make new document
	tell document 1 to set URL to "http://www.macscripter.net/";
end tell

Or if you want to keep whatever is in an existing document, and not
replace it with the new URL:

tell application "Safari"
activate
tell (make new document) to set URL to "http://www.macscripter.net/ "
end tell

So does (make new document) open a new window or a new tab? I know you can do the latter explicitly with (make new tab)...

It makes a new window.

tell application "Safari"
	make new document
	tell window 1
		set new_tab to (make new tab)
		set current tab to new_tab
	end tell
	tell new_tab to set URL to "http://www.macscripter.net/";
end tell

-- Michelle

--
"Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed."
President Dwight D. Eisenhower, April 16, 1953


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Re: Safari Scripting Help (Newbie stuff) Complete! (From: Peter Bunn <email@hidden>)
 >Re: Safari Scripting Help (Newbie stuff) Complete! (From: "Mark J. Reed" <email@hidden>)
 >Re: Safari Scripting Help (Newbie stuff) Complete! (From: Michelle Steiner <email@hidden>)
 >Re: Safari Scripting Help (Newbie stuff) Complete! (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: [OT] list search engine problems (was: Re: AppleScript-Users Digest, Vol 4, Issue 557)
  • Next by Date: INDESIGN CS3: Loading the PLace Cursor with Multiple Files
  • Previous by thread: Re: Safari Scripting Help (Newbie stuff) Complete!
  • Next by thread: Script doesn't work in Leopard anymore...
  • Index(es):
    • Date
    • Thread