AutoHotkey Community

It is currently May 27th, 2012, 4:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: May 25th, 2011, 2:31 am 
Offline

Joined: September 17th, 2008, 7:38 pm
Posts: 19
Hi.

I’m trying to do my best to avoid using the mouse. I’d like to try to get the mouse moving to coordinates.

Firstly, this is foolish compared to learning the shortcuts of a software, but I’m just curious if this can be done.

Just with a small set of mouse keys (9 keys), like a number pad, I’d like to be able to move my mouse to more than just 9 coordinates. Is it possible to get more coordinates with sequential presses of at least 2 keys?

I’m trying to achieve an effect similar to the mouse grid of voice recognition software, such as Dragon, and the built-in windows voice recognition software.

Image

Pic

This the only way I can think of:

Let’s say I want the top-left grid, and more specifically, I want the top square of the top-left grid. I press 7, and that closes my current autohotkey script, then reopens a script that’s specifically just for the top-left grid. I press 8, which is remapped to move to a specific coordinate, and after the movement, the script closes and returns to my original script.

Image

8, after opening the 7 script, sends a coordinate in the top region of the top-left corner.

Another example:
If I initially pressed 6, that would open the "6 script", then 8 in the 6 script would send a coordinate in the top region of the right region.

Image

lol does this make sense at all? Is this the best method?

Do I need something like ExitApp, OnExit, and Run

I’ll probably have 9 scripts in a folder on the desktop or something. 9 keys open to a script, and each script has 9 buttons remapped to a specific coordinate. It’s a way to reuse the same 9 keys.

By the way, what’s the least ambiguous way and syntax to use Run if I know the exact address and target of the script?

Thanks for any info at all.
I’ve asked pretty weird questions before, and you authotkey experts are just too good.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 3:24 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Aha! A semi-challenge! I'll get you started...
Code:
Loop 9 ; This loop sets all the hotkeys to go to one label
   Hotkey, Numpad%A_Index%, label

label:
   count++
   If Mod(Count, 2) ; If count is odd
   {
      number := SubStr(A_thisHotkey, 0) ; save press one
      return ; and wait for press 2
   }
   ; Implied else because of 'return' above
   number2 := SubStr(A_ThisHotkey, 0)
   ; Now, define your clicks
   If ((string := number . number2) = "00")
      click 0, 0
   Else If string = 01
      click 99, 50
   Else If string = 95
      click 25, 85
return
If you want to delve into StringSplit + Loop Parse to shorten this, just say so :)
beware typos!

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 3:33 am 
Offline
User avatar

Joined: November 19th, 2010, 3:12 pm
Posts: 787
Location: At my computer
A very interesting idea. Just a thought but you could use HotStrings or Input instead of HotKeys, that way you can press more than one key to designate your coordinate. I would suggest something like 7.1 = the top left corner of the seventh main box, 5.9 = the bottom right corner of the fifth main box etc.

You could even subdivide into smaller areas for more precision.

Edit:
Both my idea and nimda's code would negate the need for all the script switching. :D

_________________
"My dear Mr Gyrth, I am never more serious than when I am joking."
~Albert Campion

My personal site


Last edited by dmg on May 25th, 2011, 3:39 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 3:39 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
However, hotstrings would not limit to numpad. Also would not work for custom key combos like delete-home, which my script can be adapted to very simply.

StringSplit is of course the most efficient way of doing this, ex tomorrow when I'm at comp

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 8:24 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
Not exactly what the OP asked for but it was pretty easy to code. :wink:
Numpad5 Resets the move and the surounding keys move the mouse in diminishing distances in the direction of the key from 5 :D
Code:
CoordMode, Mouse, Screen
Loop 9 ; This loop sets all the hotkeys to go to one label
   Hotkey, Numpad%A_Index%, label
Return

label:
If (A_ThisHotkey="Numpad5") {
 Var:=""
 MouseMove, A_ScreenWidth/2,A_ScreenHeight/2 ;center the mouse
 Return
}
Var.=SubStr(A_ThisHotkey,0) ;add the key to the variable
x:=A_ScreenWidth/(2**StrLen(Var)*2) ;calculate the distances
y:=A_ScreenHeight/(2**StrLen(Var)*2)
If InStr("789",SubStr(Var,0)) ;if the key is in the up direction
 y*=-1 ;make move negative
If InStr("147",SubStr(Var,0)) ;key on right
 x*=-1
If InStr("46",SubStr(Var,0)) ;if key is horizontal
 y:=0 ;cancel the up/down part
If InStr("28",SubStr(Var,0)) ;if vertical
 x:=0 ;cancel the left/right
MouseMove, x,y,0,r
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 30th, 2011, 9:18 pm 
Offline

Joined: September 17th, 2008, 7:38 pm
Posts: 19
How would I change the top part of nimda’s code if I wanted the option of choosing to input
qwe
asd
zxc
as sort of a left-handed numberpad

What needs to change here?

Code:
Loop 9 ; This loop sets all the hotkeys to go to one label
   Hotkey, Numpad%A_Index%, label


