|
|
#1 |
|
Triple-A Player
Join Date: Oct 2003
Posts: 121
|
AppleScript and Firefox (getting front URL)
I've been trying to figure out how to get the frontmost URL from Firefox's frontmost window.
If I just do: tell application "Firefox" set myFirefox to properties of front window end tell then I get: {«class pObT»:window, «class pTit»:"Mozilla Firefox 1.0 Now Available", «class curl»:"http://www.mozilla.org/products/firefox/start/", index:1, bounds:{705, 44, 1731, 827}, «class pLcn»:{705, 44}, closeable:true, titled:true, modal:false, resizable:false, zoomable:true, zoomed:true, «class pNMo»:true, «class pMMo»:false, floating:false, visible:true} However, no matter what I do, I can't access this properties data structure...or any of its components. Any ideas? I know I can register to receive reports of new FireFox URL openings but for what I am doing that won't work---I just need to be able to query the currently frontmost URL. Thanks, Alex |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Dec 2004
Posts: 1
|
Here's what you are looking for...
tell application "firefox" to set theURL to «class curl» of window 1 |
|
|
|
|
|
#3 |
|
Registered User
Join Date: Feb 2005
Posts: 1
|
I am trying to use this to bring back some of the other properties of the firefox window and I cannot retrieve the properties (I am getting a conversion error).
I want to be able to extract each property to a variable. Can someone help me with this? Are the properties being returned an array? |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Aug 2007
Posts: 1
|
you can convert the properties to list quite easy:
Code:
tell application "Firefox" set myFirefox to properties of front window as list end tell Code:
{window, "The macosxhints Forums - Reply to Topic", "http://forums.macosxhints.com/newreply.php?do=newreply&noquote=1&p=184698", 1, {0, 44, 1440, 895}, {0, 44}, true, true, false, false, true, false, true, false, false, true}
Code:
tell application "Firefox" set myFirefox to properties of front window as list get item 3 of myFirefox end tell |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Jun 2009
Posts: 1
|
Try this if you use FF 3.0.x
Code:
tell application "Firefox" to activate
tell application "System Events"
keystroke "l" using {command down} -- Highlight the URL field.
keystroke "c" using {command down}
end tell
delay 0.5
the clipboard
That should get you the current URL and not require that you have enabled access for assistive devices. |
|
|
|
![]() |
|
|