Jump to content

Recommended Posts

I need a script that I can run when I leave my computer, that will freeze the mouse until I press F8 (I have the code for that i think)

HotKeySet("F8", "stop")

Func stop()
exit
endfunc

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to post
Share on other sites

didn't work...

HotKeySet("F8", "stop")

Func _MouseTrap($i_left = 0, $i_top = 0, $i_right = 0, $i_bottom = 0)
    Local $av_ret
    If @NumParams == 0 Then
        $av_ret = DllCall("user32.dll", "int", "ClipCursor", "int", 0)
    Else
        If @NumParams == 2 Then
            $i_right = $i_left + 1
            $i_bottom = $i_top + 1
        EndIf
        Local $Rect = DllStructCreate("int;int;int;int")
        If @error Then Return 0
        DllStructSetData($Rect, 1, $i_left)
        DllStructSetData($Rect, 2, $i_top)
        DllStructSetData($Rect, 3, $i_right)
        DllStructSetData($Rect, 4, $i_bottom)
        $av_ret = DllCall("user32.dll", "int", "ClipCursor", "ptr", DllStructGetPtr($Rect))
        DllStructDelete($Rect)
    EndIf
    Return $av_ret[0]
EndFunc  ;==>_MouseTrap

Func stop()
exit
endfunc

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to post
Share on other sites

didn't work...

HotKeySet("F8", "stop")

Func _MouseTrap($i_left = 0, $i_top = 0, $i_right = 0, $i_bottom = 0)
    Local $av_ret
    If @NumParams == 0 Then
        $av_ret = DllCall("user32.dll", "int", "ClipCursor", "int", 0)
    Else
        If @NumParams == 2 Then
            $i_right = $i_left + 1
            $i_bottom = $i_top + 1
        EndIf
        Local $Rect = DllStructCreate("int;int;int;int")
        If @error Then Return 0
        DllStructSetData($Rect, 1, $i_left)
        DllStructSetData($Rect, 2, $i_top)
        DllStructSetData($Rect, 3, $i_right)
        DllStructSetData($Rect, 4, $i_bottom)
        $av_ret = DllCall("user32.dll", "int", "ClipCursor", "ptr", DllStructGetPtr($Rect))
        DllStructDelete($Rect)
    EndIf
    Return $av_ret[0]
EndFunc;==>_MouseTrap

Func stop()
exit
endfunc
uhm you just put the function there and hoped it started??

Try this

First include misc.au3 then call the function see example

#include <misc.au3>

HotKeySet("{Esc}", "stop")

_MouseTrap(1,1,1,1)
while 1
  sleep(2000); 2 seconds to not suck up cpu
wend


Func stop()
_MouseTrap()
exit
endfunc
Edited by MrSpacely
Link to post
Share on other sites

ya, I was reading the description again, and I saw it needed other things...so I fixed it right when you posted, but thanks

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to post
Share on other sites

but 1 problem, I did a test because I was using the script while I was away (Yes, already...) and my screen saver activated, then when i came back it stopped working, so when ever my screensaver activates the mouse can move again, how do I fix this?

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to post
Share on other sites

but 1 problem, I did a test because I was using the script while I was away (Yes, already...) and my screen saver activated, then when i came back it stopped working, so when ever my screensaver activates the mouse can move again, how do I fix this?

You could change the while loop so it calls the mousetrap every few seconds

like

while 1

sleep(5000)

_mousetrap(1,1,1,1)

wend

maybe that works

Link to post
Share on other sites

thanks it worked great! (You can't even turn off screensaver without pressing the off button)

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to post
Share on other sites

I'm the other user on this computer, but there are other people in the house. (They have other computers)

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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

    No registered users viewing this page.

×
×
  • Create New...