Re: copy url rom safari to firefox issue
Re: copy url rom safari to firefox issue
- Subject: Re: copy url rom safari to firefox issue
- From: DealTek <email@hidden>
- Date: Mon, 21 Mar 2011 08:22:18 -0700
BTW: I wanted to make sure that firefox would open (in case it was not) so I added a few lines - Is this the best way to make sure firefox is open?
-------------------------
on safariUrlToFirefox()
try
tell application "Safari"
if document 1 exists then
set pageURL to URL of document 1
--say pageURL
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
tell application "Firefox"
activate
do shell script "open -a Firefox " & quoted form of pageURL
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()
------------------
On Mar 20, 2011, at 11:33 PM, Christopher Stone wrote:
> 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()
>
> --
> Best Regards,
> Chris
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
--
Thanks,
Dave - DealTek
email@hidden
[db-11]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden