AutoHotkey Community

It is currently May 26th, 2012, 8:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: almost done
PostPosted: July 11th, 2009, 1:49 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject: Re: almost done
PostPosted: July 11th, 2009, 1:54 pm 
Code:
*s::
   if (sState = "U") || CapsState = "U") {


erm, the first ) must be deleted. but the problem with the not-working s-button still exist.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2009, 2:21 pm 
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
   }
}


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, Retro Gamer, wolverineks 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