FilePathToOS ( FMFilePath )
Convert from FileMaker filepath to OS filepath (HFS or NTFS)
			 
  
  
  
  Average rating: 4.0 (40 votes)  Log in to vote
    Average rating: 4.0 (40 votes)  Log in to vote		
| Tom Robinson - Show more from this author | 
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
			Convert the results from Get(FilePath) (‘file:’), a path in a file container field (‘filemac:’, ‘filewin:’), or an image container field (‘imagemac:’, ‘imagewin:’) to a form suitable for AppleScript, DOS, etc.  Handles both absolute and relative paths.
Examples:
	Container field on  OS Ⅹ (‘image:’ and ‘size:’ are ignored):
		From:  imagemac:/tom/Me Myself I/Programs/FileMaker Pro/Custom Functions/FilePathToOS/iphone%2F3g.jpg
		To:    tom:Me Myself I:Programs:FileMaker Pro:Custom Functions:FilePathToOS:iphone/3g.jpg
	Get(FilePath) on OS Ⅹ:
		From:  file:/tom/Me Myself I/Programs/FileMaker Pro/Custom Functions/FilePathToOS/FilePathToOS%2FTest.fp7
		To:    tom:Me Myself I:Programs:FileMaker Pro:Custom Functions:FilePathToOS:FilePathToOS/Test.fp7
	Get(TemporaryPath) on OS Ⅹ:
		From:  /Amphe/private/var/tmp/folders/501/TemporaryItems/FileMaker/
		To:    Amphe:private:var:tmp:folders:501:TemporaryItems:FileMaker:
	Container field on Windows (‘image:’ and ‘size:’ are ignored):
		From:  imagewin:/C:/Documents and Settings/Administrator/My Documents/FilePathToOS/iphone3gwin.jpg
		To:    C:\Documents and Settings\Administrator\My Documents\FilePathToOS\iphone3gwin.jpg
	Get(FilePath) on Windows:
		From:  file:/C:/Documents and Settings/Administrator/My Documents/FilePathToOS/FilePathToOS Windows Test.fp7
		To:    C:\Documents and Settings\Administrator\My Documents\FilePathToOS\FilePathToOS Windows Test.fp7
	Get(TemporaryPath) on Windows:
		From:  /C:/Documents and Settings/Administrator/Local Settings/Temp/
		To:    C:\Documents and Settings\Administrator\Local Settings\Temp\		
Comments
| Daniel A. Shockley, New York, NY Jul 14, 2010 | ||
| You could change the pathpos test to something like the following to reduce function calls: result = FMFilePath; // NOTE: no longer need to prefix line-return to path pathpos = Case( "filemac:" = Left( result; 8 ); 8; "imagemac:" = Left( result; 9 ); 9; "file:" = Left( result; 5 ); 5; 0 ); Note that also removes the need to prefix a line-return symbol to the path, since we test only the leftmost characters. You can do the same for the Windows portion. | ||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.
