SvenP Posted January 19, 2005 Posted January 19, 2005 This little function return the Factorial of the number called. Since AutoIt automatically can't calculate this operation. It won't understand a line that keeps Factorial() inside... Can it? I am missing something?You are right. SlimShady's _Execute() function runs OUTSIDE the context of the current script. So it doesn't know about UDF's or local variables defined.The only way to solve that problem is by running the Execute() function INSIDE the context of your script. But that can't be realized with the current built-in AutoIT functions, the AutoIT.exe needs to be modified for that one.See also: http://www.autoitscript.com/forum/index.php?showtopic=7268Regards,-Sven
SlimShady Posted January 19, 2005 Author Posted January 19, 2005 It depends. If you don't put the self-made formula in a string, it will work. I'll try to explain this. When you call _Execute and nothing from the value is a string, it will be solved in the current script. If it contains strings, it will solve it in the new AutoIt instance. So if you send AnyOper() as a string with _Execute, it won't work. Unless you do _Execute(AnyOper(50 * 3) & ' / 60') ;Something like that Here's an example I just tested: $val = _Calc("30 * 2 / (8 - 4) / 2") MsgBox(64, "Example 3", "$val: " & $val) $val = _Calc(TimesTwo(30) & " / (8 - 4) / 2") MsgBox(64, "Example 6", "$val: " & $val) Func TimesTwo($tNum) Return $tNum * 2 EndFunc I added credentials for the _Execute function. Now you can write to the registry without any trouble.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now