Brian Dunning's FileMaker Custom Functions

PathToFolder ( Folder , Type )

Returns the path for the common places in FileMaker

  Average rating: 4.6 (27 votes) Log in to vote

Ibrahim Bittar Torres   Ibrahim Bittar Torres
Eikonsys, S.A. de C.V.
http://www.eikonsys.com

Share on Facebook Share on Twitter

  Sample input:
PathToFolder ( "Docs" , 1 )

PathToFolder ( "Docs" , 0 )
  Sample output:
filemac:/Ibrahim HD/Users/ibrahim/Documents/

/Users/ibrahim/Documents/

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function is meant to save a lot of typing.

During development we need to get the path to a certain folder. If you are working with plugins for web services or ScriptMaster, chances are that you need to strip the hard drive name and this means a lot of typing (see function above).

With this simple function all you have to do is to specify which folder you want the path for and say if you want the "full" path (with filemac or filewin) to use with Export or the "short" path to use with plugins like ScriptMaster.

It admits four possible parameters:

Desktop -> Returns Get ( DesktopPath )
Temp -> Returns Get ( TemporaryPath )
FM -> Returns Get ( FileMakerPath )
Docs -> Returns Get ( DocumentsPath )

Enjoy!.

 

Comments

Denis   Denis, NYC
Dec 1, 2012
This is interesting, But you're not explaining which parameters you need for the function.
 
Ibrahim Bittar Bittar   Ibrahim Bittar Bittar, León
Dec 1, 2012
The four posible parameters are Desktop, Temp, FMI and Docs.
 
William Best   William Best, Seattle
Dec 24, 2012
/* _Folder2(Folder,Type)
where
Folder is one of Desktop, Temp, FM, Docs
Type=0: without diskname
Type=1: with diskname

Author:
Ibrahim Bittar Torres, Eikonsys, S.A. de C.V.
http://www.eikonsys.com

http://www.briandunning.com/cf/1506

*/
Let(
[
filesys=Case(Type=1;Case(Get(SystemPlatform)=1;"filemac:";"filewin:"));
param="¶Desktop¶Temp¶FM¶Docs";
selected=PatternCount(Left(param;Position(param;Folder;1;1));"¶");
all=Get ( DesktopPath ) & ¶ & Get ( TemporaryPath ) & ¶ & Get ( FileMakerPath ) & ¶ & Get ( DocumentsPath );
path=GetValue(all;selected)
];
filesys & Case(Type; path; Right ( path; Length ( path ) - Position ( path; "/" ; 2 ; 1 ) + 1 ))
)
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.