AutoHotkey Community

It is currently May 26th, 2012, 6:42 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 55 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: November 22nd, 2007, 4:45 pm 
Offline

Joined: July 12th, 2005, 1:21 pm
Posts: 633
So.. I hope the next release will take some time.
I had some work to merge the changed parts into the existing german translation :lol:

Just joking.
Thanks for this new version!

Thalon

_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2007, 1:39 am 
Offline

Joined: December 11th, 2006, 6:39 am
Posts: 4
big release Chris, congratulations!
thx :D


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2008, 4:19 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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 March 10th, 2008, 1:22 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2008, 4:23 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Thanks for the update.. and nice to see you back in action Mr.Chris
Dynamic function Calling! Ooh.. Thanks lexiKos :D


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2008, 6:04 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 968
Location: Frisia
Excellent! Especially the dynamic function calling 8)

And, also from me: good to see you are still around, Chris. I hope you can keep up the good work somehow. :)

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2008, 7:06 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1933
Location: Germany
Oh great thx, long waited internal support of dynamic function call. Go(o)d to see you back, Chris.

lexikos, your`re great!!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2008, 7:19 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
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%


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2008, 1:21 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2008, 3:43 pm 
Thanks for the update Chris and lexiKos!
and Chris, we all missed you.
I'm glad to see you back.


Top
  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2008, 6:13 pm 
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 :D :D :D


Top
  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2008, 8:49 am 
Hi,
And thanks a lot for the dynamic function calls. Even that I stoped coding, I still have an eye on AHK.
Greetings.


Top
  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2008, 2:25 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Thanks lexikos. Finaly offical recognition for your valuable work.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2008, 3:20 pm 
Offline

Joined: October 6th, 2007, 2:28 am
Posts: 49
Location: Philadelphia
With dynamic function calling, the possibilities are mind boggling. :shock: :shock: :shock:


Top
 Profile  
Reply with quote  
PostPosted: March 13th, 2008, 5:20 pm 
Offline

Joined: November 1st, 2006, 8:33 pm
Posts: 21
Location: Chicago, IL
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2008, 12:48 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 55 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group