Hello I have a hearing on how to make:
1."Sleep" from "1000" to "2000" random number from 1000-2000
2. how to make a script ignore keys other than selected. eg F1 ::
Send "Hello" but when I hold some other key together the script doesn't work.
Hello I have a hearing on how to make:
Re: Hello I have a hearing on how to make:
The random duration Sleep part is quite simple:
As for a hotkey not running if other keys are held, I'm not sure that it is (efficiently) possible. The only way I can think of doing this is very inefficient:
I may have misunderstood you, so be sure to post if I did.
Code: Select all
Random, RandomNumber, 1000, 2000
Sleep, RandomNumber
Code: Select all
$F1::
if (!AnyKeyIsHeldDown("F1"))
Send, {F1 Down}
~F1 Up::return ;This hotkey definiton acts as the $F1 hotkey's return. One line saved! (The ~F1 Up hotkey is necessary to release the key. Using KeyWait then releasing F1 with Send would disable auto-repeated keystrokes for the key, so I decided against it.)
AnyKeyIsHeldDown(KeyToExclude := "")
{
SetBatchLines, -1 ;so it doesn't take long to run
KeyList := ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "``", "-", "=", "[", "]", "`;", "'", "\", "`,", ".", "/", "CapsLock", "Space", "Tab", "Enter", "Escape", "Backspace", "Up", "Down", "Right", "Left", "ScrollLock", "Delete", "Insert", "Home", "End", "PgUp", "PgDn", "Numpad0", "Numpad1", "Numpad2", "Numpad3", "Numpad4", "Numpad5", "Numpad6", "Numpad7", "Numpad8", "Numpad9", "NumpadDot", "NumLock", "NumpadDiv", "NumpadMult", "NumpadAdd", "NumpadSub", "NumpadEnter", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24", "LWin", "RWin", "LControl", "RControl", "LShift", "RShift", "LAlt", "RAlt", "Browser_Back", "Browser_Forward", "Browser_Refresh", "Browser_Stop", "Browser_Search", "Browser_Favorites", "Browser_Home", "Volume_Mute", "Volume_Down", "Volume_Up", "Media_Next", "Media_Prev", "Media_Stop", "Media_Play_Pause", "Launch_Mail", "Launch_Media", "Launch_App1", "Launch_App2", "AppsKey", "PrintScreen", "CtrlBreak", "Pause", "Help", "Sleep"]
Loop, % KeyList.MaxIndex() + 1
{
if (KeyList[A_Index] != KeyToExclude)
{
if (GetKeyState(KeyList[A_Index]))
break
LoopIterationBrokenAt := A_Index
}
}
if (LoopIterationBrokenAt = KeyList.MaxIndex() + 1)
return 0
else
return 1
}
Re: Hello I have a hearing on how to make:
Hallo,
2. how to make a script ignore keys other than selected. eg F1 ::
Send "Hello" but when I hold some other key together the script doesn't work.
What should be written to a notepad window when the 3 keys F1+F2+Q are held down?
2. how to make a script ignore keys other than selected. eg F1 ::
Send "Hello" but when I hold some other key together the script doesn't work.
Code: Select all
F1::Send,% "Hello "
F2::Send,% "World "
Re: Hello I have a hearing on how to make:
when i hold other keys and press F1 :: the system doesn't work, but as soon as i release the other keys and press f1 :: the system works, how should i make the system work while holding the other keys.
Re: Hello I have a hearing on how to make:
"the system doesnt work" means it doesnt happen exactly what you want. In order to help you, you should define what you want to happen!!