Supports Milliseconds by default, but with a single character after the number, supports seconds.
Syntax is as simple as any other key.
e.g.:
{500} = 500ms
{20000} = 20s
{20s} = 20s
{2.5a} = 2.5s (2500ms)
{-20} = ClipWait max of 20 seconds.
NOTE: Any (ms) sleep below standard Windows minimum of 15 or 17.8 will sleep for the standard time. See: Sleep
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 D B E }}else If(W:=SubStr(B,2)) ClipWait,%W% else Sleep,%B% T:=InStr(S,E,V,i+1)+1 }}
An Example:
Send("Really,{2000} any sleep !fcould{3000}{Enter} go+{Tab 8} here {3.5s}and it {500}should work.",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
EDIT: Modifier Keys are fixed and should be fully functional.
EDIT: ClipWait integration.
Edited by AfterLemon, 04 January 2016 - 11:08 PM.
Added ClipWait functionality