UEZ Posted May 8, 2014 Share Posted May 8, 2014 (edited) Can you modify the function 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, _ArrayToString2($2D_Array, "=")) FileClose($hFile) EndFunc Is the array $2D_Array displayed 2 times? 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 It still returns a zero in the RandomizeTemp.ini There is only one Zero in the file. I dont understand what you are asking. Did you try to compile what you are modifying with the code I posted? Why is everything I try returning a zero? 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 For me your code from post #20 works properly when I use this file: Video.ini 12345=video1.mpg 23456=video2.mpg 34567=video3.mpg It creates RandomizeTemp.ini with e.g. this content: 23456=video2.mpg 12345=video1.mpg 34567=video3.mpg 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 I just tried this from your code: Local $2D_Array = StringSplitW(FileRead(@ScriptDir & "Video.ini"), "=") MsgBox(0,"RandomizeTemp",$2D_Array) It returned a zero. 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 You cannot display arrays with MsgBox() function. Use instead _ArrayDisplay($2D_Array).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 (edited) Do I need to pass it to a variable? When I replace the msgbox line with your code and run it I get nothing. I cant find documentation for it in english. 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 Can you post a fragment of the real Video.ini - let's say the 1st 10 lines?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 83948100026=Annihilator.wmv 83948100685=bouquet_of_mines.wmv 83948100263=Dragon_Slayer.wmv 83948100657=fearsome_finale.wmv 83948100691=four_times_as_fun.wmv 8394810021400234=Furious_Fireworks.wmv 83948100658=Gargantuan.wmv 83948100692=Glitters.wmv 83948100268=Hard_Head.wmv 83948100243=Home_Run.wmv 83948100238=its_a_winner.wmv 83948100605=just_plain_beautiful.wmv 83948100296=Killer_Spider.wmv 83948100286=Mystery_Mines.wmv 83948100284=Night_Blitz.wmv 83948100237=No_Fear.wmv 83948100264=sky_dancer.wmv 83948100201=willow_tree.wmv 83948100607=Z_alpha_&_Z_omega.wmv 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 For me it works properly with the content what you've posted!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 OMG What the hell is wrong with what I have? Ill uninstall and reinstall everything and try it again. 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 I uninstalled and deleted the autoit and scite installations. I deleted the autoit directory and then reinstalled everything and I am getting the same results. All I get is a zero in the RandomizeTemp.ini. Suggestions? I am not using the beta version of Autoit. 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 Which AutoIt version you are using exactly? Is there any error in the SciTE output console?Btw, I modified the _ArrayToString2() function because the check for 2D arrays was wrong.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 (edited) Console said this: >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /ShowGui /in "I:\Programming\Barcode Video Player New Autoit Version\test.au3" +>16:13:03 Starting AutoIt3Wrapper v.2.2.0.0 SciTE v.3.4.1.0 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\user\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\user\AppData\Local\AutoIt v3\SciTE -> 1 Change(s) made. >Running AU3Check (3.3.10.2) from:C:\Program Files (x86)\AutoIt3 input:I:\Programming\Barcode Video Player New Autoit Version\test.au3 +>16:13:07 AU3Check ended.rc:0 >Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\aut2exe\aut2exe.exe /in "I:\Programming\Barcode Video Player New Autoit Version\test.au3" /out "C:\Users\user\AppData\Local\AutoIt v3\Aut2exe\~AU3knarapo.exe" /nopack /comp 2 /x64 +>16:13:08 Aut2exe.exe ended.C:\Users\user\AppData\Local\AutoIt v3\Aut2exe\~AU3knarapo.exe. rc:0 +>16:13:08 Created program:I:\Programming\Barcode Video Player New Autoit Version\Test.exe +>16:13:09 AutoIt3Wrapper Finished. >Exit code: 0 Time: 6.614 Autoit 3.3.10.2 I have tried saving and compiling and manually running the exe and I also tried just going to tools then run. Same results for both. 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) Where is your ini file located? Must be in folder I:ProgrammingBarcode Video Player New Autoit VersionBr,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...
BrewManNH Posted May 8, 2014 Share Posted May 8, 2014 What happens if you open the script in SciTE and hit F5? What does the console in SciTE display? 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 Where is your ini file located? Must be in folder I:ProgrammingBarcode Video Player New Autoit Version Br, UEZ Its in I:ProgrammingBarcode Video Player New Autoit Version My script is compiled there as well 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 What happens if you open the script in SciTE and hit F5? What does the console in SciTE display? >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "I:ProgrammingBarcode Video Player New Autoit Versiontest.au3" /UserParams +>16:37:53 Starting AutoIt3Wrapper v.2.2.0.0 SciTE v.3.4.1.0 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:Program Files (x86)AutoIt3SciTE UserDir => C:UsersuserAppDataLocalAutoIt v3SciTEAutoIt3Wrapper SCITE_USERHOME => C:UsersuserAppDataLocalAutoIt v3SciTE >Running AU3Check (3.3.10.2) from:C:Program Files (x86)AutoIt3 input:I:ProgrammingBarcode Video Player New Autoit Versiontest.au3 +>16:37:53 AU3Check ended.rc:0 >Running:(3.3.10.2):C:Program Files (x86)AutoIt3autoit3_x64.exe "I:ProgrammingBarcode Video Player New Autoit Versiontest.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop +>16:37:53 AutoIt3.exe ended.rc:0 +>16:37:53 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.6689 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 OK I started up xp in a virtual box ad installed everything and it works. WTF is wrong with my autoit installation? 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) Next try. Can you create "I:ProgrammingBarcode Video Player New Autoit VersionTest2.au3" and post the SciTE output?expandcollapse popup#AutoIt3Wrapper_UseX64=n #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 $sString = FileRead(@ScriptDir & "\Video.ini") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sString = ' & $sString & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $2D_Array = StringSplitW($sString, "=") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $2D_Array = ' & $2D_Array & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Shuffle_Array($2D_Array) Local $hFile = FileOpen(@ScriptDir & "\RandomizeTemp.ini", 2) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hFile = ' & $hFile & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console FileWrite($hFile, _Array2DToString($2D_Array, "=")) ConsoleWrite("FileWrite: " & @error & @CRLF) 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 Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 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 256) ; 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.96 build 2015-01-20 beta ; Author ..............: UEZ ; Modified ............: ; Remarks .............: RegEx take from http://stackoverflow.com/questions/4476812/regular-expressions-how-to-replace-a-character-within-quotes ; Related .............: StringSplit, StringReplace, StringRegExpReplace, StringLen, StringStripCR ; =================================================================================================================================================== Func StringSplitW($sString, $sDelimiter = ";", $sQuotationMark = '"', $sDummy = "¦", $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, $sLine For $k = 1 To $aSplit[0] $iLen = StringLen($aSplit[$k]) If $iLen > 1 Then $sLine = StringRegExpReplace($aSplit[$k], '(?m)\' & $sDelimiter & '(?=[^' & $sQuotationMark & ']*' & $sQuotationMark & '(?:[^' & $sQuotationMark & '\r\n]*' & $sQuotationMark & '[^' & $sQuotationMark & ']*' & $sQuotationMark & ')*[^' & $sQuotationMark & '\r\n]*$)', $sDummy) $chk = StringReplace($sLine, $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] = $sLine Case Else Dim $aPos[$iWidth * 2 + 2] $j = 1 $aPos[0] = 1 For $i = 0 To $iWidth - 1 $aPos[$j] = StringInStr($sLine, $sDelimiter, 0, $i + 1) - 1 $aPos[$j + 1] = $aPos[$j] + 2 + $iDelimiterLen $j += 2 Next $aPos[UBound($aPos) - 1] = StringLen($sLine) $j = 0 For $i = 0 To UBound($aPos) - 1 Step 2 $aVertical[$l][$j] = StringMid(StringReplace($sLine, $sDummy, $sDelimiter), $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 EndFuncAny AV installed? Br,UEZ Edited January 19, 2015 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) Same output. Avast keeps coming up when I try to run the compiled exe..Let me try to disable it. Here's the output. >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /ShowGui /in "I:ProgrammingBarcode Video Player New Autoit Versiontest.au3" +>16:55:57 Starting AutoIt3Wrapper v.2.2.0.0 SciTE v.3.4.1.0 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:Program Files (x86)AutoIt3SciTE UserDir => C:UsersuserAppDataLocalAutoIt v3SciTEAutoIt3Wrapper SCITE_USERHOME => C:UsersuserAppDataLocalAutoIt v3SciTE -> No changes made.. >Running AU3Check (3.3.10.2) from:C:Program Files (x86)AutoIt3 input:I:ProgrammingBarcode Video Player New Autoit Versiontest.au3 +>16:55:59 AU3Check ended.rc:0 >Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\Aut2Exe\aut2exe.exe /in "I:ProgrammingBarcode Video Player New Autoit Versiontest.au3" /out "C:UsersuserAppDataLocalAutoIt v3Aut2exe~AU3wpqppwm.exe" /nopack /comp 2 +>16:56:00 Aut2exe.exe ended.C:UsersuserAppDataLocalAutoIt v3Aut2exe~AU3wpqppwm.exe. rc:0 +>16:56:00 Created program:I:ProgrammingBarcode Video Player New Autoit VersionTest2.exe +>16:56:00 AutoIt3Wrapper Finished. >Exit code: 0 Time: 3.64 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