AutoHotkey Community

It is currently May 27th, 2012, 8:39 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: April 10th, 2006, 1:24 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Nice. Thanks :)

Chris wrote:
Added "WinGet ControlListHwnd", which retrieves a list of control HWNDs; 3) Added "ControlGet Hwnd", which retrieves the HWND that corresponds to a control's ClassNN.
Out of curiosity, do these use FindWindowEx internally?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2006, 6:48 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Aaah, very nice one, with long waited features!
At least we can get rid of this GetChildHWND we pasted in so many scripts!
I will download it right now!

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2006, 2:31 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
corrupt wrote:
Out of curiosity, do these use FindWindowEx internally?
"WinGet ControlListHwnd" uses EnumChildWindows() to write each child's HWND to the list.

"ControlGet Hwnd" calls the standard ControlExist(ParentWindow, ClassNameAndNum), which is used by almost all of the ClassNN-accepting commands. It calls EnumChildWindows() to locate the specified instance number (NN of the ClassNN) or the specified text (such as the string "OK" on an OK button).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2006, 7:14 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Here are the changes for v1.0.43.07:

Fixed inability of "Menu, Tray, Icon" to load icon #1 from file types cpl/scr/drv/ocx/vbx/acm/bpl (broken by 1.0.43.03). Similarly, all icon-capable features have been improved to support these file types. [thanks Winkie & PhiLho]

Fixed the following legacy commands to accept function-calls containing commas: EnvAdd/Sub, LeftClick(Drag), RightClick(Drag). [thanks Titan]


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 17th, 2006, 9:25 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Here are the changes for v1.0.43.08:

Changed SendInput to use "SetKeyDelay -1, 0" when it reverts to SendEvent mode (unless SendEvent's KeyDelay "-1,-1", in which case "-1,-1" is used).

Added directive #NoEnv, which is recommended for all new scripts because:

1) It significantly improves performance whenever empty variables are used in an expression or command. It also improves DllCall's performance when unquoted parameter types are used (e.g. int vs. "int").

2) It prevents script bugs caused by environment variables whose names unexpectedly match variables used by the script.

3) A future version of AutoHotkey such as 1.1 might force this behavior into effect for all scripts (though such a change is not expected for at least a year).

Added built-in variables ComSpec and ProgramFiles to ease the transition to #NoEnv.

Added command EnvGet, which retrieves an environment variable.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 18th, 2006, 12:54 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
With #NoEnv the speed relations are changed between the dll calls with quoted parameter types, and unquoted ones.
Code:
#NoEnv

T0 = %A_TickCount%
Loop 1000000
   DllCall("SystemParametersInfo",  UInt ,0x68,  UInt ,0,  UIntP ,X,  UInt ,0)
  ;DllCall("SystemParametersInfo", "UInt",0x68, "UInt",0, "UIntP",X, "UInt",0)
MsgBox % A_TickCount - T0

Quoted -> 44344, 37653, 44015 42813, 43781 ("UInt*" works, too)
Unquoted -> 41735, 32656, 41844, 40375, 34171 (UInt* is not OK, use UIntP)

It looks like, referencing a special variable (UInt) is faster, than parsing a literal string. Taking the idea one step further, the fastest version is
Code:
#NoEnv

func = SystemParametersInfo
T0 = %A_TickCount%
Loop 1000000
   DllCall(func, UInt,0x68, UInt,0, UIntP,X, UInt,0)
MsgBox % A_TickCount - T0

Func -> 38031, 39328, 33469, 30812, 33594

It is interesting how much the execution time fluctuates. The loop runs a million times, still there is more than 20% variation in the measured time.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 18th, 2006, 2:49 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Interesting results; thanks for posting them. I tested a variant of the above but didn't get such a big deviation. Here are the changes I made:
- Half as many iterations.
- SetBatchLines -1
- Only three trials

My results for the script below (trial1/trial2/trial3):
4115/4106/4096 quoted param types
4166/4126/4156 unquoted param types (slightly slower than above for some reason)
3866/3856/3855 unquoted param types & function name (~8% faster for some reason)

With #NoEnv omitted, the last two rows above took over 4 times as long.
Code:
#NoEnv
SetBatchLines -1

T0 = %A_TickCount%
Loop 500000
   DllCall("SystemParametersInfo", "UInt",0x68, "UInt",0, "UIntP",X, "UInt",0)
Elapsed1 := A_TickCount - t0

T0 = %A_TickCount%
Loop 500000
   DllCall("SystemParametersInfo",  UInt ,0x68,  UInt ,0,  UIntP ,X,  UInt ,0)
Elapsed2 := A_TickCount - t0

func = SystemParametersInfo
T0 = %A_TickCount%
Loop 500000
   DllCall(func, UInt,0x68, UInt,0, UIntP,X, UInt,0)
Elapsed3 := A_TickCount - t0

MsgBox %Elapsed1%`n%Elapsed2%`n%Elapsed3%


Top
 Profile  
Reply with quote  
 Post subject: #NoEnv is good idea
PostPosted: April 18th, 2006, 5:48 pm 
Offline

Joined: December 20th, 2005, 4:15 am
Posts: 165
Location: Malaysia
Great idea, #NoEnv.

This will help prevent mysterious results for users who like to use variable names like TEMP, TMP, USERNAME, and PATH.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2006, 5:01 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Here are the changes for v1.0.43.09:

Fixed SendInput not to revert to SendEvent merely because another script has a mouse hook. Only another keyboard hook should do that. [thanks baby-luck]

Fixed LV_GetCount() to work even if the "C" in its name is lowercase.

Changed FileSelectFile to follow/navigate shortcuts (.lnk files) rather than selecting them. There is also a new option to override this. [thanks Veovis & PhiLho]

Added "Gui +LastFoundExist" to detect the existence of a GUI window. [thanks Tekl & Evl]

Added built-in variables A_AppData, A_AppDataCommon, and A_Temp (A_Temp is the path to the folder designated to hold temporary files).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 28th, 2006, 4:03 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Here are the changes for v1.0.43.10:

Improved PixelGetColor with two alternate modes that work in a broader variety of windows and full-screen apps. [thanks TDMedia]

Improved StringMid to allow "Count" to be omitted to retrieve all characters. [thanks kapege.de]

Improved FileSelectFile to support special folders such as My Computer via CLSID strings (FileSelectFolder and Run already support them).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2006, 3:30 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Here are the changes for v1.0.43.11:

Fixed %A_WorkingDir% on Windows 9x, which was sometimes blank. [thanks Points]

Improved BlockInput with a new mode that blocks only physical movement of the mouse, not keystrokes or mouse clicks.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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