Re: Grabbing current Safari webpage url
Re: Grabbing current Safari webpage url
- Subject: Re: Grabbing current Safari webpage url
- From: Adam Leonard <email@hidden>
- Date: Thu, 6 Mar 2008 22:25:38 -0800
If you are looking to do it in Applescript (you want it to work in
10.4, for example), here is the script I use:
tell application "System Events"
if application process "Safari" exists then tell application "Safari"
to get URL of document 1
end tell
To get the title of the webpage, just substitute "name" for "URL"
Then, call it with NSApplescript and grab the result with an
NSAppleEventDescriptor
Adam Leonard
On Mar 6, 2008, at 9:27 PM, Adam P Jenkins wrote:
You can use Scripting Bridge to do the same things you could do in
AppleScript, but in Objective-C, or other languages.
http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/Introduction/chapter_1_section_1.html
On Mar 6, 2008, at 9:59 PM, Steve Sheets wrote:
Good evening all...
Is there a way of finding out what is the current topmost webpage
being viewed by Safari? Somehow then grabbing the url & title of
that page? I have seen a couple applications that do exactly that.
You goto a web page using Safari, but then goto the other
applications window, and press a button. That application somehow
acquires the information from Safari, and then uses it for some
purpose. Some Bookmark apps do it this way, as well as some
download utilities.
I think I can get this information using Applescript, but one of
the developers hinted that he was not using Applescript to do this.
Is there an application service or Safari API that passes your
application this information?
Information (or better yet, source code) for doing this whatever
your method would be appreciated!
Thanks,
Steve Sheets
Midnight Mage Software
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
@thejenkins.org
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden