AoRaToS Posted August 29, 2008 Posted August 29, 2008 If you've used Windows Live Messenger then you know it limits the nudges you can send, I'm making something similar and I want to limit it to run also once in 10 seconds...I can't seem to be able to do it though :/ Func Nudge() $Windowmove = 0 $Windowcoord = WinGetPos (@GUI_WINHANDLE, "") If _Timer_Diff($Nudgetime) > 10000 Then For $Windowmove = 1 to 15 WinMove(@GUI_WINHANDLE, "", $Windowcoord[0]-1, $Windowcoord[1]-1, Default, Default,100) WinMove(@GUI_WINHANDLE, "", $Windowcoord[0], $Windowcoord[1], Default, Default,100) Next $Nudgetime = _Timer_Init() Else MsgBox(0,"Don't nudge so often","You can only nudge once every 10 seconds") EndIf EndFunc s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3
LongBowNZ Posted August 29, 2008 Posted August 29, 2008 I thought I couldn't do it but here it is: expandcollapse popup#include <GUIConstantsEx.au3> #include <Timers.au3> $firstnudge = 1 $Nudgetime = 0 #region - GUI Create $hWnd = GUICreate('test') $button = GUICtrlCreateButton('Nudge', 1, 1) GUISetState() #endregion #region - GUI SelectLoop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button Nudge() EndSelect WEnd #endregion Func Nudge() $firstnudge = 0 $Windowmove = 0 $Windowcoord = WinGetPos ($hWnd, "") If $firstnudge = 1 OR _Timer_Diff($Nudgetime) > 10000 Then For $Windowmove = 1 to 15 WinMove($hWnd, "", $Windowcoord[0]-1, $Windowcoord[1]-1, Default, Default,100) WinMove($hWnd, "", $Windowcoord[0], $Windowcoord[1], Default, Default,100) Next $Nudgetime = _Timer_Init() Else MsgBox(0,"Don't nudge so often","You can only nudge once every 10 seconds") EndIf EndFunc
AoRaToS Posted August 29, 2008 Author Posted August 29, 2008 Works like a charm, I'll post my greatly improved LAN messenger soon...Thanks allot LongBowNZ!!! s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3
LongBowNZ Posted August 29, 2008 Posted August 29, 2008 No Problem I seriously thought I wasn't going to be able to do it but after about 10 minutes of brain-crunching I did it. So you get something and I learned something. Fair trade, me thinks
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