 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
nvus
Joined: 02 Aug 2007 Posts: 22
|
Posted: Mon May 12, 2008 7:21 pm Post subject: [help] how to toggle a key on/off |
|
|
I was wondering how do I keep my ctrl key held down if ScrollLock is on... if it is off then don't hold ctrl
im trying to implement it into this script:
| Code: | ;;;;; Hotkeys ;;;;;
#ifWinActive, Lineage II
;;;;; NUMPAD for F keys ;;;;;
Numpad1::F1
Numpad2::F2
Numpad3::F3
Numpad4::F4
Numpad5::F5
Numpad6::F6
Numpad7::F7
Numpad8::F8
Numpad9::F9
NumpadAdd::Sendplay, !{F1}
NumpadEnter::Sendplay, !{F2}
NumpadSub::Sendplay, !{F3} |
I only want ScrollLock to toggle ctrl; not my keymapping |
|
| Back to top |
|
 |
Razlin
Joined: 05 Nov 2007 Posts: 288 Location: canada
|
Posted: Mon May 12, 2008 7:34 pm Post subject: |
|
|
| Code: |
scrolllock::
GetKeyState, state, scrolllock, T
if state = D
send {control down}
else
send {control up}
return
|
_________________ -=Raz=- |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 22
|
Posted: Mon May 12, 2008 8:06 pm Post subject: |
|
|
thanks alot... do i just put it anywhere in my current script?
EDIT: i put it at the end of my script and it doesnt work |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 883
|
Posted: Mon May 12, 2008 8:24 pm Post subject: |
|
|
| Code: | | *ScrollLock::Send % "{blind}" (GetKeyState("LCtrl") ? "{LCtrl up}" : "{LCtrl down}") |
_________________ My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 22
|
Posted: Mon May 12, 2008 8:34 pm Post subject: |
|
|
Thanks [VxE] that was perfect!
Now I decided to remap my keys so now I have:
| Code: | ;;;;; Hotkeys ;;;;;
#ifWinActive, Lineage II
`::Suspend, toggle
;;;;; QWER for F keys ;;;;;
q::F1
w::F2
e::F3
r::F4
a::F5
s::F6
d::F7
f::F8
z::F9
x::F10
c::F11
v::F12
1::Sendplay, !{F1}
2::Sendplay, !{F2}
3::Sendplay, !{F3}
4::Sendplay, !{F4}
5::Sendplay, !{F5}
*capsLock::Send % "{blind}" (GetKeyState("LCtrl") ? "{LCtrl up}" : "{LCtrl down}") |
How do I make a message pop up in the tray icon saying when i have my keymap toggled on and or my ctrl is toggled on?
Example:
if my keymap is ON and my ctrl is OFF it will say in the same bubble
_______________
| Keymap = ON |
| CTRL = OFF |
---------------------
v
[X] <--- trayicon
or maybe someone knows a better way of knowing when these 2 things are toggled? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2472 Location: Australia, Qld
|
Posted: Mon May 12, 2008 9:56 pm Post subject: |
|
|
TrayTip  |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 22
|
Posted: Mon May 12, 2008 11:37 pm Post subject: |
|
|
yea traytip.. i just tried putting it in my script but i cant get it to work properly |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2472 Location: Australia, Qld
|
Posted: Tue May 13, 2008 6:53 am Post subject: |
|
|
A few suggestions:
- Read the documentation.
- Try the example in the documentation.
- If you've written code and it isn't working, post it so we can help.
- If you've written code and it works, but not "properly," post the code and define what "properly" is.
|
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 22
|
Posted: Tue May 13, 2008 1:58 pm Post subject: |
|
|
| Code: | ;;;;; Hotkeys ;;;;;
#ifWinActive, Lineage II
~`::Suspend, toggle
{
RefreshTrayTip:
TrayTip, Refreshed TrayTip, Keymap is ON, , 16
return
}
;;;;; QWER for F keys ;;;;;
q::F1
w::F2
e::F3
r::F4
a::F5
s::F6
d::F7
f::F8
z::F9
x::F10
c::F11
v::F12
1::Sendplay, !{F1}
2::Sendplay, !{F2}
3::Sendplay, !{F3}
4::Sendplay, !{F4}
5::Sendplay, !{F5}
*capsLock::Send % "{blind}" (GetKeyState("LCtrl") ? "{LCtrl up}" : "{LCtrl down}")
{
RefreshTrayTip:
TrayTip, Refreshed TrayTip, CTRL is ON, , 16
return
} |
There's what I tried. I know it's probably completely wrong but I have never done any kind of scripting before. I'm only using AHK for this one game.
AHK won't run because there's duplicate lines (TrayTip). |
|
| Back to top |
|
 |
