Syntax is as simple as any other key.
Parameters:
STRING = Any string-style Send you wish to preform.
RAW = Parameter to determine if modified keys are sent as modified, or as plain text. e.g. ^v,^c,^{Enter}
RAWKEYS = Parameter to determine if braced keys are sent as keys, or as plain text. e.g. {Enter},+#{Tab}
Supports Milliseconds by default, but with a single character after the number, supports seconds.
e.g.:
{500} = 500ms
{20000} = 20s
{20s} = 20s
{2.5a} = 2.5s (2500ms)
NOTE: Any (ms) sleep below standard Windows minimum of 15 or 17.8 will sleep for the standard time. See: Sleep
Code: Select all
Send(String, Raw:="", RawKeys:=""){
D:="{",E="}",S:=String D,i=0,T=1,R=(Raw?1:(SubStr(S,1,5)="{RAW}"?1:0)),M="+,!,#,^",K=RawKeys
While i:=InStr(S,D,V,i+1){
Send,% (R?"{RAW}":"") SubStr(S,T,InStr(S,D,V,i)-T)
B:=SubStr(S,InStr(S,D,V,i)+1,InStr(S,E,V,i)-StrLen(S)-1),A=SubStr(B,1,-1)
If InStr(S,D,V,i+1)
If(B&1=""){
If(A&1!="")
Sleep,% A*1000
else{
L:=(!R?(InStr(S,E,V,i)-StrLen(B)-2>4?4:InStr(S,E,V,i)-StrLen(B)-2):0)
Loop,%L%{
C:=SubStr(SubStr(S,InStr(S,D,V,i)-L,L),A_Index,1)
If C in %M%
{ C:=SubStr(S,InStr(S,D,V,i)-(L+1-A_Index),L+1-A_Index)
break
}else C:=""
}Send,% (K?"{RAW}":"") C "{" B "}"
}}else Sleep,%B%
T:=InStr(S,E,V,i+1)+1
}}
This will output as:
Really, any sleep !fcould
go+ here and it should work.
I thought it was time for a real working function. Still looking for bugs and will keep up to date.
--AfterLemon