Kyme Posted August 23, 2009 Share Posted August 23, 2009 (edited) hi all i want to make some tool but i need to do random() from 1 to 999 problem it is in if random it's for ex 20 i want to make it 020 all the time to be 3 numbers if random it's 1 to be 001 how i can make it? i try this one Random(1, 999, 1) but it's not all the time 3 numbers thank you waiting feedbacks Regards, kyme Edited August 23, 2009 by Kyme Link to comment Share on other sites More sharing options...
Yashied Posted August 23, 2009 Share Posted August 23, 2009 StringFormat('%03s', Random(1, 999, 1)) My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Bowmore Posted August 23, 2009 Share Posted August 23, 2009 hi all i want to make some tool but i need to do random() from 1 to 999 problem it is in if random it's for ex 20 i want to make it 020 all the time to be 3 numbers if random it's 1 to be 001 how i can make it? i try this one Random(1, 999, 1) but it's not all the time 3 numbers thank you waiting feedbacks Regards, kyme Try this $RandVal = StringFormat("%03i",Random(1, 999, 1)) "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Kyme Posted August 23, 2009 Author Share Posted August 23, 2009 StringFormat('%03s', Random(1, 999, 1)) thank you Regard's, kyme Link to comment Share on other sites More sharing options...
WolfWorld Posted August 23, 2009 Share Posted August 23, 2009 You should use Bowmore example (if it work, I did not tested it) Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
CodyBarrett Posted August 23, 2009 Share Posted August 23, 2009 whats the difference between yashied's and bowmore's? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
martin Posted August 23, 2009 Share Posted August 23, 2009 In terms of the result there is no difference. The Random function with a flag of 1 returns and integer, so technically you could say that the string format specifier should be "i" for an integer (or "d" which is the same thing) and not "s" which is for a string. In C this would be importatnt, in AutoIt it isn't. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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