Hey Dave,
On Mar 20, 2011, at 12:57, DealTek wrote:
do shell script "open -a Firefox " & thisPage
That's handy even if rather kludgy.
Mozilla.org should at least give us a 'do _javascript_' function; their current Applescript implementation is nearly useless.
On Mar 20, 2011, at 10:43 AM, DealTek wrote:
tell application "Safari"
activate
set my_URL to the URL in document 1
end tell
You were close:
tell application "Safari"
if document 1 exists then
set pageURL to URL of document 1
end if
end tell
There's no need to 'activate' unless you genuinely want to bring Safari forward.
Not certain what you're trying to accomplish here:
--Convert Unicode Text of my_URL to Plain text
set my_URL to «class ktxt» of ((my_URL as string) as record)
'class ktxt' doesn't produce really plain text anymore (since Tiger?).
This is unfortunately useless:
tell application "Firefox"
activate
get URL my_URL
end tell
Look in Firefox's dictionary, and you will fail to find any such ability.
------------------------------------------------------------------------------------------------
on safariUrlToFirefox()
try
tell application "Safari"
if document 1 exists then
set pageURL to URL of document 1
pageURL -- Will error if page has no url.
do shell script "open -a Firefox " & quoted form of pageURL
else
error "NO DOCUMENT OPEN!"
end if
end tell
on error errMsg number errNum
set sep to "=============================="
set e to sep & return & "Error: " & errMsg & return & sep & return ¬
& "Error Number: " & errNum & return & sep
beep
display dialog e
end try
end safariUrlToFirefox
------------------------------------------------------------------------------------------------
safariUrlToFirefox()