KingYoshi Posted July 4, 2011 Posted July 4, 2011 (edited) I have not used Autoit in years, and am currently working on a small program for a friend, that will automatically spam a few specific messages. The Goal: #1 The program uses a random integer between 1 and 5 for SendKeyDelay and SendKeyDownDelay, so that there is more randomization in key presses when sending messages. #2 The program is to send the message using the randomized keypress times, and will use new timings for each message (I wish I could randomize the key presses for every single keypress within the message, but I do not know of a simple and non tedious way of doing this) #3 The Program will pause when [Pause] is hit and Exit when [Esc] is hit. The Problem: I keep getting a Syntax error with my current code, and am unsure of what is causing this. Error as shown by SyntaxCheckProd ; Random sendkeydelay Source Code: ; Press Esc to terminate script ; Press Pause to pause the script ; Random sendkeydelay Global $UnPaused, $keypause HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While 1 Sleep(100) ToolTip("Paused",0,0) WEnd Func TogglePause() $UnPaused = NOT $UnPaused While $UnPaused ToolTip("Sending...",0,0) $keypause = Random(1, 5, 1) AutoItSetOption("SendKeyDelay", $keypause) $keypause = Random(1, 5, 1) AutoItSetOption("SendKeyDownDelay", $keypause) Send("{Enter}/1 Test {Enter}") ;Insert copies HERE of above 5 lines for more messages WEnd EndFunc Func Terminate() Exit 0 Thank you for any and all help/suggestions. Edited July 4, 2011 by KingYoshi
monoscout999 Posted July 4, 2011 Posted July 4, 2011 (edited) It runs fine to me i only add the endfunc line at the end. >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "G:\Agustin\autoit\textout func.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams +>00:13:12 Starting AutoIt3Wrapper v.2.0.3.0 Environment(Language:0C0A Keyboard:0000040A OS:WIN_7/ CPU:X64 OS:X64) >Running AU3Check (1.54.19.0) from:C:\Program Files (x86)\AutoIt3 +>00:13:13 AU3Check ended.rc:0 >Running:(3.3.6.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "G:\Agustin\autoit\textout func.au3" /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test /1 Test Edited July 4, 2011 by monoscout999
KingYoshi Posted July 4, 2011 Author Posted July 4, 2011 (edited) Well I feel very stupid.. I just was missing a EndFunc. However I would still like to know if there is a decent way of randomizing SendKeyDelay and SendKeyDownDelay for every single key pressed in the message. Updated Source: ; Press Esc to terminate script ; Press Pause to pause the script ; Random sendkeydelay Global $UnPaused, $keypause,$delay HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While 1 Sleep(100) ToolTip("Paused",0,0) WEnd Func TogglePause() $UnPaused = NOT $UnPaused While $UnPaused ToolTip("Sending...",0,0) $keypause = Random(1, 5, 1) AutoItSetOption("SendKeyDelay", $keypause) $keypause = Random(1, 5, 1) AutoItSetOption("SendKeyDownDelay", $keypause) Send("{Enter}/1 Test {Enter}") $Delay = Random(5000, 10000, 1) Sleep($Delay) ;Insert copies HERE of above 5 lines for more messages WEnd EndFunc Func Terminate() Exit 0 EndFunc Edited July 4, 2011 by KingYoshi
monoscout999 Posted July 4, 2011 Posted July 4, 2011 (edited) For the sendkeydelay you can send each key individualy and put a sleep(random(set the function)) between. Edited July 4, 2011 by monoscout999
KingYoshi Posted July 4, 2011 Author Posted July 4, 2011 There is no easier way of dong this? Also I want to do this also for each SendKeyDownDelay as well. Would I have to do each individual character separately as well?
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