Darien Posted July 14, 2017 Posted July 14, 2017 Hello, When executing the script below (file "Excecoes_Desktop.txt" attached), the "For ... In" loop does not execute. I wonder why? #include <File.au3> Dim $matriz_excecoes_predefinidas [1] _FileReadToArray ( "C:\Excecoes_Desktop.txt" , $matriz_excecoes_predefinidas , 0 , Chr(9) ) _ArrayDisplay ($matriz_excecoes_predefinidas) For $excecao_predefinida In $matriz_excecoes_predefinidas MsgBox(0,"",$excecao_predefinida) Next Excecoes_Desktop.txt
Developers Jos Posted July 14, 2017 Developers Posted July 14, 2017 The _ArrayDisplay() also doesn't do anything ...right? I think you wan to change this line: _FileReadToArray ( "Excecoes_Desktop.txt" , $matriz_excecoes_predefinidas) Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Darien Posted July 14, 2017 Author Posted July 14, 2017 (edited) For me the _ArrayDisplay() works. You should not have copied the file "Excecoes_Desktop.txt" to C: Edited July 14, 2017 by Darien
Developers Jos Posted July 14, 2017 Developers Posted July 14, 2017 Agree... but try anyway what I suggested. With those parameters, the array changes from single to multiple columns which causes the issue in the For ..In loop. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Darien Posted July 14, 2017 Author Posted July 14, 2017 (edited) I did, I had to remove the CHR (9): #include <File.au3> Dim $matriz_excecoes_predefinidas [1] _FileReadToArray ( "C:\Excecoes_Desktop.txt" , $matriz_excecoes_predefinidas , 0 ) _ArrayDisplay ($matriz_excecoes_predefinidas) For $excecao_predefinida In $matriz_excecoes_predefinidas MsgBox(0,"",$excecao_predefinida) Next Thank you. Edited July 14, 2017 by Darien
mikell Posted July 14, 2017 Posted July 14, 2017 Please note that if you use a For/To loop instead of a For/In, like this For $i = 1 to UBound($matriz_excecoes_predefinidas)-1 MsgBox(0,"",$matriz_excecoes_predefinidas[$i]) Next then you get an error msgbox with the cause of the failure written inside
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