Sign in to follow this  
Followers 0
typhoon

FileOpen failing

7 posts in this topic

#1 ·  Posted (edited)

I might be using the flags in FileOpen incorrectly, or maybe there is a problem with them. I am choosing 16 for binary read and 17 for binary write. This returns an error for any file that I try to open.

Edited by typhoon

Share this post


Link to post
Share on other sites



I might be using the flags in FileOpen incorrectly, or maybe there is a problem with them. I am choosing 16 for binary read and 17 for binary write. This returns an error for any file that I try to open.

Works for me:

$sFile = "C:\Temp\BinaryTest.bin"
$binWrite = Binary("0xFEDCBA9876543210FEDCBA9876543210")

$hFile = FileOpen($sFile, 2 + 16)
FileWrite($hFile, $binWrite)
FileClose($hFile)

$hFile = FileOpen($sFile, 16)
$binRead = FileRead($hFile)

ConsoleWrite("$binWrite = " & $binWrite & @LF & "$binRead = " & $binRead & @LF)

If you still can't make it work, post a short demo script like this that reproduces your symptoms.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

That's odd. When I try your script I get an error that Binary() is an unknown function. I just installed the current version of AutoIt (fresh, on a new system). Is some kind of include needed for that?

Share this post


Link to post
Share on other sites

That's odd. When I try your script I get an error that Binary() is an unknown function. I just installed the current version of AutoIt (fresh, on a new system). Is some kind of include needed for that?

Shouldn't... I just updated to version 3.2.10.0, or whatever the newest is, and this code works. Check your helpfile and see if it contains the Binary() function...

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

That's odd. When I try your script I get an error that Binary() is an unknown function. I just installed the current version of AutoIt (fresh, on a new system). Is some kind of include needed for that?

No, you've broken something. Binary() is an AutoIt native function. The script I posted is complete and requires no #include's. This is the console output when run from SciTE:

+>21:17:59 Starting AutoIt3Wrapper v.1.9.4
>Running AU3Check (1.54.10.0)  from:C:\Program Files\AutoIt3
+>21:18:00 AU3Check ended.rc:0
>Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\Scripts\Test_1.au3"  
$binWrite = 0xFEDCBA9876543210FEDCBA9876543210
$binRead = 0xFEDCBA9876543210FEDCBA9876543210
+>21:18:00 AutoIT3.exe ended.rc:0
+>21:18:02 AutoIt3Wrapper Finished
>Exit code: 0   Time: 3.191

Note where is says "Running:(3.2.10.0)", the current production version of AutoIt. Run it from your SciTE and check the console output for the version it ran under. Post the console output you get as above.

Also, what OS are you using? It's not WfW 3.11 or Win95, or some such is it?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

All I get from the output window is this:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "E:\projects\AutoIt\filewriter\test.au3"  
$binWrite = 0xFEDCBA9876543210FEDCBA9876543210
$binRead = 
>Exit code: 0   Time: 0.210

However, there are no errors at least.

I am using Win2k btw.

The Help File does contain the Binary() function, the splash page shows that it is the latest version. The AutoUpdate also says I have the latest version.

Share this post


Link to post
Share on other sites

All I get from the output window is this:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "E:\projects\AutoIt\filewriter\test.au3"  
$binWrite = 0xFEDCBA9876543210FEDCBA9876543210
$binRead = 
>Exit code: 0   Time: 0.210

However, there are no errors at least.

I am using Win2k btw.

The Help File does contain the Binary() function, the splash page shows that it is the latest version. The AutoUpdate also says I have the latest version.

That makes no sense to me. Win2K should handle the binaries just fine. What version of SciTE are you running it from? Is it a current, full version?

ConsoleWrite("AutoIt version: " & @AutoItVersion & @LF)
ConsoleWrite("SciTE version: " & FileGetVersion("C:\Program Files\AutoIt3\SciTE\SciTE.exe") & @LF)

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Program Files\AutoIt3\Scripts\Test_2.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams    
+>13:32:47 Starting AutoIt3Wrapper v.1.9.4
>Running AU3Check (1.54.10.0)  from:C:\Program Files\AutoIt3
+>13:32:47 AU3Check ended.rc:0
>Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\Scripts\Test_2.au3" 
AutoIt version: 3.2.10.0
SciTE version: 1.7.4.0
+>13:32:48 AutoIT3.exe ended.rc:0
+>13:32:49 AutoIt3Wrapper Finished
>Exit code: 0   Time: 2.536

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0