Re: Parsing a script file
Re: Parsing a script file
- Subject: Re: Parsing a script file
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 17 Apr 2003 09:02:15 -0700
Similarly in Script Debugger, if that's of interest. You can just get
name of every script handler of script document "Script Name"
after opening the script, which can itself be scripted like this if it's not
already open:
set s to load script alias "Path:to:scipt:"
tell application "Script Debugger"
set w to make new script document
set contents of w to s
compile w
get name of every script handler of s
end tell
--
Paul Berkowitz
>
From: Emmanuel <email@hidden>
>
Date: Thu, 17 Apr 2003 17:22:38 +0200
>
To: email@hidden
>
Subject: Re: Parsing a script file
>
>
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.
_______________________________________________
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.