Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

FileRead - Windows XP vs Windows 8

$
0
0
So I had a miserable time reading a file on / creating a regular expression on windows 8, so I wrote just a simple test script to troubleshoot my Logic:

#include <IE.au3>
#include <Date.au3>
#include <Array.au3>
#include <String.au3>
#include <file.au3>
$i = 0
Local $file = "C:\foo\test.txt"
ConsoleWrite ("File name is: " & $file & @CRLF)
FileOpen($file,0)
consolewrite("FileOpen @error = " & @error & @CRLF)
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
$file = FileRead("C:\foo\test.txt")
consolewrite("FileRead @Error = " & @error & @CRLF)
ConsoleWrite($file & @CRLF)
$test = StringRegExp($file, 'Acct', 3)

ConsoleWrite("Test " & $test[0] & @CRLF)



Couldn't get it to work, but had two existing scripts that used similar code, so I knew something was wrong.

Tested on a Windows XP VM, and everything worked as expected.

Anyone else having issues on Widnows 8, and workarounds?

File c:\foo\test.txt just has 2 lines of text:
Acct
Acct

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>