#76300 - 2003-08-08 09:40 AM
Re: Execute() variable functions
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Patick,
Think you would need something like:
code:
[functions] AddNum=1 SubNum=1
and this:
code:
$rc=SetOption('NoVarsInStrings','ON') $Sections=Split(ReadProfileString("c:\t.ini",'functions',''),Chr(10)) For Each $Section In $Sections If $Section $rc=Execute('$$rc=' + $section + '()') EndIf Next Function AddNum() ?"In AddNum" EndFunction Function SubNum() ?"In SubNum" EndFunction
|
|
Top
|
|
|
|
#76302 - 2003-08-08 09:45 AM
Re: Execute() variable functions
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
I do this in an IE based GUI application to call events in the scripts.
Each of the functions in my script registers itself, then IE fires an event which is the function - if the function is registered it is called using execute.
So, it is possible and does work. I suspect that the combination of NoVarsInStrings an doubling up the "$" is the problem.
Try this:
code:
$rc=SetOption('NoVarsInStrings','ON')
$Sections=Split(ReadProfileString($KiXLogonIni,'',''),Chr(10)) For Each $Section In $Sections If $Section $Discard=Execute('$rc=' + $section + '() ; Exit @ERROR') EndIf Next
Including the "; Exit @ERROR" preserves any @ERROR value returned by your function so that it can be tested in your main script.
I've discarded the return value from the Execute(), as I assume you are more interested in the return value of the function.
|
|
Top
|
|
|
|
#76306 - 2003-08-08 09:49 AM
Re: Execute() variable functions
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Well, yes and no, you know the score with my msm here, its up and down like a toilet seat
|
|
Top
|
|
|
|
#76309 - 2003-08-13 08:10 AM
Re: Execute() variable functions
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Shawn -- You need to copyright the toilet seat thing..
Kent [ 13. August 2003, 08:11: Message edited by: kdyer ]
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 633 anonymous users online.
|
|
|