Jump to content



Photo

LOOP problem can't exit


  • Please log in to reply
27 replies to this topic

#21 Reg2Post

Reg2Post

    Wayfarer

  • Active Members
  • Pip
  • 84 posts

Posted 13 April 2012 - 08:33 PM

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.





#22 CaptainClucks

CaptainClucks

    Unum Cavillator Spuria

  • Active Members
  • PipPipPipPipPipPip
  • 1,216 posts

Posted 13 April 2012 - 08:35 PM

why the hell did this thread catch fire so fast?

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

Edited by ApudAngelorum, 13 April 2012 - 08:35 PM.

Spoiler
Warning: Posts by this user are subject to change or may disappear without notice.

#23 EndFunc

EndFunc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 426 posts

Posted 13 April 2012 - 08:39 PM

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...?

Plain Text         
#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, 13 April 2012 - 08:41 PM.

EndFuncAutoIt is the shiznit. I love it.

#24 czardas

czardas

  • Active Members
  • PipPipPipPipPipPip
  • 5,060 posts

Posted 13 April 2012 - 09:25 PM

A few too many problems with the original script.. Anyway, after messing around with it a bit. The code's not perfect.
.
AutoIt         
#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, 13 April 2012 - 09:44 PM.


#25 DarkAnel

DarkAnel

    Seeker

  • Active Members
  • 23 posts

Posted 13 April 2012 - 09:33 PM

have you the solution czardas??

#26 czardas

czardas

  • Active Members
  • PipPipPipPipPipPip
  • 5,060 posts

Posted 13 April 2012 - 09:48 PM

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, 13 April 2012 - 10:08 PM.


#27 DarkAnel

DarkAnel

    Seeker

  • Active Members
  • 23 posts

Posted 13 April 2012 - 11:44 PM

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

#28 czardas

czardas

  • Active Members
  • PipPipPipPipPipPip
  • 5,060 posts

Posted 13 April 2012 - 11:44 PM

You're welcome.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users