 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Eternal88
Joined: 20 Sep 2007 Posts: 2
|
Posted: Thu Sep 20, 2007 10:35 am Post subject: I need one key to do 3 things and toggle between them |
|
|
I need a script that makes my spacebar do 3 different things, let me explain.
What I want space to do:
(when i hit shift & 1)
space::sendplay, {f2}x{lbutton}{f1}z{lbutton}
(when I hit shift & 2)
space::sendplay, {f1}z{lbutton}{f2}z{lbutton}
(when I hit shift & 3)
space::sendplay, {f2)z{lbutton}
I have accomplished this but the way I am doing it seems like such a hard way. I figure there is a workaround. The way I am doing this now is having 1 main script that loads and unloads 3 other scripts (which change the way my space bar work). I have also tried the script below and didn't' have any luck.
rshift & 1::hero=1
rshift & 2::hero=2
rshift & 3::hero=3
if InStr(A_ThisHotkey, "1")
space::sendplay, {f2}x{f1}z{lbutton}
else if InStr(A_ThisHotkey, "2")
space::sendplay, {f1}z{lbutton}{f2}z{lbutton}
else if InStr(A_ThisHotkey, "3")
space::sendplay, {f2}z{lbutton} |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Thu Sep 20, 2007 10:42 am Post subject: |
|
|
Guess where to find that? At AHKs help file! | Code: | ; Example #3: Detection of single, double, and triple-presses of a hotkey. This
; allows a hotkey to perform a different operation depending on how many times
; you press it:
#c::
if winc_presses > 0 ; SetTimer already started, so we log the keypress instead.
{
winc_presses += 1
return
}
; Otherwise, this is the first press of a new series. Set count to 1 and start
; the timer:
winc_presses = 1
SetTimer, KeyWinC, 400 ; Wait for more presses within a 400 millisecond window.
return
KeyWinC:
SetTimer, KeyWinC, off
if winc_presses = 1 ; The key was pressed once.
{
Run, m:\ ; Open a folder.
}
else if winc_presses = 2 ; The key was pressed twice.
{
Run, m:\multimedia ; Open a different folder.
}
else if winc_presses > 2
{
MsgBox, Three or more clicks detected.
}
; Regardless of which action above was triggered, reset the count to
; prepare for the next series of presses:
winc_presses = 0
return |
|
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1355
|
Posted: Thu Sep 20, 2007 10:45 am Post subject: |
|
|
untested
| Code: | mode = 1
Return
~space::
If mode = 1
sendplay, {f2}x{lbutton}{f1}z{lbutton}
If mode = 2
sendplay, {f1}z{lbutton}{f2}z{lbutton}
If mode = 3
sendplay, {f2)z{lbutton}
Return
~rshift & 1::
mode = 1
Return
~rshift & 2::
mode =2
Return
~rshift & 3::
mode = 3
Return |
|
|
| Back to top |
|
 |
Eternal88
Joined: 20 Sep 2007 Posts: 2
|
Posted: Thu Sep 20, 2007 11:01 am Post subject: |
|
|
Yo tic that was perfect, thanks alot. And Bobo even though that wasn't what I was looking for you actually just helped me on my next project. You guys rock, thanks a ton.
There was one typo in the script that was my fault actually. So i'm going to post my finished working product. Btw ppl this is a script that makes it so you can bind different hero combos in Warcraft 3.
Process, priority, , High ; Have the script set itself to high priority
#IfWinActive Warcraft III
#InstallMouseHook
#SingleInstance force
#InstallKeybdHook
#UseHook On
SetBatchLines 10ms
#HotString SP
#MaxThreads 20
CoordMode, mouse, Screen
SetKeyDelay, 10, 0, Play
SetMouseDelay, 10 , Play
| Code: |
mode = 1
Return
space::
If mode = 1
sendplay, {f2}x{lbutton}{f1}z{lbutton}
If mode = 2
sendplay, {f1}z{lbutton}{f2}z{lbutton}
If mode = 3
sendplay, {f2}z{lbutton}
Return
~rshift & 1::
mode = 1
Return
~rshift & 2::
mode = 2
Return
~rshift & 3::
mode = 3
Return |
|
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1355
|
Posted: Thu Sep 20, 2007 11:07 am Post subject: |
|
|
| Quote: | | Yo tic that was perfect.... You guys rock, thanks a ton. |
no problemo |
|
| Back to top |
|
 |
POINTS
Joined: 18 Jan 2006 Posts: 284
|
Posted: Thu Jan 10, 2008 6:26 pm Post subject: Nice |
|
|
Very nice, although I really don't want to see UD nuking any faster.  _________________ My AutoHotkey Program for Warcraft III:
Warkeys
http://warkeys.sourceforge.net/
Remap your hotkeys
Healthbars always on
Remap inventory |
|
| Back to top |
|
 |
justreading Guest
|
Posted: Thu Jan 10, 2008 7:48 pm Post subject: |
|
|
I dunno what its for and don;t play warcraft.
So I don't know if this works but why dont you use the scroll button.
(btw if its inuse by the game bummer)
Well scroll up hero -1 and scroll down hero +1
basic beginning at hero 2
scroll up >2 times always go hero 1 else step -1 hero
scroll down >2 times always go hero 3 else step +1 hero
maybe mbutton::hero2
Could splash a box or tooltip for a millisec for the number of the hero.
just a thought
(owyeah I love the scrolly butt for all kind of purposes)
Sample code of something likes this I got at home. |
|
| Back to top |
|
 |
justreading Guest
|
Posted: Thu Jan 10, 2008 7:50 pm Post subject: |
|
|
or the Mbutton for this
~mbutton::
If mode = 1
sendplay, {f2}x{lbutton}{f1}z{lbutton}
If mode = 2
sendplay, {f1}z{lbutton}{f2}z{lbutton}
If mode = 3
sendplay, {f2)z{lbutton}
Return |
|
| 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
|