• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Script error in applications Script Menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Script error in applications Script Menu


  • Subject: Script error in applications Script Menu
  • From: Jeremy K Sellors <email@hidden>
  • Date: Sun, 17 Jul 2005 17:41:27 -0700

Script dose not work in Canvas X application Script Menu but the script does work in the  system scripts menu.
The script copies a word selected in Canvas X text box and looks it up in the Oxford American Dictionary. Canvas X is not a Cocoa application so the contextual menu method dose not work.
When the script is run from the main system script menu it works fine but when I run the  same script from Canvas' own script menu it shows a Canvas error dialog:— 
Script Execution Error:
 ≪script≫ doesn't understand the <<event JonsgClip >>message.
Error/Location Code: -1753/0
The script is as follows:
try --incase the clipboard is empty
    set clip to the clipboard --get old clipboard
end try
set the clipboard to "" --clear clipboard word count works
set dickLookUp to "" -- text to lookup

tell application "Canvas™X"
    set x to selection
    if (count of items of x) > 0 then  --check that no objects are seleted
        tell application "Finder" to display dialog "An object or objects are selected!" & return & "Select a word with the text tool to lookup then retry this script"
        return
    end if
    copy -- I haven't found how to get the selected text without using the clipboard in Canvas.
end tell
set dickLookUp to the clipboard
set wordCount to count of words in dickLookUp
if (wordCount = 0) or (wordCount > 2) then
    display dialog "Too many words or no words were selected!" & return & "Select a word to lookup then retry this script"
    return
end if

tell application "Dictionary" to activate
tell application "System Events"
    tell process "Dictionary"
        tell text field 1 of group 1 of tool bar 1 of window "Dictionary and Thesaurus"
            keystroke dickLookUp
            keystroke return
        end tell
    end tell
end tell
set the clipboard to clip --reset old clipboard

Why do I get this error only when using the applications script menu?



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: PowerPoint outline level
  • Next by Date: Re: UI scripting: how to click 'OK' in Photo-Paint
  • Previous by thread: Re: Using the document element in TextEdit
  • Next by thread: Re: Script error in applications Script Menu
  • Index(es):
    • Date
    • Thread