Also, you need some OR operators now on the bottom?

Code:
label:
   count++
   If Mod(Count, 2) ; If count is odd
   {
      Var1 := SubStr(A_thisHotkey, 0) ; save press one
      return ; and wait for press 2
   }
   ; Implied else because of 'return' above
   Var2:= SubStr(A_ThisHotkey, 0)
   ; Now, define your clicks
   If ((string := Var1 . Var2) = "q7" or “7q” or “qq” or “77”) ; give me 4 options if simulating 77           
   click 240, 150, 0 ; move to top-left grid of the top-left grid
   Else If …
return


Thanks for any info


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 31st, 2011, 7:24 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
Code:
Loop 9 ; This loop sets all the hotkeys to go to one label
   Hotkey, Numpad%A_Index%, label
Is a Shorter way to do
Code:
Hotkey, Numpad1, label
Hotkey, Numpad2, label
Hotkey, Numpad3, label
Hotkey, Numpad4, label
Hotkey, Numpad5, label
Hotkey, Numpad6, label
Hotkey, Numpad7, label
Hotkey, Numpad8, label
Hotkey, Numpad9, label

You can change these Hotkeys to anything you want IF you also Change the combinations it looks for
Code:
   Else If string = qq ;if one of your hotkeys is q
      click 99, 50

But nimda's code is not complete you would need 81 If's to handle the combinations 9 for the first times 9 for the second

PS: Did you try mine All it lacks is a Hotkey to Click the mouse


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2011, 1:03 am 
Offline

Joined: September 17th, 2008, 7:38 pm
Posts: 19
I’ll probably stick with a less efficient method so I can manipulate it later. I’m not smart enough to handle yours.

Lol I don’t even understand why something as simple as this doesn’t work when I press Numpad1:

Code:
Hotkey, Numpad1, label
label:
   var1 := SubStr(A_thisHotkey, 0) ; save press one
   If ((string := var1) = "1") {
       click 240, 150, 0
   }
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2011, 5:50 pm 
CoordMode, Mouse, Screen
Hotkey, +z, label
Hotkey, +x, label
Hotkey, +c, label
Hotkey, +a, label
Hotkey, +s, label
Hotkey, +d, label
Hotkey, +q, label
Hotkey, +w, label
Hotkey, +e, label
Hotkey, +Space, label
Hotkey, ^Space, label

label:
If (A_ThisHotkey="^Space") {
Var:=""
send, {Click right}
Return
}
If (A_ThisHotkey="+Space") {
Var:=""
send, {click}
Return
}
If (A_ThisHotkey="+s") {
Var:=""
MouseMove, A_ScreenWidth/2,A_ScreenHeight/2 ;center the mouse
Return
}
Var.=SubStr(A_ThisHotkey,0) ;add the key to the variable
x:=A_ScreenWidth/(2**StrLen(Var)*2) ;calculate the distances
y:=A_ScreenHeight/(2**StrLen(Var)*2)
If InStr("qwe",SubStr(Var,0)) ;if the key is in the up direction
y*=-1 ;make move negative
If InStr("zaq",SubStr(Var,0)) ;key on right
x*=-1
If InStr("ad",SubStr(Var,0)) ;if key is horizontal
y:=0 ;cancel the up/down part
If InStr("xw",SubStr(Var,0)) ;if vertical
x:=0 ;cancel the left/right
MouseMove, x,y,0,r

Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2011, 5:52 pm 
Code:
CoordMode, Mouse, Screen
   Hotkey, +z, label
   Hotkey, +x, label
   Hotkey, +c, label
   Hotkey, +a, label
   Hotkey, +s, label
   Hotkey, +d, label
   Hotkey, +q, label
   Hotkey, +w, label
   Hotkey, +e, label
   Hotkey, +Space, label
   Hotkey, ^Space, label

label:
If (A_ThisHotkey="^Space") {
Var:=""
send, {Click right}
Return
}
If (A_ThisHotkey="+Space") {
Var:=""
send, {click}
Return
}
If (A_ThisHotkey="+s") {
 Var:=""
 MouseMove, A_ScreenWidth/2,A_ScreenHeight/2 ;center the mouse
 Return
}
Var.=SubStr(A_ThisHotkey,0) ;add the key to the variable
x:=A_ScreenWidth/(2**StrLen(Var)*2) ;calculate the distances
y:=A_ScreenHeight/(2**StrLen(Var)*2)
If InStr("qwe",SubStr(Var,0)) ;if the key is in the up direction
 y*=-1 ;make move negative
If InStr("zaq",SubStr(Var,0)) ;key on right
 x*=-1
If InStr("ad",SubStr(Var,0)) ;if key is horizontal
 y:=0 ;cancel the up/down part
If InStr("xw",SubStr(Var,0)) ;if vertical
 x:=0 ;cancel the left/right
MouseMove, x,y,0,r

Return


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Leef_me, rbrtryn, Yahoo [Bot] and 49 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