shayneh Posted April 13, 2006 Share Posted April 13, 2006 (edited) I would like to get the path and filename from a pathfilename spec that doesn't necessarily exist on the file system. In vb script: Set fso = CreateObject("Scripting.FileSystemObject") file = fso.GetFileName(pathfilename) How can this be done in AutoIt3? Thanks, ShayneH Edited April 14, 2006 by shayneh Link to comment Share on other sites More sharing options...
cdkid Posted April 13, 2006 Share Posted April 13, 2006 Umm, I'm not sure what exactly the Scripting.FileSystemObject.GetFileName does. I'm guessing it gives you the filename suchas "text.txt" and the path might be "c:\program files". Try something like $file = "c:\Path\To\The\File.txt" $file = StringSplit($file, "\") $path = "" For $i = 1 To $file[0] - 1 $path = $path & $file[$i] & "\" next $filename = $file[$file[0]] msgbox(0,'',$path & $filename) Or you can use the same object approach you've been using $fso = ObjCreate("Scripting.FileSystemObject") $a = $fso.GetFileName($SomeVariableHoldingTheFile) ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2006 Developers Share Posted April 13, 2006 -or- Standard UDF: _PathSplit() SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
shayneh Posted April 14, 2006 Author Share Posted April 14, 2006 Thanks Link to comment Share on other sites More sharing options...
Simucal Posted April 14, 2006 Share Posted April 14, 2006 $filepath = "c:\Path\To\The\File.txt" $file = StringTrimLeft($filepath,StringInStr($filepath,"\",0,-1)) Pure Genius Larry! I've always used: $ShortFilePathArray = StringSplit($FilePath,"\") $ShortFilePath = _ArrayPop($ShortFilePathArray) AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
hoppy Posted May 6, 2006 Share Posted May 6, 2006 $filepath = "c:\Path\To\The\File.txt"$file = StringTrimLeft($filepath,StringInStr($filepath,"\",0,-1))Nice and short and efficiant. How can I get only the path like this? Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2006 Developers Share Posted May 6, 2006 Nice and short and efficiant. How can I get only the path like this?$filepath = "c:\Path\To\The\File.txt" $file = StringTrimLeft($filepath,StringInStr($filepath,"\",0,-1)) $Path = StringLeft($filepath,StringInStr($filepath,"\",0,-1)-1) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
hoppy Posted May 6, 2006 Share Posted May 6, 2006 $filepath = "c:\Path\To\The\File.txt" $file = StringTrimLeft($filepath,StringInStr($filepath,"\",0,-1)) $Path = StringLeft($filepath,StringInStr($filepath,"\",0,-1)-1) Thanks a lot Was making thing to complicated by lack of knowledge of all the possible commands. 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