Jump to content
Sign in to follow this  

FileOpen or FileWriteLine is not working...

Recommended Posts


This is my code:

$file = FileOpen(@MyDocumentsDir & "sfp.ini", 1)

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

FileWriteLine($file, "Line1")
FileWriteLine($file, "Line2" & @CRLF)
FileWriteLine($file, "Line3")


I went to My Documents and it's not showing up, although I get no error message.

Share this post

Link to post
Share on other sites
Richard Robertson

@MyDocuments, as well as other directory macros, do not contain a \ on the end. You have to add it yourself. "\sfp.ini"

The file you made was at "C:\Documents and Settings\[user]\My Documentssfp.ini". I assume you use XP because Vista would have popped up on UAC trying to do something like that.

Edited by Richard Robertson

Share this post

Link to post
Share on other sites

You forgot a slash between the directoryname and the filename on your fileopen() statement so guess you are looking on the wrong place?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.