WTS Posted July 1, 2006 Share Posted July 1, 2006 (edited) #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 622, 447, 194, 152) GUISetState(@SW_SHOW) While 1 $WinPos = WinGetPos($Form1) $MousePos = MouseGetPos() If $MousePos[0] <> $WinPos[0] Or $MousePos[1] <> $WinPos[1] Then NotOnGui() $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Exit Func NotOnGui() Msgbox(0,'Not','Out of pos') EndFunc Hello This code should detect if mouse move of the gui, then do a function.. what am I not doing right? Edited July 1, 2006 by WTS Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 1, 2006 Moderators Share Posted July 1, 2006 If $MousePos[0] < $WinPos[0] Or _ $MousePos[0] > $WinPos[0] + $WinPos[2] Or _ $MousePos[1] < $WinPos[1] Or _ $MousePos[1] > $WinPos[1] + $WinPos[3] Then NotOnGui() Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
WTS Posted July 1, 2006 Author Share Posted July 1, 2006 Thanks! Do you know how to implement a timer function? lets say I move the mouse off the gui, it counts down lets say for 3 seconds and then does NotOnGui, but the count down resets if I have the mouse back on the GUI before it reaches 3 seconds.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 1, 2006 Moderators Share Posted July 1, 2006 Thanks! Do you know how to implement a timer function? lets say I move the mouse off the gui, it counts down lets say for 3 seconds and then does NotOnGui, but the count down resets if I have the mouse back on the GUI before it reaches 3 seconds..Yes... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 1, 2006 Moderators Share Posted July 1, 2006 Well that was no fun, you asked if I knew how, I said yes, and you left it alone :yawn:#include <GUIConstants.au3> Global $TimerStart = 0 $Form1 = GUICreate("AForm1", 622, 447, 194, 152) GUISetState(@SW_SHOW) While 1 Local $WinPos = WinGetPos($Form1) Local $MousePos = MouseGetPos() $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect If $MousePos[0] < $WinPos[0] Or _ $MousePos[0] > $WinPos[0] + $WinPos[2] Or _ $MousePos[1] < $WinPos[1] Or _ $MousePos[1] > $WinPos[1] + $WinPos[3] Then If $TimerStart == 0 Then $TimerStart = TimerInit() NotOnGui(3) Else $TimerStart = 0 EndIf Sleep(10) WEnd Exit Func NotOnGui($TimeLapse) If TimerDiff($TimerStart) / 1000 >= $TimeLapse Then MsgBox(64, 'Info:', 'You were outside the GUI for ' & $TimeLapse & ' seconds or more.') EndIf EndFuncIs one way... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
gamepin126 Posted July 1, 2006 Share Posted July 1, 2006 SmOke_N, you're crazy. Thanks I needed that. Link to comment Share on other sites More sharing options...
WTS Posted July 1, 2006 Author Share Posted July 1, 2006 sorry.. I was busy watching my sister, thanks again.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 1, 2006 Moderators Share Posted July 1, 2006 sorry.. I was busy watching my sister, thanks again..Hmmm Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Vicks Posted July 1, 2006 Share Posted July 1, 2006 sorry.. I was busy watching my sister, thanks again..LOL doing what [s]Autoit[/s] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now