AutoHotkey Community

It is currently May 27th, 2012, 12:54 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: December 28th, 2009, 11:41 pm 
Offline

Joined: December 28th, 2009, 11:34 pm
Posts: 5
hi!
I wanted to create a script witch can do that:
every 5 seconds it presses left ctrl
I tried to create it but 1. it doesnt work in the game i use it and when i press ctrl myself it doesnt work(The normal funktion doesnt work when the script is active)
Thats the code:

Code:
#SingleInstance
gActivateScript = 0


~Insert::
KeyWait, Insert
GetKeyState, InsertState, Insert, T
If InsertState = D
{
    gActivateScript = 1
    Goto, ctrlscript

}
else
{
    gActivateScript = 0

}
return




ctrlscript:
if gActivateScript = 1
{
    Loop
    {
        IfWinActive, Left 4 Dead 2
   {

       LControl::
       Sleep, 5000
       return
        }
        else
        {
            break
        }
    }
   
}
exit

return


what is wrong???


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 12:08 am 
Offline

Joined: December 8th, 2006, 5:17 am
Posts: 248
Location: Sydney Australia
Code:
LControl::
       Sleep, 5000
       ;return


I think you should remove the RETURN command after the sleep.

_________________
Paul O


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 12:12 am 
Offline

Joined: December 28th, 2009, 11:34 pm
Posts: 5
poo_noo wrote:
Code:
LControl::
       Sleep, 5000
       ;return


I think you should remove the RETURN command after the sleep.


after some time there is a window and it says that there is needed a return^^


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 3:22 am 
Offline

Joined: December 8th, 2006, 5:17 am
Posts: 248
Location: Sydney Australia
sorry I can't test this

Code:
IfWinActive, Left 4 Dead 2
   Loop
      {
      Send LControl
      Sleep 5000
      WinGetTitle, theWindow, A
      If theWindow != Left 4 Dead 2
         Break
      }

_________________
Paul O


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 8:05 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Just a few tweaks
Code:
Loop
{
   IfWinActive, Left 4 Dead 2
   {
      Send {LControl}
      Sleep 5000
   }
   Sleep, 100
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 11:40 am 
Offline

Joined: December 28th, 2009, 11:34 pm
Posts: 5
Hmmmm.. no error at both scripts(the scripts by a_h_k and ) but there is nothing in the game^^ so when i press insert nothing happens(vtrl = crouch...)
When you crouch you must hold the key... is that the error??? maybe the key have to be hold done 1 second and than wait...
if so how can i do this?

HELP!!!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 30th, 2009, 1:42 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Could you ellaborate a bit more about what you want to happen...
- Press left ctrl key --> crouch
- Press Insert key --> (what do you want Insert key to do?)
- WHY do you want to send left ctrl once every 5 secs?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2010, 5:24 pm 
Offline

Joined: December 28th, 2009, 11:34 pm
Posts: 5
a_h_k wrote:
Could you ellaborate a bit more about what you want to happen...
- Press left ctrl key --> crouch
- Press Insert key --> (what do you want Insert key to do?)
- WHY do you want to send left ctrl once every 5 secs?



^^ when i press insert the "script" is activated...(i would use the script that im not afk.. so every 5 seconds i should crouch one second and then release ctrl again^^)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2010, 5:24 pm 
Offline

Joined: December 28th, 2009, 11:34 pm
Posts: 5
a_h_k wrote:
Could you ellaborate a bit more about what you want to happen...
- Press left ctrl key --> crouch
- Press Insert key --> (what do you want Insert key to do?)
- WHY do you want to send left ctrl once every 5 secs?



^^ when i press insert the "script" is activated...(i would use the script that im not afk.. so every 5 seconds i should crouch one second and then release ctrl again^^)


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], WillTroll, XstatyK and 25 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