Hello to with a very big problem not I select a shortcut key at run time to perform some tasks someone can help in a simple example ?
Gui Add, Hotkey, vhotkeydefesa x456 y158 w75 h21
Gui Show,, teste
Return
%hotkeydefesa%::
send, a
sleep 100
return
How to pass variable to hotkey?
Re: How to pass variable to hotkey?
Use the Hotkey command to identify the label to go to when a certain hotkey is pressed.
btw, this thread should be under Ask For Help.
btw, this thread should be under Ask For Help.
Re: How to pass variable to hotkey?
can not you can send an example based on what I posted ?
Re: How to pass variable to hotkey?
if quisr post the complete code for you to understand
Re: How to pass variable to hotkey?
Can you give this a try:
Code: Select all
Gui New
Gui Font, s10, Consolas
Gui Margin, 5, 5
Gui Add, Hotkey, w200 r1 vhotkeydefesa gDefHotkey
Gui Show
return
GuiEscape:
GuiClose:
ExitApp
DefHotkey(args*)
{
global hotkeydefesa
if (hotkeydefesa != "") {
static prev_hotkey := ""
if (prev_hotkey != "")
HotKey %prev_hotkey%, Off
HotKey %hotkeydefesa%, SendA, On
prev_hotkey := hotkeydefesa
}
}
SendA()
{
Send a
Sleep 100
}
Re: How to pass variable to hotkey?
Thanks u saved a soul and you goes to heaven
Re: How to pass variable to hotkey?
Fixed a little bit:
Code: Select all
Gui New
Gui Font, s10, Consolas
Gui Margin, 5, 5
Gui Add, Hotkey, w150 r1 vhotkeydefesa gDefHotkey
Gui Show
return
GuiEscape:
GuiClose:
ExitApp
DefHotkey(args*)
{
global hotkeydefesa
static prev_hotkey := ""
if (prev_hotkey != "")
HotKey %prev_hotkey%,, Off
if (hotkeydefesa != "")
HotKey %hotkeydefesa%, SendA, On
prev_hotkey := hotkeydefesa
}
SendA()
{
Send a
Sleep 100
}
Re: How to pass variable to hotkey?
Look at the code I want to do u will understand now
https://github.com/fabiolwg/Macros/blob ... 1.00.1.ahk
https://github.com/fabiolwg/Macros/blob ... 1.00.1.ahk
Re: How to pass variable to hotkey?
the IniReads in your code can be simplified by loops.
Code: Select all
loop 11
IniRead, parametro%A_Index%, semdedokfm.ini, Defesa, parametro%A_Index% , 0
........
can someone fix it there
Gui New
Gui Font, s10, Consolas
Gui Margin, 5, 5
Gui Add, Hotkey, w150 r1 vhotkeydefesa gDefHotkey
global defesa1
defesa1 = 1
Gui Show
return
GuiEscape:
GuiClose:
ExitApp
DefHotkey(args*)
{
global hotkeydefesa
static prev_hotkey := ""
if (prev_hotkey != "")
HotKey %prev_hotkey%,, Off
if (hotkeydefesa != "")
HotKey %hotkeydefesa%, SendA, On
prev_hotkey := hotkeydefesa
}
SendA()
{
Send {%hotkeydefesa% down}
;while(GetKeyState("Numpad0","P"))
while(GetKeyState(%hotkeydefesa%,"P"))
{
Send 1
sleep 100
Send 2
sleep 100
Send 3
Sleep 100
Send 4
Sleep 100
Send 5
Sleep 100
Send 6
Sleep 100
}
Send {%hotkeydefesa% up}
}
Gui Font, s10, Consolas
Gui Margin, 5, 5
Gui Add, Hotkey, w150 r1 vhotkeydefesa gDefHotkey
global defesa1
defesa1 = 1
Gui Show
return
GuiEscape:
GuiClose:
ExitApp
DefHotkey(args*)
{
global hotkeydefesa
static prev_hotkey := ""
if (prev_hotkey != "")
HotKey %prev_hotkey%,, Off
if (hotkeydefesa != "")
HotKey %hotkeydefesa%, SendA, On
prev_hotkey := hotkeydefesa
}
SendA()
{
Send {%hotkeydefesa% down}
;while(GetKeyState("Numpad0","P"))
while(GetKeyState(%hotkeydefesa%,"P"))
{
Send 1
sleep 100
Send 2
sleep 100
Send 3
Sleep 100
Send 4
Sleep 100
Send 5
Sleep 100
Send 6
Sleep 100
}
Send {%hotkeydefesa% up}
}
Who is online
Users browsing this forum: Araphen, DataLife, Google [Bot], ShatterCoder, sofista and 303 guests