Jump to content

_WindowLock Question


Drew
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

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