Sign in to follow this  
Followers 0
MCP

Is there a pointer to a function?

5 posts in this topic

I am writing a sort of scheduler and I would like as soon as the time has come to run a job (= function).

Currently I am running it from inside a loop, but I would like to set a pointer to the function in order to develop a more general solution that I would be able to port to different projects, so that I could simply call or reference a value in an array.

I would not like to run an eval statement.

Has anyone already faced the problem?

Thank in advance

Share this post


Link to post
Share on other sites



I am writing a sort of scheduler and I would like as soon as the time has come to run a job (= function).

Currently I am running it from inside a loop, but I would like to set a pointer to the function in order to develop a more general solution that I would be able to port to different projects, so that I could simply call or reference a value in an array.

I would not like to run an eval statement.

Has anyone already faced the problem?

Thank in advance

Pointers are only used in AutoIt, AFAIK, with dllstructs; you can't get pointers to variables or functions I don't think. If you find out I'm wrong I would like to know.

To call a function like you want can be done another way though. Suppose you have functions that you want to call which are Func1,Func2 etc. Then have something like

$funcList = stringsplit("func1|func2|....funcN")

So when you want to call a function by index you can say

Call($funcList[n])


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.

Share this post


Link to post
Share on other sites

Pointers are only used in AutoIt, AFAIK, with dllstructs; you can't get pointers to variables or functions I don't think. If you find out I'm wrong I would like to know.

To call a function like you want can be done another way though. Suppose you have functions that you want to call which are Func1,Func2 etc. Then have something like

$funcList = stringsplit("func1|func2|....funcN")

So when you want to call a function by index you can say

Call($funcList[n])

Thank you, martin. $funcList is a nice idea. So if I were able to have a dllstruct pointing to a function the problem were solved. Gotta investigate in this direction...

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

@All

Maybe AdlibEnable is a good start :

AdlibEnable("myadlib", 1000) ; check every second
;...
Exit

Func myadlib()
    If WinActive("Error") Then
        ;...
    EndIf
EndFunc

regards

ptrex

How does that help MCP do what he wants?

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0