Jump to content

Recommended Posts

Posted

I want to make a function that when a key is pressed Ctrl+left mouse clicked in held down until the button is clicked again however I do not know a way of making a while loop wait for pressed key since I cant find one that returns a value to use.

Any help would be appreciated,

Basically...

While 1
     HotKeySet($FunHold, "z") 
     WinWaitNotActive($win)
     HotKeySet(hold);holds down ctrl and left mouse

WEnd

While 1
    Sleep(100)
WEnd

Func Hold()
        MouseDown ( "Left" )
        Send("{CTRLDOWN}")
Endfunc
Posted

  boogieoompa said:

I want to make a function that when a key is pressed Ctrl+left mouse clicked in held down until the button is clicked again however I do not know a way of making a while loop wait for pressed key since I cant find one that returns a value to use.

Any help would be appreciated,

Basically...

While 1
     HotKeySet($FunHold, "z") 
     WinWaitNotActive($win)
     HotKeySet(hold);holds down ctrl and left mouse

WEnd

While 1
    Sleep(100)
WEnd

Func Hold()
        MouseDown ( "Left" )
        Send("{CTRLDOWN}")
Endfunc
Try doing mod division with a counter. ie While mod($counter,2) <>0. So when the key is pressed, add 1 to counter (counter = counter +1) so that way the number will now be odd and the while loop will execute. then if you press it again, it should stop because the number is even.

I'm not an expert but i think it may work :shocked:

Posted

OK I've officially given up I'm just not smart enough. Take a look below...

Global $toggle

HotKeySet("z", "function")
HotKeySet("{ESC}", "Terminate")

;;;; Body of program would go here ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;
Func function()
    $toggle = NOT $toggle
    MouseDown ("Left")
    ;Send("{CTRLDOWN}")
    While $toggle
        sleep(100)
    WEnd
    MouseUp("Left")
    ;Send("{CTRLDOWN}")
EndFunc


Func Terminate()
    Exit
EndFunc

That will work perfectly with only the mouse down, but using ctrldown is a problem, and its what I couldn't overcome. When you hold down CTRL and wait for z to be pressed its impossible since you are pressing CTRL+Z... get my drift? It could be something stupid I'm just missing but I couldn't figure out a way to do it. :shocked: hopefully in the morning someone with fresh eyes will take a look at this. I'm sure there is a way.

Also with the above if while autoit is sending mousedown you click the button it overides autoit's control over the button; you have to start the function again. Again I'm sure you can code around that but its also not a huge issue.

Hope I've helped some

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...