Jump to content

Recommended Posts

Posted

BrewManNH: Yes, I do. And you can control GPOs if you are the AD/DC Admin. My point was to see if the OP knows what he is talking about because he wanted a button to simulate mouse movements while logged into what I would think is a RD session. EDIT: So now its Dameware.

@OP: Your english grammar went from decent to almost not understandable in 9 mins flat. First the script was for you and now it is for other "users."

Yeah. To each their own I will write this off as since this is not about how to push updates of unknown content to clients in a domain.

@EndFunc: I have screensaver locks disabled in remote sessions.

Posted (edited)

why the hell did this thread catch fire so fast?

It shouldn't have gone past 3-4 posts..

Edited by ApudAngelorum
Posted (edited)

this is one of the early scripts I made and still use today ;)

I have a machine I don't want to lock (and can't change the setting) so I have this script running 24/7 and works wonderfully.

Since the mouse only moves just enough to keep the pc from locking, it doesn't interfere with other stuff you are doing.

While 1
$pos = MouseGetPos()
$x = $pos[0]
$y = $pos[1]
If $x<1023/2 And $y<767/2 Then MouseMove($x + 5,$y + 5)
If $x>1023/2 And $y>767/2 Then MouseMove($x - 5,$y - 5)
If $x<1023/2 And $y>767/2 Then MouseMove($x + 5,$y - 5)
If $x>1023/2 And $y<767/2 Then MouseMove($x - 5,$y + 5)
Sleep(300000)
WEnd

thank you tho share you script it will work, but i will not the only one to use this script and its why i want a GUI to start and stop the script

(sorry for my bad english)

Why not just put your script and his together? Try this...?

#include <GUIConstantsEx.au3>
_Main()
Func _Main()
Local $filemenu, $fileitem, $recentfilesmenu
Local $exititem, $helpmenu, $aboutitem, $okbutton, $cancelbutton
Local $msg, $file
GUICreate("AntiSleep Script", 300, 150)
$filemenu = GUICtrlCreateMenu("File")
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
$helpmenu = GUICtrlCreateMenu("?")
$aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)
$okbutton = GUICtrlCreateButton("Start the AntiSleep Script", 50, 10, 200, 40)
$cancelbutton = GUICtrlCreateButton("Stop", 50, 60, 200, 40)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
ExitLoop
Case $msg = $exititem
ExitLoop
Case $msg = $okbutton
do
$pos = MouseGetPos()
$x = $pos[0]
$y = $pos[1]
If $x<1023/2 And $y<767/2 Then MouseMove($x + 5,$y + 5)
If $x>1023/2 And $y>767/2 Then MouseMove($x - 5,$y - 5)
If $x<1023/2 And $y>767/2 Then MouseMove($x + 5,$y - 5)
If $x>1023/2 And $y<767/2 Then MouseMove($x - 5,$y + 5)
Sleep(300000)
until $msg = $cancelbutton
Exit
Case $msg = $aboutitem
MsgBox(0, "About", "This Script was created by Eric Boudreau")
EndSelect
WEnd
GUIDelete()
Exit
EndFunc ;==>_Main

Not tested...

Edited by EndFunc
EndFuncAutoIt is the shiznit. I love it.
Posted (edited)

A few too many problems with the original script.. Anyway, after messing around with it a bit. The code's not perfect.

.

#include <GUIConstantsEx.au3>
_Main()
Func _Main()
    Local $filemenu, $fileitem, $recentfilesmenu
    Local $exititem, $helpmenu, $aboutitem, $okbutton, $cancelbutton
    Local $msg, $file
    GUICreate("AntiSleep Script", 300, 150)
    $filemenu = GUICtrlCreateMenu("File")
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    $helpmenu = GUICtrlCreateMenu("?")
    $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)
    $okbutton = GUICtrlCreateButton("Start the AntiSleep Script", 50, 10, 200, 40)
    $cancelbutton = GUICtrlCreateButton("Stop", 50, 60, 200, 40)
    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $exititem
            ExitLoop
        Case $msg = $aboutitem
            MsgBox(0, "About", "This Script was created by Eric Boudreau")
        Case $msg = $okbutton
        ; this is where my problem start
            $IStart = 0
            While 1
                $msg = GUIGetMsg()
                $iTimeDiff = TimerDiff($IStart)
                If $iTimeDiff > 8000 Then
                    MouseMove(600, 900)
                    $IStart = TimerInit()
                ElseIf $iTimeDiff > 4000 And $iTimeDiff < 4010  Then
                    MouseMove(800, 900)
                ElseIf $msg = $cancelbutton Then
                    ExitLoop
                EndIf
            WEnd
        EndSelect
    WEnd
    ;GUIDelete()
    ;Exit
EndFunc ;==>_Main
Edited by czardas
Posted (edited)

have you the solution czardas??

Sort of. I just edited the code a little. It should be working now. It's not the only possible solution.

One of the problems with your first script was the line where it says until $msg = $cancelbutton because $msg was already $okbutton. That would never have changed inside your loop. I also replaced the sleep function with TimerInit and TimerDiff. I have found that using sleep makes GUIs unresponsive.

There is a 10 millisecond window in the following line.

ElseIf $iTimeDiff > 4000 And $iTimeDiff < 4010 Then

You can change this to 100 milliseconds if you wish.

Edited by czardas
Posted

Sort of. I just edited the code a little. It should be working now. It's not the only possible solution.

One of the problems with your first script was the line where it says until $msg = $cancelbutton because $msg was already $okbutton. That would never have changed inside your loop. I also replaced the sleep function with TimerInit and TimerDiff. I have found that using sleep makes GUIs unresponsive.

There is a 10 millisecond window in the following line.

ElseIf $iTimeDiff > 4000 And $iTimeDiff < 4010 Then

You can change this to 100 milliseconds if you wish.

Nice one !!! a thousand thanks, i didn't know about the sleep function problem in a GUI. The script run like a charm thank you again

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
×
×
  • Create New...