Jump to content

Platform independent file path to temporary dir.


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

Recommended Posts

I am interested in a temporary directory for reading and writing data files on both PCs and Macs. The default path seems to be gone in FM7 so I need a absolute file path that is always availible even for hosted files...regardlest of harddisk names, permissions, etc. My ideas are:

filewin:/C:/TEMP/Resultstemp.txt

filemac:/MacintoshHD/Temporary Items/Resultstemp.txt

filemac:/MacintoshHD/private/tmp/501/Temproary Items/Resultstemp.txt

file:Resultstemp.txt

filemac:/Macintosh HD/Applications/FileMaker Pro 7/Resultstemp.txt

file:../../../Resultstemp.txt

Link to comment
Share on other sites

Hi, Bailey. Speaking for the Windows side: I've seen some instances of people not having a C:temp directory (in fact, i'm writing from a machine that doesn't have one!) I've had to do something similar to what i think you're doing, and settled on the FM directory as the best choice. Of course, we don't allow our clients to install in custom locations, so this is predictable for us; it may not be for you.

Are you using Troi File or anything similar? One thing you could do is run the SET > C:envVar.txt command from FM, then use Troi File to read the contents of that file into a field and parse out of there the TEMP= variable.

HTH,

Jerry

Link to comment
Share on other sites

I don't find the first Mac one, but the longer one works. AppleScript:

alias "Macintosh HD:private:tmp:501:Temporary Items:"

There is a space in the hard drive name (usually), but you can't count on the name; people can change it. It's safer to use:

tell application "Finder"

Link to comment
Share on other sites

No need for a plugin really (although the Troi file plugin is an excellent one)

use the Send Message script step to send command to the windows shell:

cmd /c echo %temp%>c:myTemp.txt

The same script (after pausing for a second or so) can then import that text file into a global.

Link to comment
Share on other sites

I do use the Troi plugin, but not everyone I write dbs for has it and I like to avoid plugins whenever possible. I still can't understand why FM still can't specify a file path from a calculation...especially given the new FM7 File Referencing that we have (great, but incomplete). frown.gif!!!!!! But thanks for the ideas.

PS the second File Path is from the old Mac systems. Not used in X.

Link to comment
Share on other sites

Wlm:

Could you please elaborate? I see script steps to Send Event and Send Mail, but none for Send Message. I assume you're using Send Event, but I'm having difficulty implementing your script step.

It would be extremely useful to be able to shell out to the OS without a plug-in!

Link to comment
Share on other sites

  • 6 months later...

Hi, Mike, and welcome to the Forums!

To do this, you will need one script step, Send Event. Click on the Specify button, and in the Text field, type in whatever shell command you want, for example,

cmd /c echo %temp%>c:myTemp.txt

HTH,

Jerry

Link to comment
Share on other sites

  • 3 weeks later...

On Mac, for some reason, a file reference of this format:

file:MyFile

works for Exporting data (it points to the folder that File Maker 7 is in) but it fails for importing files...

FM7: two steps forward, one step back smile.gif

Link to comment
Share on other sites

This topic is 7018 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.