How to randomize delays between keystrokes in hotstring
#1
Bernard
Posted 06 January 2007 - 07:55 PM
It probably measures the time between keystrokes, maybe some other technics as well.
Thanks,
Bernard
#2
BoBo
Posted 06 January 2007 - 07:56 PM
#3
Bernard
Posted 06 January 2007 - 08:05 PM
With Random?
So far it looks like that.
#Hotstring sp k100
::BTW::By The Way
::IMHO::In My Humble Opinion
Won't these sentences be replayed with the same speed even if I repalace "k100" with a expression producing random number ?
Sorry for lame questions but I've been using AHK for an hour only.
#4
BoBo
Posted 06 January 2007 - 08:19 PM
Show me where you've taken from the above HotKey syntax that you've to set a KeyDelay that way!Hotkey
--------------------------------------------------------------------------------
Creates, modifies, enables, or disables a hotkey while the script is running.
Hotkey, KeyName [, Label, Options]
Hotkey, IfWinActive/Exist [, WinTitle, WinText]
#5
Bernard
Posted 06 January 2007 - 08:31 PM
Hotkey
I meant hotstring not hotkey
#6
BoBo
Posted 06 January 2007 - 08:37 PM
OK.I meant hotstring not hotkey
Show me where you've taken from the existing HotString syntax that you've to set a KeyDelay that way!
#7
BoBo
Posted 06 January 2007 - 08:45 PM
Holy Moly :shock:. My appologize :oops:. I've definitley haven't used that ever before and therefore wasn't aware of it. :roll:Kn: Key-delay: This rarely-used option sets the delay between keystrokes produced by auto-backspacing or auto-replacement. Specify the new delay for n; for example, specify k10 to have a 10ms delay and k-1 to have no delay. The exact behavior of this option depends on which sending mode is in effect:
Yes, I guess you're right. The kparam delay will work as a generic/default setting for all Hotkeys.
#8
BoBo
Posted 06 January 2007 - 08:50 PM
SI or SP or SE [v1.0.43+]: Sets the method by which auto-replace hotstrings send their keystrokes. These options are mutually exclusive: only one can be in effect at a time. The following describes each option:
SI stands for SendInput, which became the default in v1.0.43+ because of its superior speed and reliability. Another benefit is that like SendPlay below, SendInput postpones anything you type during a hotstring's auto-replacement text. This prevents your keystrokes from being interspersed with those of the replacement. When SendInput is unavailable, hotstrings automatically use SendPlay instead.
SP stands for SendPlay, which may allow hotstrings to work in a broader variety of games.
SE stands for SendEvent, which is the default in versions older than 1.0.43.
#9
Bernard
Posted 06 January 2007 - 09:02 PM
#10
BoBo
Posted 06 January 2007 - 09:20 PM
::BTW::
SendToChat("By The Way")
Return
::IMHO::
SendToChat("In My Humble Opinion")
Return
SendToChat(Phrase)
{
Random, Delay, 500, 1000
SetKeyDelay, %Delay%, 0
SendPlay, %Phrase%
Return
}Untested.
#11
BoBo
Posted 06 January 2007 - 09:27 PM
#12
Posted 06 January 2007 - 09:41 PM
This loops the Phrase and sleeps anything from 0.1 to 1 second.
SendToChat(Phrase)
{
loop, Parse, Phrase
{
send %a_loopfield%
random, delay, 100, 1000
sleep %delay%
}
}
#13
Bernard
Posted 06 January 2007 - 09:50 PM
Thanks
#14
Posted 06 January 2007 - 09:58 PM
DeleteChar: the length of IMHO (might be an internal var for this)
Min: Lower limit for delay (default 100)
Max: Upper limit for delay (default 1000)
::IMHO::
SendToChat("In My Humble Opinion",4,90,110)
Return
SendToChat(Phrase, DeleteChars, min = 100, max = 1000)
{
loop %DeleteChars%
{
send {BS}
random, delay, %min%, %max%
sleep %delay%
}
loop, Parse, Phrase
{
send %a_loopfield%
random, delay, %min%, %max%
sleep %delay%
}
}




