Jump to content

expose functions


JRSmile
 Share

Recommended Posts

Hi there i created a little function that is able to start functions out of other autoitscripts (plugin system).

the sender looks like this:

CODE
#include <ExposeFuncs.au3>

ConsoleWrite(_RemoteCall(@ScriptDir & "\dummy.exe", 'F1,Hallo Welt') & @CRLF)

ConsoleWrite(_RemoteCall(@ScriptDir & "\dummy.exe", 'F1,Hallo Welt') & @CRLF)

_RemoteCall(@ScriptDir & "\dummy.exe", 'unload')

the plugin executable like this:

CODE
#NoTrayIcon

#include <ExposeFuncs.au3>

__ExposeFuncs()

While 1

Sleep(10)

WEnd

Func F1($a)

Return StringUpper($a)

EndFunc ;==>F1

Func unload()

Exit

EndFunc

and the udf is here:

http://dl.getdropbox.com/u/957526/ExposeFu...ExposeFuncs.au3

have fun,

Jan

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

and nice for debugging, you can execute functions of a script already running :) to see what they deliver :party: ( as long as you have compiled it with __exposeFuncs())

Edited by JRSmile
$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

Wow, this might actually be what I was looking for... In reference to my DJ Max Portable 2 bot having issues with certain tracks not being able to get the note hits in time, maybe now I can write out seperate components to do the work that I would normally have to try to accomplish inside the one script. This can also be called 'fork'ing a process.

Edited by Cynagen

Blah, blah, blah... lip service... lip service.Working on a number of projects right now, just waiting for my time to post them here on AutoIt forums.

Link to comment
Share on other sites

Hi there i created a little function that is able to start functions out of other autoitscripts (plugin system).

the sender looks like this:

CODE
#include <ExposeFuncs.au3>

ConsoleWrite(_RemoteCall(@ScriptDir & "\dummy.exe", 'F1,Hallo Welt') & @CRLF)

ConsoleWrite(_RemoteCall(@ScriptDir & "\dummy.exe", 'F1,Hallo Welt') & @CRLF)

_RemoteCall(@ScriptDir & "\dummy.exe", 'unload')

the plugin executable like this:

CODE
#NoTrayIcon

#include <ExposeFuncs.au3>

__ExposeFuncs()

While 1

Sleep(10)

WEnd

Func F1($a)

Return StringUpper($a)

EndFunc ;==>F1

Func unload()

Exit

EndFunc

and the udf is here:

http://dl.getdropbox.com/u/957526/ExposeFu...ExposeFuncs.au3

have fun,

Jan

It looks good JRSmile.

Do you really mean to create a new window every time you call _RemoteCall?

GUICreate("#setter")

maybe you could have a _ExposeStartUp function which creates the window and registers the message.

It might also be worth adding a note in your udf that the remote function can only return numbers and strings and not arrays for example. (in fact, notes in general would be nice :) )

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Wow, this might actually be what I was looking for... In reference to my DJ Max Portable 2 bot having issues with certain tracks not being able to get the note hits in time, maybe now I can write out seperate components to do the work that I would normally have to try to accomplish inside the one script. This can also be called 'fork'ing a process.

sorry but the calling function will wait unti the remote function finishes, so no forking (a.k.a multithreading) at all.

@martin:

yea indeet, just to lazy to write a lot of bla around my code, and every advanced coder can have a two second look at it and see what it does and does not :-)

in addition i handleled the guicreate thingie with a gui destroy and added a while loop for long time function turns.

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

sorry but the calling function will wait unti the remote function finishes, so no forking (a.k.a multithreading) at all.

@martin:

yea indeet, just to lazy to write a lot of bla around my code, and every advanced coder can have a two second look at it and see what it does and does not :-)

in addition i handleled the guicreate thingie with a gui destroy and added a while loop for long time function turns.

Ever thought of writing this with a callback for the calling function? So when you DO get return it can continue with that, then it'd be close to being true multithreading.

Blah, blah, blah... lip service... lip service.Working on a number of projects right now, just waiting for my time to post them here on AutoIt forums.

Link to comment
Share on other sites

Ever thought of writing this with a callback for the calling function? So when you DO get return it can continue with that, then it'd be close to being true multithreading.

sorry i don't understand, isn't call returning the result of the function?

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...