DeeRiee Posted August 17, 2008 Posted August 17, 2008 I'm newbie here, and i want to ask about how to select the file name in file path? example: d:\document\autoit.exe How to select only the autoit.exe Please tell me script that can select file name in any path and file name
dbzfanatic Posted August 17, 2008 Posted August 17, 2008 $path = "d:\document\autoit.exe" $array = StringSplit($path,"\") $name = $array[$array[0]] MsgBox(64,"Name",$name) Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
smashly Posted August 17, 2008 Posted August 17, 2008 Another way:$sPath = "d:\document\autoit.exe" $sFileName = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1)) ConsoleWrite($sFileName & @LF)
AdmiralAlkex Posted August 17, 2008 Posted August 17, 2008 There is also _PathSplit(), but it may be excessive depending on what you are doing .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
rasim Posted August 17, 2008 Posted August 17, 2008 More solutions: $path = "d:\document\autoit.exe" $file = StringRegExpReplace($path, "^.*\\", "") ConsoleWrite($file & @LF)
Moderators SmOke_N Posted August 17, 2008 Moderators Posted August 17, 2008 More solutions: $path = "d:\document\autoit.exe" $file = StringRegExpReplace($path, "^.*\\", "") ConsoleWrite($file & @LF) Ha, nice... I do that much more complicated. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
DeeRiee Posted August 17, 2008 Author Posted August 17, 2008 $path = "d:\document\autoit.exe" $array = StringSplit($path,"\") $name = $array[$array[0]] MsgBox(64,"Name",$name)Thanks, It's Work
DeeRiee Posted August 17, 2008 Author Posted August 17, 2008 Another way:$sPath = "d:\document\autoit.exe" $sFileName = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1)) ConsoleWrite($sFileName & @LF)Working, Thanks
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