Re: Parsing a script file
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.