• 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
How to simulate C's function pointer in AppleScript?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How to simulate C's function pointer in AppleScript?
      • From: Philip Aker <email@hidden>
    • Re: How to simulate C's function pointer in AppleScript?
      • From: Jay Louvion <email@hidden>
  • Prev by Date: Re: renaming files with applescript
  • Next by Date: Re: How to simulate C's function pointer in AppleScript?
  • Previous by thread: Re: renaming files with applescript
  • Next by thread: Re: How to simulate C's function pointer in AppleScript?
  • Index(es):
    • Date
    • Thread