Jump to content
Server Maintenance This Week. ×

Change save path


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

Recommended Posts

We have a few stand alone files, where, at closing the file a backup (copy) is made with script:

Set Variable[$Path;Value:

Let(

[

now = Get ( CurrentTimeStamp ) ;

year = Year ( now ) ;

month = Right ( "0" & Month ( now ) ; 2 ) ;

day = Right ( "0" & Day ( now ) ; 2 ) ;

hour = Right ( "0" & Hour ( now ) ; 2 ) ;

mins = Right ( "0" & Minute ( now ) ; 2 ) ;

secs = Right ( "0" & Seconds ( now ) ; 2 )

] ;

Substitute ( Get ( FilePath ) ; ".fp7" ; "_" & year & month & day & "_" & hour & mins & secs & ".fp7" )

)

Save a Copy as ["$Path";copy]

This is working fine.

But it saves the copy to the folder where the original file is.

How to change the script so the file is saved at a specific location, f.i.

/E:/FM8 Files/A name/Project 2008/BUFiles/

I have this path as data in a field in the preference table of the application so it can be changed for each specific local Win computer.

I tried a few changes but I always get the error:

...could not be created on this disk.....

There is something missing/wrong in my new $Path I think.

TIA

Link to comment
Share on other sites

filewin:/C:/Documents and Settings/j_doe/My Documents/test.xls

This example is from FM's help. So, it seems that you are missing the prefix (which can be relative, or platform specific).

Rather than repeat what's in help...

Also, if you only have one preference record, how will the path change for each account logged in, since they all see the same pref record path?

Link to comment
Share on other sites

I keep the path and file name separate, mostly for debugging and simplicity when I need to change the target folder.

The format:

file:$p/$f

works great for me. This also makes it easier manipulate $p per-user, so they have their own custom destination. If you're Windows only, you can use filewin: instead; I like to use the generic form in case a Mac wanders into the mix.

Link to comment
Share on other sites

Strange, the previous script worked without the filewin....

It's working now, thanks.

It's a serie of 25 stand alone computers with the same lab science application on each one of them.

The different users can save the files where ever they want on the disk.

Link to comment
Share on other sites

I believe that your previous script worked (if you are referring to the one in your original post) bcs it used Get (FilePath). This function returns

file:/driveletter:/databaseName

for local files in Windows.

All the Get (**Path) functions include file:. You wanted to build a path, so you need to put the file: in specifically.

Link to comment
Share on other sites

Alright, elaboration and correction of my broad generalizations : (from FM's help):

Get Functions for Paths:

Get(FilePath)

Returns the full path indicating the location of the currently active database file. In Windows, the full path is file:/drive:/folder/filename for local files. For remote files, the full path is file://volume/folder/filename. In the Mac OS, the full path is file:/volume/folder/filename for local and remote files.

Get(DesktopPath)

Returns the path to the desktop folder for the current user. In Windows, the path format is /Drive:/Documents and Settings/UserName/Desktop/. In the Mac OS, the path format is /DriveName/Users/UserName/Desktop/.

Get(FileMakerPath)

Returns the path to the folder of the currently running copy of FileMaker Pro. In Windows, the path format is /Drive:/Program Files/FileMaker/FileMaker Pro 9.0/. In the Mac OS, the path format is /DriveName/Applications/FileMaker Pro 9.0/.

New to FM9:

Get(TemporaryPath)

Returns the path to the temporary folder that FileMaker Pro uses on the current user's computer.

Note Because your operating system controls the location of temporary files, the path returned might be different from the examples shown.

Examples

Windows

Returns:

/%HomeDrive%/Documents and Settings/{user id}/Local Settings/Temp

or

/%UserProfile%/Local Settings/Temp

where:

%HomeDrive% is an environment variable that returns the name of your home drive on your hard disk

%UserProfile% is an environment variable that points to the directory where the profile of the current user is located

Mac OS

Returns:

/DriveName/private/var/tmp/folders/501/TemporaryItems/FileMaker/

where DriveName is the name of your hard disk

And so, only Get(FilePath) includes the "file:" prefix that may be needed. Another consideration to be aware of is that the Get(Desktop) and Get(FilemakerPath) functions end with a "/".

Link to comment
Share on other sites

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