• 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: Script Debugger: select contents of a handler by name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Debugger: select contents of a handler by name


  • Subject: Re: Script Debugger: select contents of a handler by name
  • From: Paul Berkowitz <email@hidden>
  • Date: Sun, 30 Dec 2001 00:02:12 -0800

On 12/29/01 11:51 PM, "Shane Stanley" <email@hidden> wrote:

> On 12/29/01 12:33 PM, "Jason Bourque" <email@hidden> wrote:
>
>> Hello,
>>
>> This is what I have but it doen't work.
>>
>> I want to select contents of a handler by name.
>>
>>
> How about this:
>
> set handlerName to "testHandler"
>
> tell application "Script Debugger"
> tell document 2
> set x to contents
> set oldDelims to AppleScript's text item delimiters
> set AppleScript's text item delimiters to {"on " & handlerName & "("}
> set theOffset to length of text item 1 of x
> set AppleScript's text item delimiters to oldDelims
> select character (theOffset + 1)
> balance
> end tell
> end tell

Ooh, I like that a lot better than mine, I forgot about 'balance'. But,
unless you're 100% consistent about always using "on", maybe:

tell application "Script Debugger"
tell document 2
set x to contents
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"on " & handlerName & "("}
set theOffset to length of text item 1 of x
if theOffset = length of x then
set AppleScript's text item delimiters to {"to " & handlerName & "("}
set theOffset to length of text item 1 of x
end if
set AppleScript's text item delimiters to oldDelims
select character (theOffset + 1)
balance
end tell
end tell

--
Paul Berkowitz


  • Follow-Ups:
    • Re: Script Debugger: select contents of a handler by name
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Script Debugger: select contents of a handler by name (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Script Debugger: select contents of a handler by name
  • Next by Date: Re: Script Debugger: select contents of a handler by name
  • Previous by thread: Re: Script Debugger: select contents of a handler by name
  • Next by thread: Re: Script Debugger: select contents of a handler by name
  • Index(es):
    • Date
    • Thread