Jump to content

Cannot create files


Recommended Posts

Hello!

I am fairly new to this language, and had thought that functions such as "FileOpen", "FileWrite" and "FileWriteLine" are supposed to create a file if there wasn't one already existing, however, this does not appear to be the case, so I am asking how do I fix my script so that it creates files if there is not one already existing. here is my script so far;

Dim $stmdir
If Not FileExists("C:\IsaaBot\SteamDir.txt") Then
   $stmdir = InputBox("IsaaBot v0.1", "Please type the location of Isaac.exe. E.G. D:\USER\USERs Downloads\Steam\steamapps\common\the binding of isaac\Isaac.exe")
   Local $file = FileOpen("C:\IsaaBot\SteamDir.txt", 0)
   If Not $file Then
      MsgBox(32, "Could not create", "Could not create new SteamDir.txt file")
      Run($stmdir)
   Else
      FileWriteLine($file, $stmdir)
      MsgBox(64, "Success!", "Created new SteamDir.txt file")
      Run(FileReadLine("C:\IsaaBot\SteamDir.txt", -1)
   EndIf
EndIf

Hope you can help :ermm:.

- Funnynin  :bye:

Edit: Thought you might also like to know the error(s)

"D:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:UsersUSERDesktopIsaaBot.au3"
C:UsersUSERDesktopIsaaBot.au3 (11) : ==> Error parsing function call.:
Run(FileReadLine("C:IsaaBotSteamDir.txt", -1)
Run(FileReadLine("C:IsaaBotSteamDir.txt", -1^ ERROR
>Exit code: 1    Time: 2.427
Edited by Funnynin
Link to comment
Share on other sites

  • Moderators

Funnynin,

Welcome to the AutoIt forum. :)

However, given the content of that script you might like to read the Forum rules (there is also a link at bottom right of each page) before you post again. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

...

However, given the content of that script you might like to read the Forum rules (there is also a link at bottom right of each page) before you post again. ;)

...

 

Riight.... Sorry. I didn't see that. Thanks.

Is there anything I will need to do to this thread, such as removal of content from the post, or are you going to do all that needs to be done?

Link to comment
Share on other sites

  • Moderators

Funnynin,

I will do the necessary...thread locked. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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