PathMaker
PathMaker ( thePath , theFile , pathSeparator )
PathMaker 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 – Folder path.
- theFile – 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
PathMaker code: Copy the selected code (click on Select All to highlight all the code) to the clipboard and paste it into a newly created Custom Function. Download the code in a text file from here.
Pingback:PathParser - Lorenz Companies