How to simulate C's function pointer in AppleScript?
How to simulate C's function pointer in AppleScript?
- Subject: How to simulate C's function pointer in AppleScript?
- From: André Berg <email@hidden>
- Date: Thu, 23 Oct 2008 12:58:37 +0200
Hi,
Ok, that may not be the best question formulated, but let me give you
a quick background to the question, if I may:
I have a Timer class, er .. I meant a Timer script object that is
inside the top-level script,
like so:
script Timer
property statement
: "the statement to execute"
-- ... stuff ...
-- ... somewhere further down ...
on timeit()
run script my statement
end timeit
-- ... stuff ...
end script
Now I have the
function I want to time also defined within the toplevel script, in
fact physically
it comes just before the Timer script:
on myHandlerToTime()
-- do something
end
The question now is how can I correctly pass, from the top-level
script, myHandlerToTime()
in the statement property of the Timer script so that it gets used as
the direct parameter
to the run script command inside the Timer script?
If I do this:
set Timer's statement to
"set R to myHandlerToTime()"
Timer's timeit()
Then of course I get an error like:
"script doesn't understand the myHandlerToTime message."
Of course "run script" does not see the function... I need to give it a
proper reference to
myHandlerToTime(). I tried various forms of its, my, property : parent,
property : me,
parent's parent's but I am running out of ideas.
Any help would be appreciated.
Thanks for reading!
André
|
_______________________________________________
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