computergroove Posted May 8, 2014 Share Posted May 8, 2014 (edited) I have a list of barcodes that when scanned will play a video file. I pull the barcodes and video names from an ini file. Videos.ini example Barcode=video file 12345=video1.mpg 23456=video2.mpg 34567=video3.mpg I want the script to read the contents of Videos.ini and create RandomizeTemp.ini and shuffle the data from Videos.ini and write to RAndomizeTemp.ini and then play each file until the end of the list. When the list is done I want to reshuffle the list and then play them all again. Here's what I have so far Func CreateRandomTemp() $Temp = FileRead("Videos.ini");Reads the Videos.ini file and places everything in $Temp How do I randomize the order of each line stored in $Temp and then lose the "barcode=" and then write the data to RandomizeTemp.ini? Edited May 8, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
jdelaney Posted May 8, 2014 Share Posted May 8, 2014 Use the INI* functions (returns array). I'm fairly sure there is an array randomizer in the example forums. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 8, 2014 Moderators Share Posted May 8, 2014 computergroove,Use the IniReadSection function to get the ini content into an array. If you use the latest Beta that you can now use the _ArrayShuffle function to randomize the array, after which IniWriteSection will write this array to the new ini file. If you do not have the latest Beta, let me know and I will post the shuffle code for you to use as a stand-alone function. M23 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...
Bert Posted May 8, 2014 Share Posted May 8, 2014 create a 3D array 1D you will use the Random command to shuffle. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted May 8, 2014 Share Posted May 8, 2014 computergroove, Use the IniReadSection function to get the ini content into an array. If you use the latest Beta that you can now use the _ArrayShuffle function to randomize the array, after which IniWriteSection will write this array to the new ini file. If you do not have the latest Beta, let me know and I will post the shuffle code for you to use as a stand-alone function. M23 better than what I thought of The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 computergroove, Use the IniReadSection function to get the ini content into an array. If you use the latest Beta that you can now use the _ArrayShuffle function to randomize the array, after which IniWriteSection will write this array to the new ini file. If you do not have the latest Beta, let me know and I will post the shuffle code for you to use as a stand-alone function. M23 I have Version 3.4.1 Mar 30 2014 21:57:28. Not sure if it is latest beta build but I installed it today. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 8, 2014 Moderators Share Posted May 8, 2014 computergroove,That is the SciTE version - this will tell you which AutoIt version you have (Probably 3.3.10.2): ConsoleWrite(@AutoItVersion & @CRLF)M23 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...
BrewManNH Posted May 8, 2014 Share Posted May 8, 2014 Just an FYI, INI files may not be the best way of doing this because the order of items in a section isn't going change if you rewrite the section. You would have to delete the RandomizeTemp.ini file before writing the contents of the section again otherwise they'll be in the same order they were in the first time you wrote it. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 (edited) 3.3.10.2 Will this version work? Apparently not. I could not see _arrayShuffle in the array.au3 Edited May 8, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 Just an FYI, INI files may not be the best way of doing this because the order of items in a section isn't going change if you rewrite the section. You would have to delete the RandomizeTemp.ini file before writing the contents of the section again otherwise they'll be in the same order they were in the first time you wrote it. I was already planning on doing this. Thanks though. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 (edited) I just upgraded to the beta version (not really wanting to do that) and the array.au3 does not have a _arrayShuffle section. I also could not find a IniReadSection.au3. I'm a little lost. Please advise. Edited May 8, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 8, 2014 Moderators Share Posted May 8, 2014 (edited) computergroove,Here is the _ArrayShuffle function:expandcollapse popupFunc _ArrayShuffle(ByRef $avArray, $iStart_Row = 0, $iEnd_Row = 0, $iCol = -1) Local $UBOUND_DIMENSIONS = 0, $UBOUND_ROWS = 1, $UBOUND_COLUMNS = 2 ; Fisher–Yates algorithm If $iStart_Row = Default Then $iStart_Row = 0 If $iEnd_Row = Default Then $iEnd_Row = 0 If $iCol = Default Then $iCol = -1 If Not IsArray($avArray) Then Return SetError(1, 0, -1) Local $iDim_1 = UBound($avArray, $UBOUND_ROWS) If $iEnd_Row = 0 Then $iEnd_Row = $iDim_1 - 1 If $iStart_Row < 0 Or $iStart_Row > $iDim_1 - 1 Then Return SetError(3, 0, -1) If $iEnd_Row < 1 Or $iEnd_Row > $iDim_1 - 1 Then Return SetError(3, 0, -1) If $iStart_Row > $iEnd_Row Then Return SetError(4, 0, -1) Local $vTmp, $iRand Switch UBound($avArray, $UBOUND_DIMENSIONS) Case 1 For $i = $iEnd_Row To $iStart_Row + 1 Step -1 $iRand = Random($iStart_Row, $i, 1) $vTmp = $avArray[$i] $avArray[$i] = $avArray[$iRand] $avArray[$iRand] = $vTmp Next Return 1 Case 2 Local $iDim_2 = UBound($avArray, $UBOUND_COLUMNS) If $iCol < -1 Or $iCol > $iDim_2 - 1 Then Return SetError(5, 0, -1) Local $iCol_Start, $iCol_End If $iCol = -1 Then $iCol_Start = 0 $iCol_End = $iDim_2 - 1 Else $iCol_Start = $iCol $iCol_End = $iCol EndIf For $i = $iEnd_Row To $iStart_Row + 1 Step -1 $iRand = Random($iStart_Row, $i, 1) For $j = $iCol_Start To $iCol_End $vTmp = $avArray[$i][$j] $avArray[$i][$j] = $avArray[$iRand][$j] $avArray[$iRand][$j] = $vTmp Next Next Return 1 Case Else Return SetError(2, 0, -1) EndSwitch EndFunc ;==>_ArrayShuffleYou will need to set $iStart_Row to 1 as the [0] element is the count - you can ignore the final 2 parameters as the default values are what you need. As BrewManNH mentioned, you will need to delete the whole ini file before rewriting - or at least the relevant section using IniDelete. M23Edit: I just upgraded to the beta version (not really wanting to do that) and the array.au3 does not have a _arrayShuffle sectionIt most certainly does because that is from where I have just copied the above code. And IniReadSection is a core function, not a UDF. Edited May 8, 2014 by Melba23 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...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 (edited) This is what I am trying $Temp = FileRead("Videos.ini") $RandomizeTemp = _ArrayShuffle($Temp,0) FileWrite("RandomizeTemp.ini",$RandomizeTemp); reads Videos.ini and populates $Temp with the data MsgBox(0,"RandomizeTemp",$RandomizeTemp,0) What it does is outputs -1 in teh msgbox. It also adds a -1 to the end of the last line of the Videos.ini file. What am I missing? And if I dont manually add the _ArrayShuffle function to the beta build posted on the website then the compiler complains about _ArrayShuffle as an unidentified function. Edited May 8, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
BrewManNH Posted May 8, 2014 Share Posted May 8, 2014 You need to use the INI functions, NOT the File functions. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
UEZ Posted May 8, 2014 Share Posted May 8, 2014 If you don't have sections defined than your ini file is not a real ini. Example ini [Version] <--- section name is always in square brackets beta=v3.3.11.5 <--- key and its value Production=v3.3.10.2 <--- key and its value ... If so than you can simply use file functions. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 You need to use the INI functions, NOT the File functions. Not 100% sure what you mean. I used iniReadSection and IniWrite and I added a [Videos] section to my RandomizeTemp.ini (I wish this weren't necessary) but this is what I have tried $Temp = IniReadSection("Videos.ini","videos") $Shuffle = _ArrayShuffle($Temp,1) IniWriteSection("RandomizeTemp.ini","Videos",$Shuffle); reads Videos.ini and populates $Temp with the data MsgBox(0,"RandomizeTemp",$Shuffle,0) It outputs a 1 in the msgbox and no longer writes the 1 to RandomizeTemp. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 If you don't have sections defined than your ini file is not a real ini. Example ini [Version] <--- section name is always in square brackets beta=v3.3.11.5 <--- key and its value Production=v3.3.10.2 <--- key and its value ... If so than you can simply use file functions. Br, UEZ That's what I want to do. Why was / am I getting a 1 ort a -1 as an output to the iniread and fileread functions? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 (edited) OK I've narrowed it down to the second line $Temp = FileRead("Videos.ini") $Shuffle = _ArrayShuffle($Temp,0) ;FileWrite("RandomizeTemp.ini",$RandomizeTemp); reads Videos.ini and populates $Temp with the data MsgBox(0,"RandomizeTemp",$Shuffle) $Shuffle = _ArrayShuffle($Temp,0) This line is what is producing the -1 or 1 depending on what I am doing. What am I doing wrong? Edited May 8, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
UEZ Posted May 8, 2014 Share Posted May 8, 2014 (edited) Try this:expandcollapse popup#include <Array.au3> CreateRandomTemp() Func CreateRandomTemp() Local $2D_Array = StringSplitW(FileRead(@ScriptDir & "\Video.ini"), "=") ;~ _ArrayDisplay($2D_Array) Shuffle_Array($2D_Array) ;~ _ArrayDisplay($2D_Array) Local $hFile = FileOpen(@ScriptDir & "\RandomizeTemp.ini", 2) FileWrite($hFile, _Array2DToString($2D_Array, "=")) FileClose($hFile) EndFunc Func _Array2DToString($array, $sDelimiter = ";") ;coded by UEZ 2014 If Not IsArray($array) Then Return SetError(1, 0, 0) If UBound($array, 0) > 2 Then Return SetError(2, 0, 0) ;up to 2D arrays only Local $iW, $iH, $sString For $iH = 0 To UBound($array) - 1 For $iW = 0 To UBound($array, 2) - 1 $sString &= $array[$iH][$iW] & $sDelimiter Next $sString = ($iH < UBound($array) - 1) ? StringTrimRight($sString, 1) & @CRLF : StringTrimRight($sString, 1) Next Return $sString EndFunc ; #FUNCTION# ======================================================================================================================================== ; Name .................: StringSplitW() ; Description ..........: Splits a string into columns instead of rows as it is done by SplitString(), like a csv file to a 2d array ;-) ; Syntax ...............: StringSplitW($sString, $sDelimiter, $iWidthLen) ; Parameters ...........: $sString - string to split ; $sDelimiter - [optional] the delimter how to split the string ; $iWidthLen - [optional] length of the row (amount of columns - default is 100) ; Return values .......: Success - 2d array ; Error 1 - either $sString or $delimter is not set ; Error 2 - array width exceeded ; Error 3 - error splitting string ; ; Version .............: v0.93 build 2013-08-23 beta ; Author ..............: UEZ ; Modified ............: ; Remarks .............: ; Related .............: StringSplit() ; =================================================================================================================================================== Func StringSplitW($sString, $sDelimiter = ";", $iWidthLen = 256) If $sString = "" Or $sDelimiter = "" Then Return SetError(1, 0, 0) Local $chk, $iWidth, $i, $j, $k, $iLen, $iMax = 1, $iMaxWidth Local $aPos[1], $l = 0 Local $aSplit = StringSplit(StringStripCR($sString), @LF) If @error Then Return SetError(3, 0, 0) Local $aVertical[$aSplit[0]][$iWidthLen], $iDelimiterLen = StringLen($sDelimiter) - 1 For $k = 1 To $aSplit[0] $iLen = StringLen($aSplit[$k]) If $iLen > 1 Then $chk = StringReplace($aSplit[$k], $sDelimiter, $sDelimiter) $iWidth = @extended If $iWidth > $iWidthLen Then Return SetError(2, 0, 0) If $iWidth >= $iMax Then $iMax = $iWidth + 1 Switch $iWidth Case 0 $aVertical[$l][0] = $aSplit[$k] Case Else Dim $aPos[$iWidth * 2 + 2] $j = 1 $aPos[0] = 1 For $i = 0 To $iWidth - 1 $aPos[$j] = StringInStr($aSplit[$k], $sDelimiter, 0, $i + 1) - 1 $aPos[$j + 1] = $aPos[$j] + 2 + $iDelimiterLen $j += 2 Next $aPos[UBound($aPos) - 1] = StringLen($aSplit[$k]) $j = 0 For $i = 0 To UBound($aPos) - 1 Step 2 $aVertical[$l][$j] = StringMid($aSplit[$k], $aPos[$i], $aPos[$i + 1] - $aPos[$i] + 1) $j += 1 Next EndSwitch $l += 1 EndIf Next ReDim $aVertical[$l][$iMax] Return $aVertical EndFunc ; #FUNCTION# ====================================================================================== ; Name ................: Shuffle_Array() ; Version .............: v0.50 build 2011-05-24 beta ; Description .......: Shuffles an array - support 1D and 2D arrays only ; Syntax ..............: Shuffle_Array(ByRef $array, $startindex = 0, $endindex = 0) ; Parameters ........: $array - the array to shuffle ; $startindex = from which index to start the shuffling ; $endindex = to which index to start the shuffling; 0 means last index of the array ; Return values ....: True ; Failure 1 - $array is not an array ; Failure 2 - array has more than 2 dimensions ; Failure 3 - array is empty ; Failure 4 - $startindex / $endindex are set wrongly ; Author ..............: UEZ ; Modified ............: ; Remarks ............: ; Related ..............: Array ; ================================================================================================= Func Shuffle_Array(ByRef $array, $startindex = 0, $endindex = 0) If Not IsArray($array) Then Return SetError(1, 0, 0) If UBound($array, 0) > 2 Then Return SetError(2, 0, 0) If UBound($array) = 1 Then Return SetError(3, 0, 0) Local $u1 If Not $endindex Then $u1 = UBound($array) - 1 Else If $endindex > $startindex And $endindex < UBound($array) Then $u1 = $endindex Else Return SetError(4, 0, 0) EndIf EndIf If UBound($array, 2) Then Local $aSwap[1][UBound($array, 2)], $u2 = UBound($array, 2) - 1 Local $i, $j, $r For $i = $startindex To $u1 $r = Random($startindex, $u1, 1) For $j = 0 To $u2 $aSwap[0][$j] = $array[$i][$j] $array[$i][$j] = $array[$r][$j] $array[$r][$j] = $aSwap[0][$j] Next Next Else Local $aSwap[1] For $i = $startindex To $u1 $r = Random($startindex, $u1, 1) $aSwap[0] = $array[$i] $array[$i] = $array[$r] $array[$r] = $aSwap[0] Next EndIf Return 1 EndFuncEdit: fixed error check in function _ArrayToString2() and renamed it to _Array2DToString().Br,UEZ Edited May 8, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
computergroove Posted May 8, 2014 Author Share Posted May 8, 2014 (edited) It erases the data in the RandomizeTemp.ini file and replaces it with a single Zero. Here is all my code so far. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=Test.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #Include <File.au3> #Include <Array.au3> #include <string.au3> Global $Videos ;File located in ScriptDir. User editable. Never deleted. Master list of barcodes and files associated with video files. Global $RandomizeTemp ;File created by the program for the purpose of storing a random temporary list of video files to be played as a screen saver while the program waits for a barcode to be scanned Global $Temp ;Temporary location for reading Videos.ini and manipulating the data for RandomizeTemp.ini and creating the links for the barcodes with the video files Global $Paused ;Pause the script with the pause key on the keyboard HotKeySet("{PAUSE}", "TogglePause") ;Ties the pause function to the Pause key HotKeySet("{ESC}", "Terminate") ;Ties the exit program function to the ESC key FileDelete("temp.ini");Deletes temp.ini so it can be recreated with current data CreateRandomTemp() Func CreateRandomTemp() Local $2D_Array = StringSplitW(FileRead(@ScriptDir & "\Video.ini"), "=") Shuffle_Array($2D_Array) Local $hFile = FileOpen(@ScriptDir & "\RandomizeTemp.ini", 2) FileWrite($hFile, _ArrayToString2($2D_Array, "=")) FileClose($hFile) EndFunc Func _ArrayToString2($array, $sDelimiter = ";") ;coded by UEZ 2014 If Not IsArray($array) Then Return SetError(1, 0, 0) If Not UBound($array, 2) > 2 Then Return SetError(2, 0, 0) ;up to 2D arrays only Local $iW, $iH, $sString For $iH = 0 To UBound($array) - 1 For $iW = 0 To UBound($array, 2) - 1 $sString &= $array[$iH][$iW] & $sDelimiter Next $sString = ($iH < UBound($array) - 1) ? StringTrimRight($sString, 1) & @CRLF : StringTrimRight($sString, 1) Next Return $sString EndFunc ;End CreateRandomTemp Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Edited May 8, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html 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