Title: Re: Insert URL script for OmniWeb?
On or near 6/19/04 12:32 PM, Sherman Wilcox at [EMAIL PROTECTED] observed:
> On 6/19/04 1:26 PM, "James Tummins" <[EMAIL PROTECTED]> wrote:
>
>> There's a wonderful Applescript for inserting URL from open Safari windows.
>> Does anyone know of a similar Applescript for inserting URLs from OmniWeb
>> windows, or even a generalize script to insert URLs from the preferred
>> browser?
>
> I have a _javascript_ that I use as a bookmark (the first one, so it's Cmd-1
> in Safari and OmniWeb). Here it is:
>
> _javascript_:void(document.location='mailto:?subject='+document.title+'&body=<
> '+document.location+'>')
>
> Clicking this bookmark sends the current page URL from Omni to a new message
> in the default email client. Works with Entourage.
In this case the _javascript_ is probably a better choice than AppleScript, since each browser uses slightly different syntax, but the _javascript_ will work for any of them. A specific script for Omniweb would look like this (the identical code also works for iCab, changing the application name wherever it appears):
(*
Insert Omniweb Address
Adapted by Allen Watson from: Insert IE Address by Microsoft.
Inserts the address of the web page currently being browsed in Omniweb into a Entourage message
*)
on run
set theURL to ""
-- get URL from Omniweb
try
tell application "OmniWeb"
set theFrontmostWindowID to item 1 of (ListWindows)
set theFrontmostWindowInfo to (GetWindowInfo theFrontmostWindowID)
set theURL to item 1 of theFrontmostWindowInfo
end tell
on error
display dialog "There was an error getting the address from Omniweb" buttons {"OK"}
end try
-- paste it into the message
if the length of theURL is greater than 0 then
try
tell application "Microsoft Entourage"
set selection to ("<" & theURL & ">")
end tell
on error theErr
-- display dialog theErr
display dialog "This script can only insert into the body of a message" buttons {"OK"}
end try
end if
end run
- Insert URL script for OmniWeb? James Tummins
- Re: Insert URL script for OmniWeb? Sherman Wilcox
- Re: Insert URL script for OmniWeb? Allen Watson
- Re: Insert URL script for OmniWeb? James Tummins
- Re: Insert URL script for OmniWeb? James Tummins
