Jump to content

Windows vs. Mac File Path


This topic is 5998 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi Guys,

this is probably an easy one for someone who knows windows... I can't figure it out and would appreciate a tip.

My database has a scripted Excel export function. I've chosen to name the files Excel_11807.xls, and collect them in a designated directory "Lasting Record Data/Excel Export". I'm using the Get(FileMakerPath) function to locate the directory, as it is located in the same folder as my runtime solution (or FileMaker application for the time being).

On the Mac, the following calculation works flawlessly:

Substitute (

Get(FileMakerPath) & "Excel" & (Substitute (Get(CurrentDate); "/"; "")) & ".xls" ;

"Excel" & Substitute (Get(CurrentDate); "/"; "") & ".xls" ;

"Lasting Record Data/Excel Expor/t" & "Excel" & Substitute (Get(CurrentDate); "/"; "") & ".xls"

)

However, in my windows test-environment (WIN XP, SR3) it returns: "Excel_11807.xls could not be created. Use a different name..."

How do I need to change the path for it to work in a windows environment??

Thank you so much for your input!

Link to comment
Share on other sites

I am surprised this works at all as your target filename does not have a prefix that FM needs to determine the platform and protocol.

file: is relative

filemac: is mac absolute

filewin: is windows absolute

Should work if you just prefix with "file:"

If not then maybe the file already exists and is locked, or the directory does not exist.

Incidentally, where did the underscore come from in the Windows message as it's not in your calculation.

Link to comment
Share on other sites

It seems you've got a lot of extra Substituting in the calculation. Also, my preference is to create a sortable date stamp for file names in folders, yearmonthday, padding the month and day. I think an absolute path prefix is best, as those FileMaker path functions return absolute paths (they would have to on client machines).

I would also prefer to use the Documents folder, Get ( DocumentsPath ). Exported documents don't belong in the application folder, IMHO.

Let ( [

prfx = Case ( Abs ( Get ( SystemPlatform)) = 1; "filemac:"; "filewin:" );

yr = Year ( Get ( CurrentDate ));

m = Right ( "0" & Month ( Get ( CurrentDate )); 2);

d = Right ( "0" & Day ( Get ( CurrentDate )); 2)

];

prfx & Get(DocumentsPath) & "Lasting Record Data/Excel Export/Excel_" & yr & m & d & ".xls"

)

Link to comment
Share on other sites

Hey Fenton and IdealData!

Thank you so much for your input - it works like a charm. I've been reading in another post, "It's always the obvious in the end..." - I guess that goes for this one too.

Funny that my mac file paths always worked without the filemac: prefix...

Fenton, the reason I've placed the document folder in the runtime application folder is because A) I don't have an installer app to place things automatically in different spots, :) the users are really computer illiterate - I thought it would make their lives easier.

Cheers,

Michael

Link to comment
Share on other sites

  • 2 months later...

Sorry to reopen this thread, but i can't get it to work:

i've made this script:

Set Variable [ $percorsoDesktop; Value:Get ( PercorsoDesktop ) ] 

Save record as PDF [ filename: “filewin:$percorsoDesktop”; Create e-mail; current record ] 



but every time i launch it, i have the error message n.800 "unable to write to disk...."

Link to comment
Share on other sites

This topic is 5998 days old. Please don't post here. Open a new topic instead.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.