AutoHotkey Community

It is currently May 27th, 2012, 5:58 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: September 21st, 2010, 2:19 am 
Offline

Joined: September 20th, 2010, 7:53 pm
Posts: 16
Location: USA
Hi everybody! I've been learning so much about AutoHotkey - it is a great tool. I've been working on this for a while now, and I can't get if figured out. I got the dollar sign trick working, but I cannot get it to stop :cry: . I should be able to press "s" again to make it stop, but it keeps going. I've got

$s::
Loop
{
Send, s
If GetKeyState, out, s, p
break
}

Can somebody help :?:


Last edited by Titan on September 24th, 2010, 2:18 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2010, 2:28 am 
it seems, you are not tank, cause tank would have known the answer.
please consider using a different username, this is very irritating. we are used to be insulted and given IE-COM help from tank, not being asked beginner questions.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2010, 2:40 am 
Offline

Joined: February 29th, 2008, 8:36 pm
Posts: 901
Location: Vault 7
Tank is a prolific poster here (2916 posts to date), but he recently changed his name to BoBoKins for some reason. You might consider changing your name just to avoid confusion, but anyways...


Try this:
Code:
$s::
Loop
{
    Send, s
    GetKeyState, out, s, p
    if (out=="U")
        break
}

; kill-switch
Esc::
    ExitApp


the part that was tripping you up was that the command version of GetKeyState returns "U" for up and "D" for down. It is the function version (the one with parenthesis) returns true/false. I also added a kill-switch to make working with the script easier. Some script can just get out of control (pressing s forever and ever and ever...), so being able to kill it quickly is useful.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2010, 3:13 am 
Offline

Joined: September 20th, 2010, 7:53 pm
Posts: 16
Location: USA
Rapte_Of_Suzaku wrote:
Tank is a prolific poster here (2916 posts to date), but he recently changed his name to BoBoKins for some reason. You might consider changing your name just to avoid confusion, but anyways...


Try this:
Code:
$s::
Loop
{
    Send, s
    GetKeyState, out, s, p
    if (out=="U")
        break
}

; kill-switch
Esc::
    ExitApp


the part that was tripping you up was that the command version of GetKeyState returns "U" for up and "D" for down. It is the function version (the one with parenthesis) returns true/false. I also added a kill-switch to make working with the script easier. Some script can just get out of control (pressing s forever and ever and ever...), so being able to kill it quickly is useful.

Thank you for the help. I thought GetKeyState was a function. This still doesn't work though. It stops pressing "s" a little bit after I release "s" - rather than holding it until I press "s" again.

I'm sorry if I made you mad theallmighty - I just wanted help. I'm kinda lost on this - I got the idea to use the name tank from a user named tlm in another post - http://www.autohotkey.com/forum/viewtop ... &start=225. Is this name reserved or something :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2010, 3:46 am 
Offline

Joined: February 29th, 2008, 8:36 pm
Posts: 901
Location: Vault 7
:lol: I see what happened now with the names. If BoBoKins asks for it back, I hope you'd be nice... but it's your name now so have fun! TheAlmighty was probably just startled, don't worry about it.

Code:
$s::

Loop
{
   Send, s
   GetKeyState, out, s, p
   if (out=="U")
      ready := true
   if (ready and out=="D")
      break
}

; kill-switch
Esc::
     ExitApp


I misunderstood what you were trying to get. This version waits for you to release the s button and then waits for you to press it again.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2010, 2:16 am 
Offline

Joined: September 20th, 2010, 7:53 pm
Posts: 16
Location: USA
You are a genius Rapte_Of_Suzaku :!: This AutoHotKey stuff rocks :!:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2010, 2:38 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
Code:
$s::
  KeyWait, s
  While !GetKeyState("s","P")
    Send, s
  KeyWait, s
Return

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, batto, dra, HotkeyStick, mKnight, sjc1000, Wicked, XstatyK and 64 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