Jump to content

Recommended Posts

Posted

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
;-----------------------------------------------

 

Posted (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 by mr-es335
  • Moderators
Posted

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

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

 

Posted
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

 

Posted

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...

Posted
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"

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
  • Recently Browsing   0 members

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