Jump to content
The ORIGINAL FileMaker Community - Forum - Online Business Apps & Software Forum
thetravo

Saving PDF to a user defined file path

Recommended Posts

thetravo

Well I searched this site and had found a solution to my problem of saving browsed records into PDF's individually. Now I was wondering how I can further advanced this script so I can save to a defined folder on my hard drive. Just for reference the program is shared on a server via FM server 7.

 

This script I am using is as follows:

 

~Go to Record/Request/Page (First)

~Loop

~ Set Variable [$PDFPath; Value:"file:" & Get ( DesktopPath ) & My Table::ID Number& ".pdf"]

~ If [Get(SystemPlatform) = 2]

~ Set Variable [$PDFPath; Value:"filewin:/"& Middle ($PDFPath; 2; Length ($PDFPath))]

~ End If

~ Save Records as PDF [Restore; "$PDFPath"; Current Records]

~ Go to Record/Request/Page [Next; Exit after Last]

~End Loop

 

I've tried changing the part of desktop path but that doesn't work. Maybe a way to open a dialogue window so anyone can save it to a portion on the HD. Thanks in advance

Share this post


Link to post
Share on other sites
AHunter3

Exactly, explicitly WHAT is the path you WANT to save the PDF files to?

 

Is it on your own local hard drive? You're the only one who will be using it?

Share this post


Link to post
Share on other sites
thetravo

Well yes the file path would be on someone's individual computer. I may use it or my colleague on another computer may need to save to his own computer too.

Share this post


Link to post
Share on other sites
AHunter3

OK. So.. what folder do you want to save it to? If it is other than the Desktop or Documents folder, you would have to make sure all the users do indeed have such folders with the relevant names.

 

 

PS: this is copied wrong:

 

Set Variable [$PDFPath; Value:"file:" & Get ( DesktopPath ) & My Table::ID Number& ".pdf"

If [Get(SystemPlatform) = 2]

~ Set Variable [$PDFPath; Value:"filewin:/"& Middle ($PDFPath; 2; Length ($PDFPath))]

End If

 

 

That should have been this instead:

 

 

 

Set Variable [$PDFPath; Value: Get ( DesktopPath ) & My Table::ID Number& ".pdf"

If [Get(SystemPlatform) = 2]

~ Set Variable [$PDFPath; Value:"filewin:/"& Middle ($PDFPath; 2; Length ($PDFPath))]

End If

Share this post


Link to post
Share on other sites
thetravo

thank you for the correction. I would want it here:

 

C:\Documents and Settings\MYUSER\My Documents\Filemaker

Share this post


Link to post
Share on other sites
AHunter3

Set Variable [$MyUSER; "whoever the heck current user is —— I don't know how you plan on determining who the user is & what their windows account is named"]

Set Variable [$PDFPath; Value:"filewin:/C:/Documents and Settings/" & $MyUSER & "/" & My Table::ID Number& ".pdf"]

Save Records as PDF [Restore; "$PDFPath"; Current Records]

Share this post


Link to post
Share on other sites
thetravo

Again thank you, though is there a way to have filemaker define the local (windows log on) user such as one person logs on as bob and another logs on as steve instead of maker different scripts for each user.

Share this post


Link to post
Share on other sites
AHunter3

Of COURSE you don't want to make different scripts for each user.

 

At the very worst, you stick up a custom dialog, "Hey! Who the hell are YOU?" and have them type in their windows account name.

 

You can usually abstract it out from Get (DocumentsPath) though:

 

 

Set Variable [$DocPath; Get (DocumentsPath)]

Set Variable [$MyUSER; Middle ($DocPath; Position ($DocPath; "/"; 1; PatternCount ($DocPath; "/")-2) + 1; Position ($DocPath; "/"; 1; PatternCount ($DocPath; "/")-1) - Position ($DocPath; "/"; 1; PatternCount ($DocPath; "/")-2) - 1)]

Share this post


Link to post
Share on other sites
thetravo

That worked perfectly. Thank you.

Share this post


Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...

Important Information

Terms of Use