• 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: Parsing a script file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parsing a script file


  • Subject: Re: Parsing a script file
  • From: Emmanuel <email@hidden>
  • Date: Thu, 17 Apr 2003 17:22:38 +0200

At 11:13 AM +0200 17/04/03, Jean-Baptiste LE STANG wrote:
I'm trying to parse a 'script' (written with Applescript) to get only the names of the handlers. Is there a simple way to do that?


Smile treats the scripts of its objects as objects which would show in the dictionary the following entry:

Class script:
Properties:
container: reference [r/o] -- the object containing the script
parent: script [r/o] -- the parent script
text -- the source text

Elements:
variable by numeric index, name
handler by numeric index, name

Once a script is an object script in Smile, you can edit its source ("text" property) by script, or its handlers individually, and - back to the topic - you can get:

---------------------
name of every handler of theScript
---------------------

(same with "variable" for the properties)

A working example could be:

---------------------
set s to load script f
set script of window 1 to s
name of every handler of script of window 1
---------------------

On the other hand, you've got the famous regexp "^on|to [^(]+" etc. " but it's really painful to have it return properly all the kinds of handlers, and it's still worse if you want it to exclude the handlers that are commented out.

Emmanuel
_______________________________________________
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: Parsing a script file
      • From: Paul Berkowitz <email@hidden>
References: 
 >Parsing a script file (From: Jean-Baptiste LE STANG <email@hidden>)

  • Prev by Date: Re: Is this a bug ?
  • Next by Date: Re: Getting the labels of a record
  • Previous by thread: Parsing a script file
  • Next by thread: Re: Parsing a script file
  • Index(es):
    • Date
    • Thread