Jump to content
Sign in to follow this  

formatting result of $fileopendialog

Recommended Posts


OK, so I have a fileopendialog box, which will limit the user to finding an .msi file. It then outputs that to a GUI input box.

it outputs it as a full path, eg. c:\test\test1\hi.msi but i then need to have just the msi filename output to an ini file.

I can't do stringright or stringtrim as each msi will be a different name so there is no set number. is there any way of it converting c:\xxxx\hi.msi to hi.msi

i thought about a string split using "\" as the delimiter but i haven't used stringsplit enough to know if its possible or how to do it exactly.

any help would be appreciated!



this is what i have so far:

$localmsifile = FileOpenDialog("", "c:\", "MSI Files (*.msi)", 1 + 2)
    GUICtrlSetData($localmsifileinput, $localmsifile)

so i need it to somehow strip everything up to the actual filename from $localmsifile if its possible

Edited by darkleton

Share this post

Link to post
Share on other sites

_PathSplit ?

Share this post

Link to post
Share on other sites


This will get you the file name and extension from a full path: :mellow:

$sFileName = StringRegExpReplace($localmsifile, "^.*\\", "")


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


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


Share this post

Link to post
Share on other sites

thank you both :mellow:

Share this post

Link to post
Share on other sites

I use this to select a sound file, but in the input box only the filename (w/o the ext.) is displayed. I'm sure you can use this as an example to do what you want.

Func GetSoundFile()
    $sSelectedSong = FileOpenDialog("Select Song", "C:\Users\Public\Music\Music", "Media files (*.mp3;*.wav;*.m4a) | All (*.*)")
    $MusicPath = StringSplit($sSelectedSong, "\")
    GUICtrlSetData($Input3, StringTrimRight($MusicPath[$MusicPath[0]], 4))
EndFunc   ;==>GetSoundFile

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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