darkleton Posted March 12, 2010 Share Posted March 12, 2010 (edited) 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! Thanks **edit** 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 March 12, 2010 by darkleton Link to comment Share on other sites More sharing options...
Pain Posted March 12, 2010 Share Posted March 12, 2010 _PathSplit ? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 12, 2010 Moderators Share Posted March 12, 2010 darkleton, This will get you the file name and extension from a full path: $sFileName = StringRegExpReplace($localmsifile, "^.*\\", "") 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 Link to comment Share on other sites More sharing options...
darkleton Posted March 12, 2010 Author Share Posted March 12, 2010 thank you both Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 12, 2010 Share Posted March 12, 2010 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. Link to comment Share on other sites More sharing options...
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