 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Jerry
Joined: 24 Jun 2004 Posts: 39
|
Posted: Sat Jun 26, 2004 5:31 am Post subject: Couple of ideas for the wish list |
|
|
Here are a couple of ideas for the planned Features list
Get a list of controls for a window.
Get the co-ordinates of a control (x, y, height, width)
A new hotkey called 'anyHotKey'. Like the 'keywait' in the Planned features list but launches a new "thread". |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10465
|
Posted: Sat Jun 26, 2004 1:21 pm Post subject: |
|
|
| Quote: | | Get a list of controls for a window. |
That's high on the list. I wonder if it's better to return just the control class names rather than all the individual names. For example, should it just return a single word Button, or should it return Button1, Button2, etc. to list every possible control. I think the AutoIt3 method is the former.
| Quote: | | Get the co-ordinates of a control (x, y, height, width) |
Good idea, thanks.
| Quote: | | A new hotkey called 'anyHotKey'. Like the 'keywait' in the Planned features list but launches a new "thread". |
So you're saying that such a hotkey, if defined, would cause every hotkey to call that subroutine first (or maybe optionally: last) and then run that hotkey's normal subroutine? It would help me if you gave an example of what this could be used for. Note that you could use SetTimer to monitor A_TimeIdle or A_TimeIdlePhysical if you're trying to find out if the user is present. |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Sat Jun 26, 2004 3:15 pm Post subject: |
|
|
| Quote: | | should it just return a single word Button, or should it return Button1, Button2, etc. to list every possible control. I think the AutoIt3 method is the former |
IMHO Button1, Button2 should be THE way. as i guess only then it'd be feasible to recognise controls & differentiate between them. _________________
 |
|
| Back to top |
|
 |
Jerry
Joined: 24 Jun 2004 Posts: 39
|
Posted: Mon Jun 28, 2004 2:29 am Post subject: |
|
|
| Quote: | | should it just return a single word Button, or should it return Button1, Button2, etc. to list every possible control. |
I believe that the best would be Button1, Button2. etc. At least it would be consistent with the spy program and the mouseGetPos command.
| Quote: | | So you're saying that such a hotkey, if defined, would cause every hotkey to call that subroutine first (or maybe optionally: last) and then run that hotkey's normal subroutine? |
Yes. I was thinking that. "optionally" is the key word as some creative person might come up with a suggestion to run it first and another one would want it last.
The examples I am thinking of are
1) To be able to write our own "recorder" script.
2) I have this window which times out (locks itself up) if I do not enter one of a bunch of keys after a period of time. I could write a script that would need about 20 hotkeys and monitor the last time any of them were pressed. It would be cleaner to have just the one "anyHotKey" routine. Also it would make turning the hotkey off and on easier as I have to disable the keys when the window is not active since I would not want to update the time variable when the window is not active. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10465
|
Posted: Mon Jun 28, 2004 11:46 am Post subject: |
|
|
| Quote: | The examples I am thinking of are
1) To be able to write our own "recorder" script. |
To do that, you'd have to register nearly every key as a hotkey, which isn't really pratical. It seems it would be much easier to just use GetKeyState in a loop, which might allow the design of a script that records and plays back certain sequences of keystrokes.
| Quote: | | 2) I have this window which times out (locks itself up) if I do not enter one of a bunch of keys after a period of time. I could write a script that would need about 20 hotkeys and monitor the last time any of them were pressed. |
For your description, it's better and easier to have a timer which monitors the above. Have the timer monitor GetKeyState or %A_ThisHotkey% to keep track of how long it's been since you last pressed a qualififed key. The timer could even turn itself off or reduce its own running frequency when the window doesn't exist, as you said. Example:
| Code: | QualifiedHotkeys = #a,^c,!b,^!g ; Note no spaces between commas
TimeOfQualfiedKey = %A_TickCount%
SetTimer, WatchKeys, 50
return
WatchKeys:
Loop, parse, WatchKeys, `,
{
if A_LoopField = %A_ThisHotkey%
{
TimeOfQualfiedKey = %A_TickCount%
TimeOfQualfiedKey -= %A_TimeSinceThisHotkey%
break
}
}
TimeSinceQualfiedKey = %A_TickCount%
TimeSinceQualfiedKey -= %TimeOfQualfiedKey%
if TimeSinceQualfiedKey > 30000
{
MsgBox It's been more than 30 seconds since the last qualified key.
}
return |
I'm not ruling out this idea, I'm just thinking that there are already better ways to achieve the above without adding this new feature. If anyone comes up with an compelling example of what to use the feature for, I'd be much more inclined to put it on the list. |
|
| Back to top |
|
 |
Jerry
Joined: 24 Jun 2004 Posts: 39
|
Posted: Wed Jun 30, 2004 5:25 am Post subject: |
|
|
Thanks for the code. I think I can work with this. It is simpler than the one I was think of. And thanks Chris, for the quick turn around on the ControlGetPos command!
Jerry |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|