why some scripts spam do not work unless with sleep(50) in some app?
Posted: 05 Dec 2023, 02:30
Hi ,Can someone tell me why I need to use sleep(50) for same app to make sure my script will work flawlessly?
like this following script do NOT work with "vs code" but it works fine with "notepad++" (in spammy way)
it won't work on VS.code unless I add sleep(50)
why this happened?
like this following script do NOT work with "vs code" but it works fine with "notepad++" (in spammy way)
Code: Select all
horizontalFunc(code, clipMethod := "^v" , codeEnd:="", EnterMethod := " {Enter}" ,AllowAutoPaste := true){
local textOutput := (code . codeEnd)
A_Clipboard := textOutput
if AllowAutoPaste := true {
send(clipMethod)
Send(EnterMethod)
}
}
it won't work on VS.code unless I add sleep(50)
Code: Select all
horizontalFunc(code, clipMethod := "^v" , codeEnd:="", EnterMethod := " {Enter}" ,AllowAutoPaste := true){
local textOutput := (code . codeEnd)
A_Clipboard := textOutput
if AllowAutoPaste := true {
send(clipMethod)
sleep(50) ;=====================here new line
Send(EnterMethod)
}
}
why this happened?