Sign in to follow this  
Followers 0
MrChiliCheese

Advanced Hotkey?

4 posts in this topic

#1 ·  Posted (edited)

Sorry for the dumb title, but that was the only one the came up...

My Question. I want to call func, after:

1. clicking left mouse short

2. clicking middle mouse long

3. clicking left mouse short

so far, i have this code working, but i'm not really happy with that...

Needed: _IsPressed_UDF

#include <_IsPressed_UDF.au3>
$kS = 0
While 1
    If $kS = 0 Then
        $mL = _IsTimeKeyPressed("01")
        If $mL <> -1 And $mL < 500 Then
            $kS = 1
        EndIf
    ElseIf $kS = 1 Then
        $mM = _IsTimeKeyPressed("04")
        If $mM <> -1 And $mM > 1000 And $mM < 2500 Then
            $kS = 2
        ElseIf $mM > 2500 Then
            $kS = 0
        EndIf
    ElseIf $kS = 2 Then
        $mL = _IsTimeKeyPressed("01")
        If $mL <> -1 And $mL < 500 Then
            $kS = 0
            ;-----> Call Func
        EndIf
    EndIf
    Sleep(10)
WEnd

So, when anyone has an idea... :)

Edited by yetrael

Share this post


Link to post
Share on other sites



Sorry for the dumb title, but that was the only one the came up...

My Question. I want to call func, after:

1. clicking left mouse short

2. clicking middle mouse long

3. clicking left mouse short

so far, i have this code working, but i'm not really happy with that...

Needed: _IsPressed_UDF

#include <_IsPressed_UDF.au3>
$kS = 0
While 1
    If $kS = 0 Then
        $mL = _IsTimeKeyPressed("01")
        If $mL <> -1 And $mL < 500 Then
            $kS = 1
        EndIf
    ElseIf $kS = 1 Then
        $mM = _IsTimeKeyPressed("04")
        If $mM <> -1 And $mM > 1000 And $mM < 2500 Then
            $kS = 2
        ElseIf $mM > 2500 Then
            $kS = 0
        EndIf
    ElseIf $kS = 2 Then
        $mL = _IsTimeKeyPressed("01")
        If $mL <> -1 And $mL < 500 Then
            $kS = 0
            ;-----> Call Func
        EndIf
    EndIf
    Sleep(10)
WEnd

So, when anyone has an idea... :)

What about something like this:

While 1
   $mL1 = 0
   $mM = 0
   $mL2 = 0

   $mL1 = _IsTimeKeyPressed("01")
   If $mL1 <> -1 And $mL1 < 500 Then
      Sleep(10)
      $mM = _IsTimeKeyPressed("04")
      If $mM <> -1 And $mM > 1000 And $mM < 2500 Then
         Sleep(10) 
         $mL2 = _IsTimeKeyPressed("01")
         If $mL2 <> -1 And $mL2 < 500 Then
            ;-----> Call Func
         EndIf
      EndIf
   EndIf
WEnd

[font="Times New Roman"]Ocho.[/font]

Share this post


Link to post
Share on other sites

Don't work for, because after one loop the first "If...EndIf"-conditions is not true, but nice idea :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Don't work for, because after one loop the first "If...EndIf"-conditions is not true, but nice idea :)

I don't know how your _IsTimeKeyPressed() function works, but would this fix it? Instead of 0 you could start with any random value not returned by your _IsTimeKeyPressed() function

$mL1 = 0
$mM = 0
$mL2 = 0

While 1
   If $mL1 <> 0 Then $mL1 = _IsTimeKeyPressed("01")
   If $mL1 <> -1 And $mL1 < 500 Then
      Sleep(10)
      If $mM <> 0 Then $mM = _IsTimeKeyPressed("04")
      If $mM <> -1 And $mM > 1000 And $mM < 2500 Then
         Sleep(10) 
         If $mL2 <> 0 then $mL2 = _IsTimeKeyPressed("01")
         If $mL2 <> -1 And $mL2 < 500 Then
            ;-----> Call Func
         EndIf
      EndIf
   EndIf
WEnd
Edited by OchoNueve

[font="Times New Roman"]Ocho.[/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0