Sign in to follow this  
Followers 0
Greenseed

Start Function With A variable

8 posts in this topic

#1 ·  Posted (edited)

i wan to read into my ini the function name and then execute the function!

$functioname=IniRead ( "filename", "section", "key", "default" ); $functionname = _test()


$functionname;********this is supossed to start the function**************


func _test($msg="")
         msgbox(0,"test", $msg)
endfunc

i know it not working and i know it not the right manner to do it! but it to be sure you understand what i

mean!

my english is not perfect and i wan to be sure hehe :oB) bye bye guys!

or in another word i can say i wan to start a function from a variable!

Edited by Greenseed

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Share this post


Link to post
Share on other sites



You will probably want to look at Call() or Execute().

Share this post


Link to post
Share on other sites

You will probably want to look at Call() or Execute().

.., but note that you have to strip those parentheses, or it will not work.

Share this post


Link to post
Share on other sites

thx guys you fast! i just make some test or i do i pass variable to the function?

global $msg


$test = "_test"


call($test)


func _test($msg="")
    msgbox(0,"test", $msg)
EndFunc

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Share this post


Link to post
Share on other sites

I'm not sure if I understand, but you can't pass parameters to a function that is called with Call().

Share this post


Link to post
Share on other sites

i know that B) they maybe a way to do it with parsing variable!

the only solution i see for the moment is

to autorecompile the script each time to acomodate the functionName!


GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Share this post


Link to post
Share on other sites

Something like this might work:

Global $Params[10]
For $I = 0 To 9
    $Params[$I] = INIRead('C:\Path\To\INI', 'Section', 'Param' & $I, '')
Next

Local $Func = INIRead('C:\Path\To\INI', 'Section', 'Func', '')
If $Func Then Call($Func)

Func MyFunction()
    Local $Name = $Params[0]
    Local $Phone = $Params[1]
    ···
EndFunc

Share this post


Link to post
Share on other sites

Something like this might work:

Global $Params[10]
For $I = 0 To 9
    $Params[$I] = INIRead('C:\Path\To\INI', 'Section', 'Param' & $I, '')
Next

Local $Func = INIRead('C:\Path\To\INI', 'Section', 'Func', '')
If $Func Then Call($Func)

Func MyFunction()
    Local $Name = $Params[0]
    Local $Phone = $Params[1]
    ···
EndFunc
the idea is to past my func param to the local variable in the function! i understand! nice ide thx! Mr!

bye bye!


GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

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