AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

almost done

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
klein andy
Guest





PostPosted: Sat Jul 11, 2009 12:49 pm    Post subject: almost done Reply with quote

hi there,
i want to make a small script. it should turbo-push the S-button when i hold the S-Button while capslock is down(toggled). when capslock is up the s-button should be as there's no script running (work as a normal unchanged s-button).

it's almost done. it turbo-pushs perfekt, but when capslock is off the s-button doesn't do anything. can someone give me a tip?

here's the script:
Code:
*s::
loop
{     
   GetKeyState, sState, s, P
   GetKeyState, CapsState, CapsLock, T
   if (sState = "U") || CapsState = "U") {
break
}

else {
      send {s down}
      sleep, 30
      send {s up}
      sleep, 50
   }
}


this code is at the top, but not important in this case (?):
Code:
#NoEnv
#SingleInstance Force
SetTitleMatchMode 2
#Persistent
DetectHiddenWindows, On
sendMode Input
#InstallKeybdHook
#InstallMouseHook
SetDefaultMouseSpeed, 0
SetMouseDelay, -1
SetKeyDelay, -1
SetWinDelay, -1
SetBatchLines, -1
SetControlDelay -1
#MaxThreads 30
#MaxHotKeysPerInterval 1000
#MaxThreadsBuffer on
#KeyHistory 0
Back to top
klein andy
Guest





PostPosted: Sat Jul 11, 2009 12:54 pm    Post subject: Re: almost done Reply with quote

Code:
*s::
   if (sState = "U") || CapsState = "U") {


erm, the first ) must be deleted. but the problem with the not-working s-button still exist.
Back to top
klein andy
Guest





PostPosted: Sat Jul 11, 2009 1:21 pm    Post subject: Reply with quote

i've got a workaround:

Code:

*s::
GetKeyState, sState, s, P
GetKeyState, CapsState, CapsLock, T
if (sState = "D" || CapsState = "U")
  {
      send {s down}
      sleep, 30
      send {s up}
      sleep, 50
  }
loop
  {     
      GetKeyState, sState, s, P
      GetKeyState, CapsState, CapsLock, T
      if (sState = "U" || CapsState = "U")
  {
   break
  }

  else
   {
      send {s down}
      sleep, 30
      send {s up}
      sleep, 50
   }
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group