"SetKeyDelay, -1" has no effect.
What is the ideas for speed up?
Code: Select all
Critical, On
SetKeyDelay, -1
Send, ^c
ClipWait, 2
Run, ***.exe
Sleep, 100
ControlSend, RICHEDIT50W1, %Clipboard%
Return
Code: Select all
Critical, On
SetKeyDelay, -1
Send, ^c
ClipWait, 2
Run, ***.exe
Sleep, 100
ControlSend, RICHEDIT50W1, %Clipboard%
Return
Code: Select all
Critical, On
SetKeyDelay, -1
Clipboard := ""
Send, ^c
ClipWait, 2
Run, ***.exe,,,pid
WinWaitActive, ahk_pid %pid%
ControlSend, RICHEDIT50W1, ^v, ahk_pid %pid%
Return
Thank you for your valuable advice!amateur+ wrote: Glad to help.
Also pay attention to Clipboard := "", otherwise Clipwait won't work if Clipboard was already non-empty.
Code: Select all
Clipboard := ""
Send, ^c
ClipWait, 2
If you don’t empty the clipboard first, then as @amateur+ pointed out, the ClipWait command won’t wait for the clipboard to be populated with what it is capturing via the ^c if it already contained some text. It would not wait at all, and your code may start working with the previous contents of the clipboard, whatever they were.dostroll wrote: ↑ The clipboard is stored at ^ C.
Do you need to be empty?
Code: Select all
Clipboard := "" Send, ^c ClipWait, 2
Yes, because your Sleep, 100 may not be long enough to wait for the window to appear before your code starts acting on it. That little amount of time is typically not enough for allowing a program to run and its window to be generated. Rather than waiting a longer, arbitrary amount of time, using the pid as was shown will wait long enough and only long enough for the window associated with that pid to appear.
Thank you for advice.boiler wrote: Yes, because your Sleep, 100 may not be long enough to wait for the window to appear before your code starts acting on it. That little amount of time is typically not enough for allowing a program to run and its window to be generated. Rather than waiting a longer, arbitrary amount of time, using the pid as was shown will wait long enough and only long enough for the window associated with that pid to appear.
Code: Select all
Process_High(Process_p1){
Loop,parse,Process_p1,/
{
Process,Exist,%A_LoopField%
if ( NewPID:=ErrorLevel )
Process,Priority,%NewPID%,High
}
Return
}