Firefox window title

Hi

Can anyone help me to get the title from a window in firefox…

http://www.last.fm displays the name of songs that are currently played in
the title of a little html player window. I am using romeo on my phone to
control the player (html window) via bluetooth… The only problem i m
having is how to get the title of the window, to display the song currently
played…

Thanks, michael

tell application "Firefox" to «class pTit» of window 1

great thanks a lot.

Here’s an even simpler one:
Anyone know how to get the current URL of the front Firefox window? I can send Firefox to Safari URLs using:


tell application "Safari"
	set theURL to the URL of the front document
end tell

tell application "Firefox"
	Get URL theURL
	activate
end tell

but it doesn’t work the other way around (Firefox Dictionary is a little empty and doesn’t include URL of the front document).

This is «class curl». See result of this one-line:

tell application "Firefox"
	window 1's properties
end tell

I try that and I get the error message:

Firefox got an error: Can’t get every property of window 1. Invalid index.

Should it be «class curl» of window 1’s properties?

If you have a LAN behind a router, this is a great way to get your external IP address because your IP address appears in the title of the new page returned. I’ve stuck in a delay but you should test for a new front window. Doesn’t work in Camino; there you have to: “get name of window 1”

tell application "Firefox"
	Get URL "http://www.whatismyip.com"
	delay 3 -- or better, test for a new window
	set theTitle to «class pTit» of window 1
	get word 4 of theTitle  as string
end tell

Here it is:


tell application "Firefox"
	set theURL to «class curl» of window 1
end tell

tell application "Safari"
	make new document with properties {URL:theURL}
end tell

That creates a new window with the URL retrieved from Firefox. What would loading it into the front window of Safari be?

I think this is the code:

tell app "Safari"
	set url of document 1 to "foo"
end tell

So, here’s how to get one URL into the other browser, no matter which way you are going:

Safari to Firefox:



tell application "Safari"
	set theURL to the URL of the front document
end tell

tell application "Firefox"
	Get URL theURL
	activate
end tell

…and Firefox to Safari:



tell application "Firefox"
	set theURL to «class curl» of window 1
end tell

tell application "Safari"
	set URL of document 1 to theURL
	activate
end tell

Thanks to all for the help.
Now, slghtly off-topic, although it’s really a follow on now that I have these little scripts up and running:

Anyone figured out a way (short of buying and running QuickKeys) to execute scriptmenu scripts from keystrokes? I seem to remember in the OS 9 version of scriptmenu that you could use an escape character to denote a key command. This does not seem to be the case in the OS X version. Also, the built-in key command assignment control panel of OX X 10.3x. doesn’t work on the script menu either. Is there a lightweight 3rd party utility (preferably free or cheap) that lets you execute scriptmenu scripts from the keyboard?

I use myself the full-featured FastScripts (a replacement for Apple’s Script Menu), which seems cheap enough for me:
http://www.red-sweater.com/RedSweater/FastScripts.html

  • Offers keystrokes and more options

Sounds like FastScripts is the ticket.
-D