[Pythonmac-SIG] appscript and Firefox

Daniel Lord daniellord at mac.com
Thu Jun 19 05:11:37 CEST 2008


On Jun 18, 2008, at 19:04 PM, Bill Janssen wrote:

> I'm finally trying to learn appscript, and I thought I'd write a
> little system monitor that goes around to my various open applications
> and logs what files/URLs I'm looking at.  For Safari, this is easy:
>
>  print app('Safari').windows.first.current_tab.URL()
>
> but I can't figure out how to get the current URL for Firefox.
> There's a bug report at
> https://bugzilla.mozilla.org/show_bug.cgi?id=427448 which seems to
> show that you can get the URL with the applescript fragment
>
>  set url to get <<class curl>> of window 1 as text
>
> at least for older versions of Firefox.
>
> But how do I write "<<class curl>>" in appscript?

In Safari "URL" is a property of the "tab" class so you can get that  
property by indexing the windows and tab you want.
Generally, the double angle brackets indicate the application being  
addressed doesn't recognize based on its dictionary so those symbols  
are inserted in the script (from what I know--maybe someone smarter  
than me can chime in)..
I just looked at the Firefox 3 Dictionary (with Script Debugger 4) and  
I don't see a URL class nor even tab and windows elements to use to  
select which URL you wanted from the browser.
There is a slip of a dictionary there, but not enough to do much as  
far as I can tell.
Maybe it is planned for the future but not implemented. I even looked  
at the menus to see if one could use System Events but nothing looked  
easy.
It looks impossible from my perspective and knowledge, maybe someone  
smarter has it figured out.

I am using this version:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9) Gecko/ 
2008051202 Firefox/3.0

Daniel


>
>
> Bill
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



More information about the Pythonmac-SIG mailing list