mr-es335 Posted May 16, 2024 Posted May 16, 2024 Following is what I have thus far... ;----------------------------------------------- Func _CreateShowFile($ListView) Local $DstFilePath = "E:\Master_Backup\Shows" Global $ShowName = InputBox("Notice!", "Please enter the SHOW name...") ; From the input data, create a new file consisting of the input text with a file extension of .shw EndFunc ;==>_CreateShowFile ;----------------------------------------------- mr-es335 Sentinel Music Studios
Andreik Posted May 16, 2024 Posted May 16, 2024 It is literally one line of code. Read about FileWrite() in help file.
mr-es335 Posted May 16, 2024 Author Posted May 16, 2024 (edited) Andriek, Thanks for the follow-up..appreciated! I did have a look at this! However, it would appear that, as the context reads, "Write text/data to the end of a previously opened file." I simply want to create new data file based on the input from the "InputBox", with file extension of .shw. Edited May 16, 2024 by mr-es335 mr-es335 Sentinel Music Studios
Moderators Melba23 Posted May 16, 2024 Moderators Posted May 16, 2024 mr-es335, So, as shown in the example for FileWrite, use FileOpen to open a file before wrtiting to it. And do not forget to FileClose it after you have written the data. 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
Andreik Posted May 16, 2024 Posted May 16, 2024 Func _CreateShowFile($ListView) Local $DstFilePath = "E:\Master_Backup\Shows" Global $ShowName = InputBox("Notice!", "Please enter the SHOW name...") ; From the input data, create a new file consisting of the input text with a file extension of .shw Local $hFile = FileOpen($ShowName & '.shw', 2) ; $FO_OVERWRITE = 2 FileWrite($hFile, "some data") FileClose($hFile) EndFunc ;==>_CreateShowFile
mr-es335 Posted May 16, 2024 Author Posted May 16, 2024 Andriek, To begin with, Andriek...."You da' man!" Thank you so very, very much for your continued assistance! Appreciated. I have decided to go with the following...What do you think? Func _CreateShowFile($ListView) Local $DestinationSaveDir = 'E:\Master_Backup\Shows' Local $sSave = FileSaveDialog('Enter SHOW Filename', $DestinationSaveDir, 'SHOW FIle (*.shw)', 18) If @error Then Return SetError(1, 0, Null) If StringRight($sSave, 4) <> '.shw' Then $sSave &= '.shw' Local $hFile = FileOpen($sSave, 2) ; FO_OVERWRITE Local $iCount = _GUICtrlListView_GetItemCount($ListView) For $Index = 0 To $iCount - 1 FileWriteLine($hFile, _GUICtrlListView_GetItemText($ListView, $Index)) Next FileClose($hFile) EndFunc ;==>_CreateShowFile Seems to do the trick... mr-es335 Sentinel Music Studios
mr-es335 Posted May 17, 2024 Author Posted May 17, 2024 17 hours ago, Andreik said: Func _CreateShowFile($ListView) Local $DstFilePath = "E:\Master_Backup\Shows" Global $ShowName = InputBox("Notice!", "Please enter the SHOW name...") ; From the input data, create a new file consisting of the input text with a file extension of .shw Local $hFile = FileOpen($ShowName & '.shw', 2) ; $FO_OVERWRITE = 2 FileWrite($hFile, "some data") FileClose($hFile) EndFunc ;==>_CreateShowFile Just for interest, the above does not appear to work. No .shw data file is created in $DstFilePath. Lastly, I meant to say, "From the input data, create a new file employing the input text as the filename with a file extension of .shw." • The data file is being employed merely a "placeholder" mr-es335 Sentinel Music Studios
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now