Will66 Posted March 21, 2009 Posted March 21, 2009 Hi, haven't used autoit for a while. I prefer to use FileOpenDialog rather than FileSelectFolder.....whats the simplest way to trim the file name from a files path and return just the folder path? eg:c:\\myfolder\ $var = FileOpenDialog("browse", @MyDocumentsDir & "", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", 1 + 4 )
Moderators Melba23 Posted March 21, 2009 Moderators Posted March 21, 2009 Will66,Personally I have always used the following with success:$sFolder = StringLeft($sFile_Name, StringInStr($sFile_Name, "\", 0, -1))It looks for the right-most "\" and trims what is to the right of it (which should be the actual file name). You are left with a training "\" - not too difficult to alter the code to remove it if you wish.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
CodyBarrett Posted March 21, 2009 Posted March 21, 2009 i thought there was a macro called @SCRIPTDIR.... or is the folder you want NOT in the script direcotry? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
MilesAhead Posted March 21, 2009 Posted March 21, 2009 (edited) Hi, haven't used autoit for a while. I prefer to use FileOpenDialog rather than FileSelectFolder.....whats the simplest way to trim the file name from a files path and return just the folder path?eg:c:\\myfolder\$var = FileOpenDialog("browse", @MyDocumentsDir & "", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", 1 + 4 )I could never figure out why MS doesn't let you select a folder using the same dialog. That shell browse for folder thing really bites! Edited March 21, 2009 by MilesAhead My Freeware Page
Mat Posted March 21, 2009 Posted March 21, 2009 _PathSplit is what I use most of the time... I also use stuff like the extension in my script. MDiesel AutoIt Project Listing
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