Arclite86 1 Posted March 12, 2015 I have a script that has 5 inputs these inputs are filled with number from 1 to 5 so: input1 = 1 input2 = 2 input3 = 3 input4 = 4 input3 = 5 but I want it to shuffle the numbers like: input1 = 4 input2 = 1 input3 = 5 input4 = 2 input5= 3 I dont want to use the Random function because then there is a possibilty It will chose number with the same value, I need a number from 1 to 5 to be shown but in different order Share this post Link to post Share on other sites
JohnOne 1,598 Posted March 12, 2015 Get numbers into array in order -> _ArrayShuffle() -> put them back. Hide JohnOne's signature Hide all signatures AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
minxomat 87 Posted March 12, 2015 (edited) There's a function for that: _ArrayShuffle Edit: I've been defeated. Hands John a beer. Edited March 12, 2015 by minx Hide minxomat's signature Hide all signatures I will answer every single PM, and you are free to ask anything anytime. Share this post Link to post Share on other sites
libreau3 3 Posted March 12, 2015 (edited) Try using an array with the _ArrayShuffle() function then assigning each value to an input. to slow Edited March 12, 2015 by libreau3 Share this post Link to post Share on other sites
Arclite86 1 Posted March 13, 2015 I cant find the _ArrayShuffle() function is there a file that i need to instal before? if yes than what Share this post Link to post Share on other sites
water 2,163 Posted March 13, 2015 You need to include the Array UDF. Use #include <Array.au3> BTW: Which version of AutoIt do you run? Hide water's signature Hide all signatures My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - WikiOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki Share this post Link to post Share on other sites
Arclite86 1 Posted March 14, 2015 You need to include the Array UDF. Use #include <Array.au3> BTW: Which version of AutoIt do you run? i did , but maybe its an old version could you give me a link to the latest function script Share this post Link to post Share on other sites
jchd 1,285 Posted March 14, 2015 Your best bet is always to use a current release (or beta if you want) of the complete official AutoIt distribution. You find it like all of us mere mortals, in the dedicated download section. Hide jchd's signature Hide all signatures This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Share this post Link to post Share on other sites
Arclite86 1 Posted March 14, 2015 I downloaded the latest beta version but still the _ArrayShuffle() turns black and unrecognisable this is a screenshot Share this post Link to post Share on other sites
water 2,163 Posted March 14, 2015 You need to check the help file! Set the cursor on _ArrayShuffle and press F1. Hide water's signature Hide all signatures My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - WikiOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki Share this post Link to post Share on other sites
Arclite86 1 Posted March 14, 2015 (edited) nothing happens Edited March 14, 2015 by Arclite86 Share this post Link to post Share on other sites
water 2,163 Posted March 14, 2015 As you can see you run an old version of Autoit (3.3.10.2). Upgrade to the latest production version (3.3.12.0) and the problem goes away. Hide water's signature Hide all signatures My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - WikiOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki Share this post Link to post Share on other sites
Arclite86 1 Posted March 14, 2015 aaa thank you that was it, thank you Water Share this post Link to post Share on other sites
water 2,163 Posted March 14, 2015 I guess you downloaded and installed the latest beta. But to run a script with a beta version you need to press Alt+F5 ind SciTE. Just pressing F5 executes the script using the installed production version. Means: You can have a production and a beta version installed in parallel. Hide water's signature Hide all signatures My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - WikiOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki Share this post Link to post Share on other sites
Arclite86 1 Posted March 16, 2015 (edited) sorry for asking but I just cant figure out how to get the number from a array to an input, this is what i tried Local $aArray_Base[16] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15] Local $aArray = $aArray_Base _ArrayShuffle($aArray) _ArrayDisplay($aArray, "1D - Shuffled", Default, 16) $aArray = 1 $readfrom = _FileReadToArray(, $aArray, 1) GUICtrlSetData($input1,$readfrom) Edited March 16, 2015 by Arclite86 Share this post Link to post Share on other sites
Geir1983 20 Posted March 16, 2015 (edited) You need to specify wich element in the array: Local $aArray_Base[16] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15] Local $aArray = $aArray_Base _ArrayShuffle($aArray) _ArrayDisplay($aArray, "1D - Shuffled", Default, 16) GUICtrlSetData($input1,$aArray[0]) Edited March 16, 2015 by Geir1983 Share this post Link to post Share on other sites
Melba23 3,080 Posted March 16, 2015 Arclite86,Just loop through the array like this: #include <GUIConstantsEx.au3> #include <Array.au3> Local $aArray_Base[16] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15] Local $aArray = $aArray_Base _ArrayShuffle($aArray) $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput("", 10, 10, 200, 40) GUICtrlSetFont($cInput, 24) GUISetState() For $i = 0 To 15 GUICtrlSetData($cInput, $aArray[$i]) Sleep(500) Next ExitM23 Hide Melba23's signature Hide all signatures Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
jguinch 404 Posted March 16, 2015 Try with _ArrayToString : Local $sShuffle = _ArrayToString($aArray, @CRLF) GUICtrlSetData($input1, $sShuffle) Hide jguinch's signature Hide all signatures Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Share this post Link to post Share on other sites
Arclite86 1 Posted March 22, 2015 (edited) i dont understand this one: it misses one number: expandcollapse popup#Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Form1", 477, 291, 293, 182) $Input1 = GUICtrlCreateInput("Input1", 0, 64, 41, 21) $Input2 = GUICtrlCreateInput("Input2", 0, 88, 41, 21) $Input3 = GUICtrlCreateInput("Input3", 0, 112, 41, 21) $Input4 = GUICtrlCreateInput("Input4", 0, 136, 41, 21) $Input5 = GUICtrlCreateInput("Input5", 0, 160, 41, 21) $Input6 = GUICtrlCreateInput("Input6", 0, 184, 41, 21) Local $aArray_Base[6] = [ 1, 2, 3, 4, 5, 6] Local $aArray = $aArray_Base _ArrayShuffle($aArray) GUISetState() For $i = 1 To 1 GUICtrlSetData($Input1, $aArray[$i]) sleep(500) Next For $i = 2 To 2 GUICtrlSetData($Input2, $aArray[$i]) sleep(500) Next For $i = 3 To 3 GUICtrlSetData($Input3, $aArray[$i]) sleep(500) Next For $i = 4 To 4 GUICtrlSetData($Input4, $aArray[$i]) sleep(500) Next For $i = 5 To 5 GUICtrlSetData($Input5, $aArray[$i]) sleep(500) Next For $i = 6 To 6 GUICtrlSetData($Input6, $aArray[$i]) sleep(500) Next For $i = 7 To 7 GUICtrlSetData($Input6, $aArray[$i]) sleep(500) Next Edited March 22, 2015 by Arclite86 Share this post Link to post Share on other sites
mikell 889 Posted March 22, 2015 Much easier if you store your input ids into an array #Include <Array.au3> Local $inputs[6] $Form1_1 = GUICreate("Form1", 477, 291, 293, 182) $Inputs[0] = GUICtrlCreateInput("Input1", 0, 64, 41, 21) $Inputs[1] = GUICtrlCreateInput("Input2", 0, 88, 41, 21) $Inputs[2] = GUICtrlCreateInput("Input3", 0, 112, 41, 21) $Inputs[3] = GUICtrlCreateInput("Input4", 0, 136, 41, 21) $Inputs[4] = GUICtrlCreateInput("Input5", 0, 160, 41, 21) $Inputs[5] = GUICtrlCreateInput("Input6", 0, 184, 41, 21) Local $aArray[6] = [ 1, 2, 3, 4, 5, 6] _ArrayShuffle($aArray) For $i = 0 To 5 GUICtrlSetData($Inputs[$i], $aArray[$i]) Next GUISetState() While 1 Sleep(10) Wend Share this post Link to post Share on other sites