Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script for Save to Path

Featured Replies

  • Newbies

I hope I am allowed to post here for FM11 Pro Advanced on Win 7. I am struggling with the Code shown below. (mainpath = location statement for $filespec)

ROT is the Destination Folder on my Desktop. After Final Testing, the Destination Folder will be elsewhere on my PC.

I need to Save Records as pdf to the Location Path on my PC, to "mainpath" Location with the Filename "Service_Web_120716.pdf"

I have chosen this method, so that I can easily change the Location Path to that required on other Operators machines.

The remainder of Code has tested OK - It is only Destination Path Location that is causing issues.

Error produced is::: Service_Web_120716.pdf could not be created on this Disk. Use a different name, make more room on the disk, unlock it, or use a different disk. There is no problem with the disk; In fact earlier when testing with the Function Get (DesktopPath), the resulting file would show on the Desktop. Now no file on Desktop and Error.

 

$filespec

Let ( [

    mainpath = \C:/Users/Owen_2/Desktop/ROT/ ;

   prefix = "Service_Web_" ;

   today = GetAsDate ( Get ( CurrentHostTimeStamp ) ) ;

   dd = Right ( "00" & Day ( today ) ; 2 ) ;

   mm = Right ( "00" & Month ( today ) ; 2 ) ;

   yy = Right ( Year ( today ) ; 2  ) ;

   filename = prefix & dd & mm & yy

   ] ;

   "file:" mainpath & filename & ".pdf"

)

Save Records as pdf [No dialog; “$filespec”; Records being browsed]

Regards

Nasho23

First, what you posted is not a valid Filemaker expression.

Next, file:\C:/Users/Owen_2/Desktop/ROT/Service_Web_120716.pdf is not a valid Filemaker path - see: http://www.filemaker.com/help/15/fmp/en/#page/FMP_Help%2Fcreating-file-paths.html

See if this works for you:

Let ( [
dir = Get ( DesktopPath ) & "ROT/";
prefix = "Service_Web_" ;
now = Get ( CurrentHostTimeStamp )  ;
dd = SerialIncrement ( "00" ; Day ( now ) ) ;
mm = SerialIncrement ( "00" ; Month ( now ) ) ;
yy = Right ( Year ( now ) ; 2  ) ;
fileName = prefix & dd & mm & yy
 ] ;
"file:" & dir & fileName & ".pdf"
) 

 

Note: I would use YYMMDD instead of DDMMYY, so that the files will be in chronological order when sorted by name.

 

  • Author
  • Newbies

Thank you for this. For my Test run, this is great and, to a Novice, you make it look so simple.

However; If and when I need to Save the File to a Folder that is located a number of Folders down on E:/My Documents/My Databases/ROTA/WEBSITE/WEB INPUTS/WEB SITE Member Reports/ - How do I change the Code for Saving to this new location???

Not really concerned about chronological order of sorting as these files change every month, with the old ones being deleted after new ones are uploaded to the Website.

Thank You

Nasho23

5 hours ago, Nasho23 said:

If and when I need to Save the File to a Folder that is located a number of Folders down on E:/My Documents/My Databases/ROTA/WEBSITE/WEB INPUTS/WEB SITE Member Reports/ - How do I change the Code for Saving to this new location???

If you want to hard-code the entire path, make:

dir = "/E:/My Documents/My Databases/ROTA/WEBSITE/WEB INPUTS/WEB SITE";

However, using one of the built-in paths is recommended, esp. if you intend to deploy this on other people's systems.

 

Edited by comment

  • Author
  • Newbies

Thank you for your assistance in this matter. I have elected to stick with the Function (DesktopPath) & "Folder" which will work on everyone's computer.

For no obvious reason that I could see, I could not get the Hard Coded Path to work. I will not bother with that method.

Many Thanks

Nasho23

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.