This is an example of a dynamic function.
You can use any AutoIT, Math, Date&Time, String, Variables, Macros, etc, or any combination of it.
Making it possible to change functions interactively with changing the hardcoded data.
And pass that result on to another function if needed.
; ; PTREX dd 06/11/05 ; Dynamics Functions ; You can use any AutoIT, Math, Date&Time, String, Variables, Macros, etc, or any combination of it. ; Making it possible to change functions interactively with changing the hardcoded data. ; #include <GUIConstants.au3> #include <Date.au3> #include <String.au3> #include <Math.au3> #NoTrayIcon Dim $Var = 52; Just a number to demonstrate that Vars are precessed correctly. ;Generated with Form Designer preview $Form1 = GUICreate("Dynamic functions", 622, 441, 192, 113) $Edit1 = GUICtrlCreateEdit("", 48, 40, 553, 217, -1, $WS_EX_CLIENTEDGE) GUICtrlSetData($Edit1, "@ComputerName &chr(32) &stringRight(@OSVersion,2) &chr(32) &_Now() &chr(32)& $Var &chr(32) & sqrt(2) &chr(32) &_Calc()/2") $Label1 = GUICtrlCreateLabel("", 48, 288, 430, 25, $SS_SUNKEN) $Button1 = GUICtrlCreateButton("Execute", 500, 288, 89, 25) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 _Dynamic_Functions() _Calc() EndSelect WEnd Exit Func _Dynamic_Functions() $a=GUICtrlRead($Edit1) $v=Execute($a) If @error=1 Then Msgbox(0,"Error","There is a syntax Error, Please correct.") Else GUICtrlSetData($Label1,$v) EndIf EndFunc Func _Calc() $var=$var+1 EndFunc
Thanks to Valik to put me on the right track.
Edited by ptrex, 14 September 2012 - 09:19 AM.




