AutoHotkey Community

It is currently May 25th, 2012, 4:10 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: September 20th, 2007, 10:35 am 
Offline

Joined: September 20th, 2007, 10:16 am
Posts: 2
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}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2007, 10:42 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2007, 10:45 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1832
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2007, 11:01 am 
Offline

Joined: September 20th, 2007, 10:16 am
Posts: 2
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2007, 11:07 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1832
Quote:
Yo tic that was perfect.... You guys rock, thanks a ton.


no problemo


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Nice
PostPosted: January 10th, 2008, 6:26 pm 
Offline

Joined: January 18th, 2006, 12:37 am
Posts: 290
Very nice, although I really don't want to see UD nuking any faster. :D

_________________
My AutoHotkey Program for Warcraft III:
Warkeys
http://warkeys.sourceforge.net/

Remap your hotkeys
Healthbars always on
Remap inventory


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2008, 7:48 pm 
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.

:roll: just a thought
(owyeah I love the scrolly butt for all kind of purposes)

Sample code of something likes this I got at home.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2008, 7:50 pm 
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


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, BrandonHotkey, Hodofca, Pulover, rbrtryn, sks, vsub, Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group