Squirrely1 Posted July 19, 2006 Share Posted July 19, 2006 (edited) Attached is a set of functions to extract the directory name or filename given a complete filepath, and another to make a typed-in path to be valid. Comments and suggestions are welcomed. See "Link . . . Path.au3" below. Link to the updated Path.au3 download page (AutoIt Scripts & Scraps)These includes files have been updated to fix a glitch wherein a trailing backslash specified by a switch didn't work right if the folder was a driveletter followed only by a colon. ( _StringExtractDirectory lines 232 -256 ) Edited September 9, 2006 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
jvanegmond Posted July 19, 2006 Share Posted July 19, 2006 This is also available in Beta. _PathSplit -------------------------------------------------------------------------------- Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Squirrely1 Posted July 21, 2006 Author Share Posted July 21, 2006 Thanks for the heads up Manadar. I like your 3D.au3. There are so many new functions in the betas I get lost. I wondered why nobody had come up with functions like the first two in my .au3. I had been using those for quite a while and so started fixing them up. What do you think of the idea of a function that checks the validity of a typed-in path, like my third function is supposed to do. Can you fool that function and find any flaws that it may have? Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
jvanegmond Posted July 21, 2006 Share Posted July 21, 2006 (edited) Are you kidding me? The functions may already exist, but yours are solid as a rock. For the function that checks wether a path is good and exists. I would suggest that you do a FileOpen with write flag, but not create directory flag, if the path doesn't exist it will probably return -1. If it doesn't return -1, FileDelete. Three thumbs up for the great scripting job Edited July 21, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Squirrely1 Posted July 23, 2006 Author Share Posted July 23, 2006 Thanks for the encouragement Manadar, I have made a note in that file of what you say to try, and the next time I work on that module, I want to make sure to check it out your tweak. Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
niche99 Posted August 6, 2006 Share Posted August 6, 2006 Hi, Using #include <Path.au3> ; ---------------------------------------------------------------------------- ; Setup Default Variables ; ---------------------------------------------------------------------------- Local $entries_ini Local $Folder ; ---------------------------------------------------------------------------- ; Script Start ; ---------------------------------------------------------------------------- ; ---------------------------------------------------------------------------- ; Get Folder Entries.ini is in ; ---------------------------------------------------------------------------- $Folder = _StringExtractDirectory ("H:\ISOs\SOURCES\AutoImage\Tools\FGCBA\AttributeChanger_v5.23_Addon\Entries_ini") ; ---------------------------------------------------------------------------- ; Run FGCBA ; ---------------------------------------------------------------------------- $PID = Run(@ComSpec & ' /c ' & 'FGCBA ' & '"$entries_ini"' & ' /cab:' & '"$Folder' & '.cab"', @ScriptDir) ProcessWaitClose ($PID) I get the follwing error: Line 208: File Path.au3 SetError (0,0) ERROR^ Any help appreciated, niche99 Link to comment Share on other sites More sharing options...
Squirrely1 Posted August 6, 2006 Author Share Posted August 6, 2006 Hi, Using #include <Path.au3> ; ---------------------------------------------------------------------------- ; Setup Default Variables ; ---------------------------------------------------------------------------- Local $entries_ini Local $Folder ; ---------------------------------------------------------------------------- ; Script Start ; ---------------------------------------------------------------------------- ; ---------------------------------------------------------------------------- ; Get Folder Entries.ini is in ; ---------------------------------------------------------------------------- $Folder = _StringExtractDirectory ("H:\ISOs\SOURCES\AutoImage\Tools\FGCBA\AttributeChanger_v5.23_Addon\Entries_ini") ; ---------------------------------------------------------------------------- ; Run FGCBA ; ---------------------------------------------------------------------------- $PID = Run(@ComSpec & ' /c ' & 'FGCBA ' & '"$entries_ini"' & ' /cab:' & '"$Folder' & '.cab"', @ScriptDir) ProcessWaitClose ($PID) I get the follwing error: Line 208: File Path.au3 SetError (0,0) ERROR^ Any help appreciated, niche99 niche99, it looks as though you are using an altered version of my UDF, named "File Path.au3". If so and you want to continue doing so, you should use this: "#include <File Path.au3>" instead of "#include <Path.au3>". Cheers! Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
MHz Posted August 6, 2006 Share Posted August 6, 2006 I get the follwing error:Line 208: File Path.au3SetError (0,0)ERROR^Any help appreciated,niche99You maybe getting the error as the latest Beta functions and syntax is being used in the scripts. @Squirrely1Path.au3 is the "File" in the error message. 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