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

Re: How to simulate C's function pointer in AppleScript?


  • Subject: Re: How to simulate C's function pointer in AppleScript?
  • From: André Berg <email@hidden>
  • Date: Thu, 23 Oct 2008 21:49:00 +0200

Wow, that's hackish! I had to bent my head around it for a few minutes. :)
Thank you for sharing it with us.

Also thanks for your OSAcomponents and the explanation of the "in" parameter.

André


--- Original Nachricht ---
Absender: Philip Aker
Datum: 23.10.2008 18:36 Uhr
On Oct 23, 2008, at 5:50 AM, André Berg wrote:

But as we all know, it's never easy, now is it?
My handler of course has three parameters.

on XHandler given message:theMessage
run script theMessage
end XHandler

script Timer
property text_param : missing value
on proc(theMessage)
if (text_param is not missing value) then
XHandler of me given message:text_param
set text_param to missing value
else
XHandler of me given message:theMessage
end if
end proc
end script
--set Timer's text_param to "beep\ndisplay dialog \"beep\" buttons {\"OK\"} default button \"OK\" with icon stop"
Timer's proc("beep\ndisplay dialog \"beep\" buttons {\"OK\"} default button \"OK\" with icon stop")

Calling handlers with multiple parameters in a form similar to the above should be documented in the ASLG. 
Also the "on run" handler can take a parameter list.


Btw, might be related to this question, the "run script" command has an optional parameter called "in" that is used to specify the scripting component that it should use as execution context, but in my tests I couldn't get it to work. The unicode text to specify is the name of a script object, right?

No. It's the name of the language. It's noted here at the end of the "Terminal:" section <http://www.vcn.bc.ca/~philip/osa/index.html>.


Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.


_______________________________________________ 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
 _______________________________________________
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

References: 
 >How to simulate C's function pointer in AppleScript? (From: André Berg <email@hidden>)
 >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: André Berg <email@hidden>)
 >Re: How to simulate C's function pointer in AppleScript? (From: Philip Aker <email@hidden>)

  • Prev by Date: choose file of type {}
  • Next by Date: Re: Close Unselected Tabs in Safari...
  • Previous by thread: Re: How to simulate C's function pointer in AppleScript?
  • Next by thread: Re: How to simulate C's function pointer in AppleScript?
  • Index(es):
    • Date
    • Thread