• 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 DEBUGGER » HANDLER PICK-LIST » PORTABLE VERSION
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SCRIPT DEBUGGER » HANDLER PICK-LIST » PORTABLE VERSION


  • Subject: SCRIPT DEBUGGER » HANDLER PICK-LIST » PORTABLE VERSION
  • From: Christopher Stone <email@hidden>
  • Date: Sun, 18 Sep 2011 13:09:49 -0500

Hey Folks,

Today I made a few changes to my handler pick-list script for Script Debugger.

 • It now displays the number of libraries and handlers in the choose-from dialog.
 • It now provides a library name header for each sub-list.
 • It now sorts the handler names on a per-library basis.

I use this script directly when I remember the handler names well enough.

I also use it to create an Applescript-Handler-Set in Typinator which allows fuzzy-searching and helps when my memory is also fuzzy.  :)

This script is pure vanilla and should work on any Mac OS back to Tiger (at least).

The non-portable script I use on my machine utilizes the Satimage.osax for several functions and is a bit faster.

--
Best Regards,
Chris

----------------------------------------------------------------------------------------------
# SCRIPT DEBUGGER » HANDLER PICK-LIST » PORTABLE VERSION
----------------------------------------------------------------------------------------------
#       Author: Christopher Stone
#      Created: 2010-11-03 : 10:42
#     Modified: 2011-09-18 : 12:18
#  Application: Script Debugger
#      Purpose: Get all Handler Names of all Script Debugger Libs except those labeled red.
#             : Present a choose-from list for the user to pick one or more and set the 
#             : selection of the front script document to the result.
# Dependencies: none
----------------------------------------------------------------------------------------------

set handlerCnt to 0
set sep to "----------------------------------------------------------------------"
tell application "Script Debugger 4.5"
try
  set libFolder to (its script libraries folder) as alias
  set handlerList to {}
  tell application "Finder"
    set libList to (files of libFolder whose label index is not 2) as alias list
    set libNameList to (name of files of libFolder whose label index is not 2)
  end tell
  set libCnt to length of libList
  repeat with i from 1 to (length of libList)
    set libScript to quoted form of (POSIX path of (contents of item i of libList))
    set libScriptName to item i of libNameList
    set end of handlerList to sep
    set end of handlerList to ("» " & libScriptName)
    set end of handlerList to sep
    set _temp to (do shell script "osadecompile " & libScript & " | egrep -i \"^on .+\\(.+\\)\" | sort -f")
    set handlerCnt to handlerCnt + (length of (paragraphs of _temp))
    set end of handlerList to _temp
  end repeat
  set end of handlerList to sep
  set AppleScript's text item delimiters to return
  set handlerList to handlerList as string
  set AppleScript's text item delimiters to {""}
  set handlerList to do shell script "tr '\\r' '\\n' <<<" & (quoted form of handlerList) & " | sed -E 's/^on //'"
  set handlerList to make_list(handlerList, return) of me
  set handlerList to choose from list handlerList ¬
    with title "Library Handlers" with prompt ¬
      ("" & libCnt & " LIBRARIES" & return & ("" & handlerCnt & " HANDLERS") & return & return & ¬
        "PICK ONE OR MORE HANDLERS:") with multiple selections allowed
  if handlerList ≠ {} and handlerList ≠ false then
    set handlerList to join_list(handlerList, return) of me
    set selection of document 1 to handlerList
  end if
on error errMsg number errNum
  beep
  display dialog "Error: " & errMsg & return & "Error Number: " & errNum
end try
end tell

------------------------------------------------------------------------------------------------
# HANDLERS
------------------------------------------------------------------------------------------------
on join_list(ListToJoin, deLimiter)
set oldTIDS to AppleScript's text item delimiters
set AppleScript's text item delimiters to deLimiter
set joinedList to ListToJoin as string
set AppleScript's text item delimiters to oldTIDS
return joinedList
end join_list
------------------------------------------------------------------------------------------------
on make_list(sourceText, deLimiter)
set oldTIDS to AppleScript's text item delimiters
set AppleScript's text item delimiters to deLimiter
set newList to text items of sourceText
set AppleScript's text item delimiters to oldTIDS
return newList
end make_list
------------------------------------------------------------------------------------------------

 _______________________________________________
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

  • Prev by Date: Re: INDESIGN: Problem Passing Doc Through Handlers of Called Script
  • Next by Date: Re: entire contents
  • Previous by thread: Re: iWorks Pages "Print" dialog
  • Next by thread: Excel 2008 query tables not remembering their SQL-SOLVED
  • Index(es):
    • Date
    • Thread