Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
autodelay — spe and slowkeys — time estimation
spe 10000;;
opt slowkeys 1

key "1234567890"

The help document says about "slowkeys":
"The speed depends on macro speed (spe)."

How can I estimate the time it will take for the keys to be pressed (time of all of them and time between each one e.g. between 2 and 3)? I have experimented with different speed values and numbers of characters but I can't figer it out.

note: The values mentioned bellow were recorded without changing the numbers of characters (10). Also, this consist a rough estimation because I was just looking at the computer's clock but (IMHO) for the rough description of the query they should be good enouph.

value — the time it takes to press the 10th key (the duration of the macro is longer than this)
1000 — 4 sec
2000 — 8 sec
3000 — 11 sec
4000 — 15 sec
10000 — 36 sec

a) The delay starts after the first key?

b) How to stop it? The Pause key doesn't do it.

c) What do I have to add at the end of this code so that the rest of the lines I'm going to write will be executed at the default speed (like if I had never used the "spe" command)?

d) If, in a macro, we want to change the speed for the keys many times but keep the time for the other commands unchanged, how should we do it? I don't mean a loop or something; I mean, for example, at some part of the code I want the keys to have a speed of 2x, at another part x, then 10x, and the last group 4x.
OS: Windows XP Home Edition SP2
Memory: 1024 MB (1016 MB system + 8 MB video)
Virtual Memory: 2.00 GB
CPU: 1.60 GHz
To estimate time:
Copy      Help
key "1234567890"
Cannot estimate for each key. Anyway, it depends on conditions, eg how slowly the active window processes keyboard input events.
a) yes.
b) cannot stop with Pause, but can right click in 'Running items' and select 'End thread'.
c, d) spe 100; opt slowkeys 0
Thank you. I was mostly concerned about being able to rouphly estimate what value I would have to use next to spe to make the characters appear in a certain pace, e.g. 200 ms. What is the connection between the value of spe and the number of characters? If I used spe 1000 and 10 characters I would expect it to finish the macro either in 1 or 10 sec (depending on the connection I ignore), but it does it in 5 sec. Maybe if we didn't talk about how slowly the active window processes keyboard input events but the pace QM is going to send the message at, can you give me an idea?

For the moment I don't think I need much accuracy; it's mostly an effect for the user's eyes (not an effect without meaning, though*). But I also need it for scrolling through catalogs and tree structures by representing the typing of the names of the items they contain and I don't know how accurate this has to be.

With the text and keys dialogs we can only add the slowkeys line and not change the value of spe or in any way choose the speed, right?

If I we want more accuracy can this be done be pressing one key per line, e.g.
key "1"

key "2"

key "3"

key "4"


key "0"

and using wait (or some kind of timers) between them or by generally using arrays and loops?

*Sometimes we need the pressing of the keys to be slow enouph for us to understand what is happening but also quick enouph so as to not make the macro too slow.
OS: Windows XP Home Edition SP2
Memory: 1024 MB (1016 MB system + 8 MB video)
Virtual Memory: 2.00 GB
CPU: 1.60 GHz
QM uses quite complex algorithm/equations to calculate key speed. Synchronization, different wait times for different keys, etc. opt slowkeys does not add exactly spe milliseconds after keys.
If you want to precisely control wait times between keys, will need to send each key separately. Can use this function.

Function KeyWithPreciseSpeed
Copy      Help
function ARRAY(KEYEVENT)'a waitMsAfterKeyDown waitMsAfterKeyUp

;Sends keys, waiting waitMsAfterKeyDown milliseconds after each key down event and waitMsAfterKeyUp milliseconds after each key up event.
;Unlike QM key() function, does not use synchronization, does not depend on spe etc.

;KeyWithPreciseSpeed key("1234567890") 20 80

int i
for i 0 a.len
,KEYEVENT k=a[i]
,if(k.flags=0x80) i+1; continue
,r.wVk=k.vk;; r.dwFlags=k.flags
,SendInput 1 &x sizeof(x)
,double wt=iif(k.flags&KEYEVENTF_KEYUP waitMsAfterKeyUp waitMsAfterKeyDown)
,wait wt/1000
Thank you very much!
OS: Windows XP Home Edition SP2
Memory: 1024 MB (1016 MB system + 8 MB video)
Virtual Memory: 2.00 GB
CPU: 1.60 GHz

Forum Jump:

Users browsing this thread: 1 Guest(s)