• 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
Re: Better Open Dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Better Open Dictionary


  • Subject: Re: Better Open Dictionary
  • From: Nathan Day <email@hidden>
  • Date: Thu, 6 Mar 2003 16:05:48 +1030

I have done similar things, I have a script to let me choose from every active application and one to choose from every available scripting addition, I also have on to for finder as well as the standard additions.

-- choose from every active application

on run
tell application "Finder"
set theAppFileList to {}
set theNameList to {}
repeat with theProcess in application processes
if visible of theProcess then
set theAppFileList to theAppFileList & application file of theProcess
set theNameList to theNameList & name of theProcess
end if
end repeat

end tell

tell application "Script Editor" to set theSelectedList to choose from list theNameList with multiple selections allowed without empty selection allowed

set theOpenList to everyFile to theSelectedList out of theAppFileList

tell application "Script Editor" to open theOpenList
end run

to everyFile to aNameList out of aFileList
set theFoundFiles to {}
repeat with theName in aNameList
repeat with theFile in aFileList
if displayed name of (info for theFile) is equal to contents of theName or name of (info for theFile) is equal to contents of theName then
set theFoundFiles to theFoundFiles & theFile
end if
end repeat
end repeat

return theFoundFiles
end everyFile

-- every available scripting addition

on run
set theAdditionsList to everyScriptingAddition()

tell application "Script Editor" to set theSelectedList to choose from list nameList of theAdditionsList with multiple selections allowed without empty selection allowed

set theOpenList to everyFile to theSelectedList out of (aliasList of theAdditionsList)

tell application "Script Editor" to open theOpenList
end run

to everyFile to aNameList out of aFileList
set theFoundFiles to {}
repeat with theName in aNameList
repeat with theFile in aFileList
if displayed name of (info for theFile) is equal to contents of theName or name of (info for theFile) is equal to contents of theName then
set theFoundFiles to theFoundFiles & theFile
end if
end repeat
end repeat

return theFoundFiles
end everyFile

to everyScriptingAddition()
set theResult to {nameList:{}, aliasList:{}}

set theFolder to path to scripting additions from user domain
set theNameList to list folder theFolder without invisibles

repeat with theName in theNameList
set theResult to {nameList:nameList of theResult & theName, aliasList:aliasList of theResult & alias (theFolder & theName as string)}
end repeat

set theFolder to path to scripting additions from local domain
set theNameList to list folder theFolder without invisibles

repeat with theName in theNameList
set theResult to {nameList:nameList of theResult & theName, aliasList:aliasList of theResult & alias (theFolder & theName as string)}
end repeat

set theFolder to path to scripting additions from System domain
set theNameList to list folder theFolder without invisibles

repeat with theName in theNameList
set theResult to {nameList:nameList of theResult & theName, aliasList:aliasList of theResult & alias (theFolder & theName as string)}
end repeat

return theResult
end everyScriptingAddition

On Thursday, March 6, 2003, at 02:20 AM, Steve Roy wrote:

Maybe a similar solution already got posted here before but I don't see any harm
in sharing my implementation.

I got fed up with how slow the Open Dictionary command built into Script Editor
is and I wrote my own. As it is, it's designed to work with Script Editor 2.0b,
but if you have Big Cat installed, it's a simple matter to modify the script to
work with Script Editor 1.9 too.

Just save the following into the folder /Library/Scripts/Script Editor Scripts.
After restarting Script Editor 2.0b, you'll be able to use it via the contextual
menu. The script will bring up a normal file dialog so you can browse and locate
the application of interest. On the other hand, if you select the name of an
application in a 'tell application' statement, then the script will open the
dictionary for this app directly. Enjoy!

tell application "Script Editor"
set theSelectedText to contents of selection of front document
if theSelectedText is "" then
choose file with prompt "Select items to open their dictionaries: " of
type "APPL"
else
tell me to get path to application theSelectedText
end if
open result
end tell

Steve
Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Better Open Dictionary
      • From: John Delacour <email@hidden>
  • Prev by Date: Re: Selecting messages in Outlook Express
  • Next by Date: Re: path to selection/ASCII character 173
  • Previous by thread: Re: Better Open Dictionary
  • Next by thread: Re: Better Open Dictionary
  • Index(es):
    • Date
    • Thread