[v1.1] Passing an object through ahkPostFunction

Ask for help, how to use AHK_H, etc.
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

[v1.1] Passing an object through ahkPostFunction

31 May 2017, 15:18

Hi.

I'm trying to pass an object to a child thread using thread.ahkPostFunction and I can't figure out how or even if it's possible.
The documentation clearly says that only strings can be passed, so is it possible passing a pointer or something?

This is essentially what I'm trying to do:

Code: Select all

thread := AhkThread("#Persistent`nmyfunc(obj){`nmsgbox % mobj.key`n}")
thread.ahkPostFunction["myfunc", {key:"hello"}]
Thanks in advance!

o/
RUNIE
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [v1.1] Passing an object through ahkPostFunction

31 May 2017, 18:21

You can pass the pointer

Code: Select all

thread := AhkThread("#Persistent`nmyfunc(mobj){`nmsgbox % Object(mobj).key`nExitApp`n}")
thread.ahkPostFunction["myfunc", "" &obj:={key:"hello"}]
While thread.ahkReady()
  Sleep 100
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

Re: [v1.1] Passing an object through ahkPostFunction

31 May 2017, 18:34

Aw, I tried this in the project I was working on but must've messed up something else and was perplexed why it wasn't working.
Anyways, thanks for the help, I got it working.

Also thanks for your work on AHK_H, I've found it very useful :)

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 50 guests