PathMaker ( thePath ; theFile ; pathSeparator )
Returns a properly formatted folder and/or file path by processing and combining thePath, theFile, and pathSeparator.
Average rating: 4.8 (12 votes) Log in to vote
Lewis Lorenz - Show more from this author
Lorenz Companies http://www.LorenzCom.com |
PathMaker ( Get ( DocumentsPath ) ; "" ; ":" )
PathMaker ( Get ( DocumentsPath ) & "My Folder" ; "Untitled:/1.txt" ; "" )
PathMaker ( "file:" & Get ( DocumentsPath ) ; "Invoice.pdf" ; "" )
PathMaker ( Get ( DocumentsPath ) & "My Folder:Brochures:" ; "Untitled1.pdf" ; "" )
PathMaker ( Get ( DocumentsPath ) & "My Folder:Brochures:" ; "Untitled1.pdf" ; "\\" )
:Macintosh HD2:Users:user:Documents:
/Macintosh HD2/Users/user/Documents/My Folder/Untitled__1.txt
file:/Macintosh HD2/Users/user/Documents/Invoice.pdf
/Macintosh HD2/Users/user/Documents/My Folder/Brochures/Untitled1.pdf
\Macintosh HD2\Users\user\Documents\My Folder\Brochures\Untitled1.pdf
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
PathMaker ( thePath , theFile , pathSeparator )
Returns a properly formatted folder and/or file path by processing and combining thePath, theFile and pathSeparator.
Easily change path separator in thePath.
Preserves FileMaker Pro file reference prefixes (file:, filemac:, and filewin:).
Conforms different separators in thePath to one only.
Replaces errant separators in theFile with underscores.
Separator defaults to the first path separator in thePath or to the system path separator if pathSeparator is blank.
Concatenates thePath and theFile into a properly formatted file path.
Use with the PathParser custom function for added path formatting control.
Parameters
thePath - A folder path.
theFile - A file name to append to thePath.
pathSeparator - The separator used to separate folders in the thePath: /:\. If left blank the first found separator in thePath is used.
Examples
PathMaker ( "Macintosh HD2:Users/user/Documents:" ; "" ; "" ) = :Macintosh HD2:Users:user:Documents:
PathMaker ( Get ( DocumentsPath ) ; "" ; ":" ) = :Macintosh HD2:Users:user:Documents:
PathMaker ( Get ( DocumentsPath ) & "My Folder" ; "Untitled:/1.txt" ; "" ) = /Macintosh HD2/Users/user/Documents/My Folder/Untitled__1.txt
PathMaker ( "file:" & Get ( DocumentsPath ) ; "Invoice.pdf" ; "" ) = file:/Macintosh HD2/Users/user/Documents/Invoice.pdf
PathMaker ( Get ( DocumentsPath ) & "My Folder:Brochures:" ; "Untitled1.pdf" ; "" ) = /Macintosh HD2/Users/user/Documents/My Folder/Brochures/Untitled1.pdf
PathMaker ( Get ( DocumentsPath ) & "My Folder:Brochures:" ; "Untitled1.pdf" ; "\\" ) = \Macintosh HD2\Users\user\Documents\My Folder\Brochures\Untitled1.pdf
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.