Arclite86 Posted March 12, 2015 Share 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 Link to comment Share on other sites More sharing options...
JohnOne Posted March 12, 2015 Share Posted March 12, 2015 Get numbers into array in order -> _ArrayShuffle() -> put them back. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
minxomat Posted March 12, 2015 Share 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 I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
libreau3 Posted March 12, 2015 Share 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 Link to comment Share on other sites More sharing options...
Arclite86 Posted March 13, 2015 Author Share Posted March 13, 2015 I cant find the _ArrayShuffle() function is there a file that i need to instal before? if yes than what Link to comment Share on other sites More sharing options...
water Posted March 13, 2015 Share Posted March 13, 2015 You need to include the Array UDF. Use #include <Array.au3> BTW: Which version of AutoIt do you run? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Arclite86 Posted March 14, 2015 Author Share 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 Link to comment Share on other sites More sharing options...
jchd Posted March 14, 2015 Share 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. 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) Link to comment Share on other sites More sharing options...
Arclite86 Posted March 14, 2015 Author Share Posted March 14, 2015 I downloaded the latest beta version but still the _ArrayShuffle() turns black and unrecognisable this is a screenshot Link to comment Share on other sites More sharing options...
water Posted March 14, 2015 Share Posted March 14, 2015 You need to check the help file! Set the cursor on _ArrayShuffle and press F1. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Arclite86 Posted March 14, 2015 Author Share Posted March 14, 2015 (edited) nothing happens Edited March 14, 2015 by Arclite86 Link to comment Share on other sites More sharing options...
water Posted March 14, 2015 Share 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. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Arclite86 Posted March 14, 2015 Author Share Posted March 14, 2015 aaa thank you that was it, thank you Water Link to comment Share on other sites More sharing options...
water Posted March 14, 2015 Share 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. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Arclite86 Posted March 16, 2015 Author Share 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 Link to comment Share on other sites More sharing options...
Geir1983 Posted March 16, 2015 Share 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 16, 2015 Moderators Share 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 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 Link to comment Share on other sites More sharing options...
jguinch Posted March 16, 2015 Share Posted March 16, 2015 Try with _ArrayToString : Local $sShuffle = _ArrayToString($aArray, @CRLF) GUICtrlSetData($input1, $sShuffle) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Arclite86 Posted March 22, 2015 Author Share 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 Link to comment Share on other sites More sharing options...
mikell Posted March 22, 2015 Share 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 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