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…
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
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?
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?