idusy Posted June 28, 2007 Share Posted June 28, 2007 I'm making an "AutoSpammer", (Not for any particular use, just bored and trying to learn more about AutoIt) and for whatever reason, the "If" function doesn't seem to be working properly in it. This is the AutoSpammer scriptexpandcollapse popupHotKeySet("{ESC}","Close") GUICreate("AS",130,145) GUISetState() $Say=GUICtrlCreateInput("What to say",20,10,90) $Duration=GUICtrlCreateInput("How long (MS)",20,40,90) $Wait=GUICtrlCreateInput("How often (MS)",20,70,90) $Confirm=GUICtrlCreateButton("OK",20,100,35) $Close=GUICtrlCreateButton("Cancel",60,100,50) While 1 $msg = GUIGetMsg() Select Case $msg = $Confirm $ReadSay=GUICtrlRead($Say) $ReadWait=GUICtrlRead($Wait) $ReadDuration=GUICtrlRead($Duration) GUIDelete() $Init=TimerInit() While 1 $Diff=Int(TimerDiff($Init)) If $Diff < $ReadDuration + 10 And $Diff > $ReadDuration - 10 Then ;Area of issue MsgBox(0,"AS","Done spamming.") Exit Else Sleep($ReadWait) Send($ReadSay) EndIf WEnd Case $msg = $Close Exit EndSelect sleep(1) WEnd Func Close() Exit EndFuncoÝ÷ Ù8^ªê-!ú®¢Ùh¢§ªç¬¶*'jëh×6If $Diff < $ReadDuration + 10 And $Diff > $ReadDuration - 10 Then ;Area of issue MsgBox(0,"AS","Done spamming.") Exit Else Sleep($ReadWait) Send($ReadSay) EndIfoÝ÷ Øek'Â+aÛh±ç°«mêk¡¹^¬jwm+0¢¹,~)Þjëh×6If $Diff < $ReadDuration + 10 And $Diff > $ReadDuration - 10 Then MsgBox(0,"",$Diff & @CRLF & $ReadDuration & @CRLF & $ReadDuration + 10 & @CRLF & $ReadDuration - 10) Exit Else ToolTip($Diff) EndIfoÝ÷ رø«²Ûay"r¥u·jëu¼ê®¢Ô¥yêjº_ºw-ÜjY^w)⵻¥x±ø«²Ù)àÒÛaÆ®¶sdbb33c´FfbfÇC²SæBb33c´FfbfwC²CFVà¤W@¤VÇ6P 6ÆVWb33cµ&VEvB 6VæBb33cµ&VE6¤VæDAnd that too worked fine, however, the orginal script still won't stop spamming after the time given. For the life of me, I can't figure it out Link to comment Share on other sites More sharing options...
MisterBates Posted June 28, 2007 Share Posted June 28, 2007 The way it's coded at the moment, you have a 20 millisecond window within which the condition will be true (and the spamming stopped). Why? Seems complicated ... could you not just use the following to stop your code? If $Diff > $ReadDuration Then [u]MisterBates[/u]_____________________________________________________Suspend/Resume Windows ScreensaverWatchWindows - Window watcher/loggerUDF: Click systray menu/submenu itemsUDF: Outlook Express Folder/Message handling (+ example code)HowTo: Multiple icons in one compiled script Link to comment Share on other sites More sharing options...
idusy Posted June 28, 2007 Author Share Posted June 28, 2007 (edited) The way it's coded at the moment, you have a 20 millisecond window within which the condition will be true (and the spamming stopped). Why? Seems complicated ... could you not just use the following to stop your code? If $Diff > $ReadDuration Then Bleh, that does make more sense. I was making this at about 3AM... Thanks a ton, would have bugged me forever. By the way, the reason I did that was because if I just had it = it would sometimes overshoot it, so my blurred logic said to do that. Edited June 28, 2007 by idusy 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