stewie7griffin Guest
|
Posted: Tue May 13, 2008 2:59 pm Post subject: diablo |
|
|
| are you trying to make this for Diablo? best game ever |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 22
|
Posted: Tue May 13, 2008 4:24 pm Post subject: |
|
|
| nah im making it for lineage2 |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2472 Location: Australia, Qld
|
Posted: Tue May 13, 2008 10:42 pm Post subject: |
|
|
| Quote: | | Code: | ~`::Suspend, toggle
{
RefreshTrayTip:
TrayTip, Refreshed TrayTip, Keymap is ON, , 16
return
} |
| The first line is a one-line hotkey - because the command is on the same line as the hotkey, there is an implicit return after the hotkey. If you intended the TrayTip to be shown when you press the key, move Suspend, toggle to the next line. Labels, such as "RefreshTrayTip:" are used as targets for goto/gosub. You cannot use the same label name twice. In this case you aren't using goto/gosub to run the code, so you can remove the label. Also, {braces} have no effect for labels, only functions and if/else/loop.
| Code: | ~`::
Suspend, toggle
TrayTip, Refreshed TrayTip, Keymap is ON, , 16
return | The same goes for the *capsLock hotkey. |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 22
|
Posted: Tue May 13, 2008 11:45 pm Post subject: |
|
|
thanks lexikos, that was extremely helpful
this is what i have now and it's working the way I want it to
| Code: | ;;;;; Hotkeys ;;;;;
#ifWinActive, Lineage II
~`::
Suspend, toggle
if A_IsSuspended = 1
{
TrayTip, KEYMAP, OFF, 99999, 3
}
else
{
TrayTip, KEYMAP, ON, 99999, 2
}
return
;;;;; QWER for F keys ;;;;;
q::F1
w::F2
e::F3
r::F4
a::F5
s::F6
d::F7
f::F8
z::F9
x::F10
c::F11
v::F12
1::Sendplay, !{F1}
2::Sendplay, !{F2}
3::Sendplay, !{F3}
4::Sendplay, !{F4}
5::Sendplay, !{F5}
*capsLock::Send % "{blind}" (GetKeyState("LCtrl") ? "{LCtrl up}" : "{LCtrl down}")
|
The only problem I have with it now is making the traytip permanent. I had to improvise by putting the seconds to 99999, but it still disappears after a minute. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed May 14, 2008 4:50 am Post subject: |
|
|
| Code: | Gui +AlwaysOnTop +ToolWindow
Gui, Font, bold
Gui, Add, Text, w75 vGuiText, Keymap: ON
Gui, Show, % "x" . (A_ScreenWidth - 100) . "Y" . (A_ScreenHeight - 85)
Return
;;;;; Hotkeys ;;;;;
;#ifWinActive, Lineage II`
~`::
Suspend, toggle
if A_IsSuspended = 1
GuiControl,, GuiText, Keymap: OFF
else
GuiControl,, GuiText, Keymap: ON
return
;;;;; QWER for F keys ;;;;;
q::F1
w::F2
e::F3
r::F4
a::F5
s::F6
d::F7
f::F8
z::F9
x::F10
c::F11
v::F12
1::Sendplay, !{F1}
2::Sendplay, !{F2}
3::Sendplay, !{F3}
4::Sendplay, !{F4}
5::Sendplay, !{F5}
*capsLock::Send % "{blind}" (GetKeyState("LCtrl") ? "{LCtrl up}" : "{LCtrl down}")
|
|
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 22
|
Posted: Wed May 14, 2008 2:41 pm Post subject: |
|
|
| wow thanks alot. thats MUCH better. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|