Jump to content
Sign in to follow this  
Drew

_WindowLock Question

Recommended Posts

Drew

Alright , how would I go about making it to where when I trigger the function via hotkey , it will toggle _WindowLock().

That is what I'm working on...

This is what I have thus far. It's not working ( ofc ) but could someone explain why?

#include <Misc.au3>

HotKeySet("W", "_Lock")

Global $Lock = 0

While 1
    Sleep(500)
WEnd

Func _Lock()
        $Lock = 0
        If $Lock = 0 Then
            WinWaitActive("GUI")
            $coords = WinGetPos("GUI")
            _MouseTrap($coords[0]+5, $coords[1]+22, $coords[0] + $coords[2]-5, $coords[1] + $coords[3])
            $Lock = 1
        ElseIf $Lock = 1 Then
            _MouseTrap()
            $Lock = 0
        EndIf
EndFunc ;==>_Lock
Edited by Drew

Share this post


Link to post
Share on other sites
Drew

Wtf @ googemyster or w/e ? Some of us would like our topics to be seen -.-

Edit:

Lol Psalty. Hopefully its soon, hes justa "goin"... Lol.

Edited by Drew

Share this post


Link to post
Share on other sites
PsaltyDS

Wtf @ googemyster or w/e ? Some of us would like our topics to be seen -.-

The Mods will be pointing out to googemyster the error of his ways.

:)

On your OP:

Alright , how would I go about making it to where when I trigger the function via hotkey , it will toggle _WindowLock().

That is what I'm working on...

This is what I have thus far. It's not working ( ofc ) but could someone explain why?

#include <Misc.au3>

HotKeySet("W", "_Lock")

Global $Lock = 0

While 1
    Sleep(500)
WEnd

Func _Lock()
        $Lock = 0
        If $Lock = 0 Then
            WinWaitActive("GUI")
            $coords = WinGetPos("GUI")
            _MouseTrap($coords[0]+5, $coords[1]+22, $coords[0] + $coords[2]-5, $coords[1] + $coords[3])
            $Lock = 1
        ElseIf $Lock = 1 Then
            _MouseTrap()
            $Lock = 0
        EndIf
EndFunc;==>_Lock
If you want to use $Lock as flag then toggle it rather than force it to 0 every time:
Func _Lock()
    $Lock = Not $Lock

    ; ...

EndFunc

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Drew

Thanks Psalty :). The suggestion worked out great, I don't know why I didn't think of it lol.

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  

×