Title: Re: Script to look up selection in Google
On 11/10/03 10:41 AM, "Allen Watson" <[EMAIL PROTECTED]> wrote:
> On or near 11/9/03 9:04 PM, Julian Vrieslander at [EMAIL PROTECTED]
> observed:
>
>> On 11/9/03 8:38 PM, "Allen Watson" <[EMAIL PROTECTED]> wrote:
>>
>>> I just copied this from the AppleScript mailing list. Select a word or
>>> phrase
>>> in Entourage, run the script, and it will look it up in Google, using your
>>> default browser:
>>>
>>> tell application "Microsoft Entourage" to set s to window 1's selection
>>> if (count s) is 0 then set s to (display dialog "Search terms:" default
>>> answer
>>> "")'s text returned
>>> if (count s) is 0 then error number -128
>>> set text item delimiters to "+"
>>> set s to "http://www.google.com/search?hl=en&q=" & s's words
>>> set text item delimiters to {""}
>>> open location s
>>
>> Doesn't work for me. I select one word in an incoming message, run the
>> script, and I get "Parameter error."
>>
>> Entourage X 10.1.4, OS X 10.3.
>
> Weird! It works when I run it from Script Debugger, but run from the Script
> menu in Entourage I get the same "Parameter error". The error seems to be
> occurring in the "open location" statement at the end of the script. I've
> debugged as much as I can. The string passed to the statement is identical
> when run in SD or in Entourage, so I cannot see any cause for the error. It
> should work.
>
> Maybe Paul or someone else can figure out why it is failing in this case.
What happens if you tell Entourage to activate before getting its selection?
tell application "Microsoft Entourage"
activate
try
set s to window 1's selection
if {class of s} is not in {string, Unicode text} then error number-128
on error
beep 2
display dialog "You don't appear to have selected any text."
return
end try
end tell
at the top, in place of :
tell application "Microsoft Entourage" to set s to window 1's selection
When running from the system script menu, System Events may be the front application and 'selection' may be unobtainable in Entourage if its text (it's usually OK when the selection is a (list of) messages, contacts, etc. but may not work for text.)
--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: http://www.entourage.mvps.org/toc.html
PLEASE always state which version of Entourage you are using - 2001 or X. It's often impossible to answer your questions otherwise.
- Re: Sending .zip now that it is bui... Allen Watson
- Re: Sending .zip now that it is built in Kirk McElhearn
- Re: Sending .zip now that it is built in Erik Justus Paiewonsky
- Re: Script to look up selection in Google Julian Vrieslander
- Re: Script to look up selection in Google Allen Watson
- Re: Script to look up selection in Goog... Laurie A. Duncan
- Re: Script to look up selection in ... Allen Watson
- Re: Script to look up selection... David Wignall
- Re: Script to look up sele... Allen Watson
- Re: Script to look up ... Paul Berkowitz
- Is there one good spam killing program? Paul Berkowitz
- Is there one good spam killing prog... Lawrence E. Scovotto, CAE
- Re: Is there one good spam kill... Laurie A. Duncan
- Re: Script to look up selection in ... Julian Vrieslander
- Re: Script to look up selection in ... Allen Watson
- "All documents" in Entourage or Outloo... Carlo Anselmi
- Re: "All documents" in Entourage ... Allen Watson
- Re: "All documents" in Entour... Carlo Anselmi
- Re: "All documents" in En... Allen Watson
- Re: Script to look up selection in Google Tomasz Kukielka
