Funnynin Posted June 26, 2013 Posted June 26, 2013 (edited) 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 . - Funnynin 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 June 26, 2013 by Funnynin
Moderators Melba23 Posted June 26, 2013 Moderators Posted June 26, 2013 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Funnynin Posted June 26, 2013 Author Posted June 26, 2013 ... 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?
Moderators Melba23 Posted June 27, 2013 Moderators Posted June 27, 2013 Funnynin,I will do the necessary...thread locked. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts