Kanske Posted June 8, 2012 Share Posted June 8, 2012 I have a loop, and within it I have the following script to output a random number between 9000 and 12500: Send(Random(9000, 12500, 1)) Send("{ENTER}") Everything works fine, except it doesn't recognize the minimum number. As such, it prints out any number between 1 and 12500. It created the following sample output: 1268 1367 1211 9885 11177 1326 169 11912 12239 157 947 What did I do wrong and what should I do instead? Link to comment Share on other sites More sharing options...
water Posted June 8, 2012 Share Posted June 8, 2012 If I test your code it works as expected: For $i = 1 To 10 ConsoleWrite(Random(9000, 12500, 1) & @LF) NextWhat version of AutoIt do you use? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Kanske Posted June 8, 2012 Author Share Posted June 8, 2012 If I test your code it works as expected: For $i = 1 To 10 ConsoleWrite(Random(9000, 12500, 1) & @LF) NextWhat version of AutoIt do you use? SciTE-Lite Version 2.28 Jan 29 2012 21:33:22 Link to comment Share on other sites More sharing options...
water Posted June 8, 2012 Share Posted June 8, 2012 I didn't ask for the SciTE version but for the AutoIt version. Please run this code: Consolewrite(@AutoItVersion & @CRLF) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Kanske Posted June 8, 2012 Author Share Posted June 8, 2012 I didn't ask for the SciTE version but for the AutoIt version. Please run this code: Consolewrite(@AutoItVersion & @CRLF) I apologize, I thought they were interlinked and thus the version would show up where it usually does (about). The version output was 3.3.8.1 Link to comment Share on other sites More sharing options...
water Posted June 8, 2012 Share Posted June 8, 2012 Could you run the script I posted in So we can see if the problem is related to the Random function or to the program you send the output to. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Kanske Posted June 9, 2012 Author Share Posted June 9, 2012 (edited) Could you run the script I posted in So we can see if the problem is related to the Random function or to the program you send the output to.I've tested yours and it works. However, if I replace Consolewrite with Send in your script, it stops working correctly. The active program it was sending to was both Notepad++ and the SciTE4AutoIt3 script window.Looking through it again, I think I understand what was causing it now. As I had the button 0 binded to start the script, the random function stripped out all zeros. Changing the start button did resolve the issue. Wasn't entirely obvious to me as it is the first time I use the program, but with your help I could pin point it down. Thank you! Edited June 9, 2012 by Kanske 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