| View previous topic :: View next topic |
| Author |
Message |
Thalon
Joined: 12 Jul 2005 Posts: 640
|
Posted: Thu Nov 22, 2007 4:45 pm Post subject: |
|
|
So.. I hope the next release will take some time.
I had some work to merge the changed parts into the existing german translation
Just joking.
Thanks for this new version!
Thalon _________________ AHK-Icon-Changer
AHK-IRC
deutsches Forum
SacredVault |
|
| Back to top |
|
 |
ryebread
Joined: 11 Dec 2006 Posts: 4
|
Posted: Sun Dec 23, 2007 1:39 am Post subject: |
|
|
big release Chris, congratulations!
thx  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Sun Mar 09, 2008 4:19 pm Post subject: |
|
|
Here are the changes for v1.0.47.06:
Fixed crash when a function was called concurrently with an optional ByRef parameter omitted by one thread but not omitted by the other. [thanks DeathByNukes]
Fixed "Menu, Tray, MainWindow" to enable the menu items in the main window's View menu. [thanks lexiKos]
Added dynamic function calling. [developed by lexiKos]
Description: A function (even a built-in function) may be called dynamically via percent signs. For example, %Var%(x, "fox") would call the function whose name is contained in Var. Similarly, Func%A_Index%() would call Func1() or Func2(), etc., depending on the current value of A_Index. The called function's definition must exist explicitly in the script, either via #Include or a non-dynamic call to a library containing the function. If the function does not exist -- or if the wrong number or type of parameters is passed to it -- the expression containing the call produces an empty string.
Last edited by Chris on Mon Mar 10, 2008 1:22 pm; edited 1 time in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5298
|
Posted: Sun Mar 09, 2008 4:23 pm Post subject: |
|
|
Thanks for the update.. and nice to see you back in action Mr.Chris
Dynamic function Calling! Ooh.. Thanks lexiKos  |
|
| Back to top |
|
 |
daonlyfreez
Joined: 16 Mar 2005 Posts: 738 Location: Berlin
|
Posted: Sun Mar 09, 2008 6:04 pm Post subject: |
|
|
Excellent! Especially the dynamic function calling
And, also from me: good to see you are still around, Chris. I hope you can keep up the good work somehow.  _________________
Get your own Ron Paul 2008 userbar! |
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 379 Location: Berlin
|
Posted: Sun Mar 09, 2008 7:06 pm Post subject: |
|
|
Oh great thx, long waited internal support of dynamic function call. Go(o)d to see you back, Chris.
lexikos, your`re great!! |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2359 Location: Australia, Qld
|
Posted: Mon Mar 10, 2008 7:19 am Post subject: |
|
|
| Quote: | | lexikos, your`re great!! | ...but not infallible. Expect a bug-fix release some time in the future. I've "submitted" the fix already, but until AutoHotkey is updated, avoid doing things like this:
| Code: | f = ; empty...
%f%() ; crashes.
VarSetCapacity(f, 255, Asc("f")) ; too long...
%f%() ; crashes. |
| Chris wrote: | | Similarly, Func%A_Index%() would call the function whose name is stored in the specified array element. | I think this is misleading: "Func" actually forms part of the name. Func%A_Index%() calls Func1(), Func2(), etc. and does not touch the variables (array elements) named Func1, Func2, FuncN...
I'm not sure it is worth mentioning in the help file, but failure can be detected by taking advantage of the difference between standalone assignment and multi-statement expressions:
| Code: | f = InvalidFunc
; Standalone assignment: if the dynamic call fails,
; the expression results in a blank value, which is assigned.
result := "FAIL" ; This is overwritten.
result := %f%()
MsgBox %result%
; Multi-statement expression: if the dynamic call fails,
; the second assignment never even occurs.
result := "FAIL", result := %f%()
MsgBox %result% |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Mon Mar 10, 2008 1:21 pm Post subject: |
|
|
| lexiKos wrote: | | Chris wrote: | | Similarly, Func%A_Index%() would call the function whose name is stored in the specified array element. | I think this is misleading: "Func" actually forms part of the name. Func%A_Index%() calls Func1(), Func2(), etc. and does not touch the variables (array elements) named Func1, Func2, FuncN... | Thanks. I've fixed the documentation. |
|
| Back to top |
|
 |
Rajat as guest Guest
|
Posted: Mon Mar 10, 2008 3:43 pm Post subject: |
|
|
Thanks for the update Chris and lexiKos!
and Chris, we all missed you.
I'm glad to see you back. |
|
| Back to top |
|
 |
Zoulou Guest
|
Posted: Tue Mar 11, 2008 6:13 pm Post subject: |
|
|
Exactly the same as Rajat.
Just a little noob question : please Chris, do you continue to work on V2 of AHK, and, if it is the case, do you think that we will see it in few/a lot of months ?
Thanks again  |
|
| Back to top |
|
 |
toralf not loged in Guest
|
Posted: Wed Mar 12, 2008 8:49 am Post subject: |
|
|
Hi,
And thanks a lot for the dynamic function calls. Even that I stoped coding, I still have an eye on AHK.
Greetings. |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3544 Location: Belgrade
|
Posted: Thu Mar 13, 2008 2:25 pm Post subject: |
|
|
Thanks lexikos. Finaly offical recognition for your valuable work. _________________
 |
|
| Back to top |
|
 |
williamsharkey
Joined: 06 Oct 2007 Posts: 52 Location: Philadelphia
|
Posted: Thu Mar 13, 2008 3:20 pm Post subject: |
|
|
With dynamic function calling, the possibilities are mind boggling.  |
|
| Back to top |
|
 |
TL
Joined: 01 Nov 2006 Posts: 9
|
Posted: Thu Mar 13, 2008 5:20 pm Post subject: Validating function's name without invoking it? |
|
|
I'm evaluating whether to switch to the new dynamic function method on my existing project. Some questions:
If I want to validate that a string contains a valid function name without executing the function at that time (for example, a function is registered in some way at program startup), is it best to still use the RegisterCallback function to see if an error occurs or is there a way that is quicker or doesn't depend on the number or type of parameters?
Also, if I use the Register Callback to validate the function's name should I then just use the old style DllCall method to invoke the function or is there an performance gain by using the new dynamic function method?
TL |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2359 Location: Australia, Qld
|
Posted: Fri Mar 14, 2008 12:48 am Post subject: |
|
|
You could use RegisterCallback to validate the function, then free the callback and use dynamic function calls. RegisterCallback fails for built-in functions or user-defined functions with ByRef parameters, while dynamic function calls support both.
Dynamic function calls require the function to be looked up every call. AutoHotkey searches the function list sequentially, so speed may vary depending on the order of functions: Explicitly included user-defined functions are first, followed by library and built-in functions (depending roughly on the order such functions are referenced in script.)
My benchmarks show dynamic function calls are roughly five times faster than DllCall when used with the first function in the script. I recommend benchmarking some scenarios typical to your script before deciding.
If your script would benefit from being able to pass strings to the callback rather than numbers or return values ByRef, dynamic function calls are the way to go.
| Quote: | | or is there a way that is quicker or doesn't depend on the number or type of parameters? | I am nearly finished a function library for facilitating run-time code generation. It would typically be slower to generate the code to call a function, but once generated it would perform the same as a regular function call. LowLevel could potentially be used to validate the number and type of parameters. |
|
| Back to top |
|
 |
|