Jump to content

Recommended Posts

Posted

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
Posted

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.
  :)

Posted (edited)

For me the _ArrayDisplay() works. You should not have copied the file "Excecoes_Desktop.txt" to C:

Edited by Darien
  • Developers
Posted

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.
  :)

Posted (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 by Darien
Posted

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  :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...