Jump to content
Sign in to follow this  
bobheart

Not having much leuck with this

Recommended Posts

bobheart

I have no errors but I can't seem to get it to write to the txt file if the drive is ready or not . the msg box works .

$var = DriveStatus( "a:\" )
MsgBox(4096,"Status",$var)
$var = FileOpen("test.txt", 1)

; Check if file opened for writing OK
If $var = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($var, "DriveStatus")


FileClose($var)

Share this post


Link to post
Share on other sites
pekster

Don't you need to use the return of the DriveStatus call to put that in your file? The issue is that $var was getting overwritten with the FileOpen call, and you lost the return that held the status.

$status = DriveStatus( "a:\" )
MsgBox(4096,"Status",$status)
$var = FileOpen("test.txt", 1)

; Check if file opened for writing OK
If $var = -1 Then
   MsgBox(0, "Error", "Unable to open file.")
   Exit
EndIf

FileWrite($var, "DriveStatus is: " & $status)


FileClose($var)

Edited to match the MsgBox call to the new var name

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites
bobheart

Ok I see how you did it . Man this stuff is tuff on me . thanks for the help .

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  

×