8 Replies Latest reply on Jan 29, 2012 1:43 PM by Sorbsbuster

    Novice question about paths

    SeattleSquirrel

      Title

      Novice question about paths & filenaming

      Post

      I'm a Graphic Designer lost trying to write a simple script - hoping someone can give me the dummied down answer to this, most likely, simple question.

      What I need to accomplish:

      I work off a Project Dashboard (record layout) and then need to save that record as a pdf on the screen, named as the project # (in my case named: __pkJobID in the database) - BUT it also need to function the same way when my assistant helps me on her computer, but then it should save it to her desktop instead, named the same way.

      Script Name: Save Job Order Print PDF Copy

      • Go to layout ["Job Order; PRINTOUT" (Jobs)]
      • Print Setup [Restore; No dialog]
      • Save Records as PDF [Restore; No dialog; "00000.pdf"; Automatically open; Current record]
      • Go to Layout [original layout]

      In output file path list i currently have just added:

      • filemac:/Mac OS/Users/myname/Desktop/00000.pdf

      I know that I need to change this into something relative, but everytime I try, it gives me an error - and I'm the first to admit I'm not familiar with writing paths for scripts. Hoping someone can help!! You will most likely save me hours and hours of testing different variations of the paths.

      Very grateful for help!!

      Åsa

      Screen_Shot_2012-01-29_at_9.51.42_AM.png

        • 2. Re: Novice question about paths & filenaming
          SeattleSquirrel

          Thanks for the link - I guess I'm just slow because the page is a bit overwhelming and I've tried many variation of whats on there, but i need a very precise answer to overcome my personal confusion on the topic. I'm not super familiar with any of the variation they mention on that page and I must be mixing up some of these terms. Help!

          • 3. Re: Novice question about paths & filenaming
            SeattleSquirrel

            Here's my latest attempts:

            • 4. Re: Novice question about paths & filenaming
              davidanders

              From http://help.filemaker.com/app/answers/detail/a_id/7467/~/understanding-and-using-%27get%27-functions
              Users should have the ability to run a report and save it as a .PDF file to their desktop.  For the saved .PDF file, the user's account name and current date will comprise the file name.  For this task, these Get functions may prove useful:
              ·     Get ( DesktopPath ) - This function will reference the current user's Desktop path which I will need as the location to save the .PDF file

              Set Variable [ $path; Value:Get ( DesktopPath ) & "filename.txt" ]

              The above is the best solution, I think. The following was what I was replying before I remembered the Get (DesktopPath) Function...

              I would suggest setting up a simple database for testing and begin with the basics.

              ComputerType - Macintosh

              HarddriveName - Macintosh OS

              UserFolderName - Users

              UserName - George

              PDFFolderName - PDFs

              PDFFolderLocation - MacHD - Desktop of Current User

              PDFFolderLocationPath - Macintosh OS/Users/George/Desktop/PDFs

              ApplicationsFolderName - Applications

              FMPProgramFolderName - FileMakerPro

              DatabaseName - PathTesting

              DBLocationFolder - FilmakerPro Folder in Applications Folder on Mac Hard Drive

              DBLocationPath - Macintosh/Applications/FilemakerPro

              Filemaker Path to put PDF in PDFs Folder ---  [Absolute Path - everything must be named and spelled correctly]
              IF THERE IS a space after the hard drive name that must be included or it will fail
              filemac:/volumeName/directoryName/fileName
              filemac:/Macintosh OS/Users/George/Desktop/[fileName]

              Filemaker Path to put PDF in same Folder as Database (FilemakerPro Folder) --- [Relative Path - relative to database location]
              filemac:/[fileName]
              filemac:/[fileName]

              Filemaker Path to put PDF in a PDFs folder in same Folder as Database (FilemakerPro Folder) --- [Relative Path - relative to database location]
              filemac:/PDFs/[fileName]

              If both computers have the same hard drive name, and the other hard drive is mounted, confusion is possible. I think.

              If you stored the PDF in a PDFs folder in the same location as the database, the path is simple and less prone to error.
              This would require that the folder on your computer in the FilemakerPro folder in the Applications folder on your hard drive be mounted by your assistant

              • 5. Re: Novice question about paths & filenaming
                Sorbsbuster

                Are you trying to use a global variable,  '$Jobs:: ' etc to build up a field reference?  I don't think you can do that...

                I would try binning all the calculation and variable parameters, and saving the file as a text expression to where you want it to go, say:

                Filemac:/AsADouglasDesktop/PDFReports/Tests/MyFirstReport.pdf

                If that doesn't work: stop.  If it does work, swop one bit for a $Variable, like the report name.  If that works, swop another bit for a calculation, like the Desktop Path.

                At each debug attempt I would put in a Custom Dialogue that shows what the proposed pathname will be.  You can then check that against what you expected.  A lot of us have been there.

                • 6. Re: Novice question about paths & filenaming
                  SeattleSquirrel

                  Thank you so much for your patience - I clearly need to get FileMaker for Dummies - this is challenging for me.

                  I am working with the "Specify Output File" window., under the "Save Record as PDF" script to write this out.

                  Set Variable [ $path; Value:Get ( DesktopPath ) & "filename.txt" ]  << This gives me then the error that says "There's a problem with one of the file paths in the list. Please correct the syntax..."

                  All I want to do I save the PDF to my desktop, named as "JobID.pdf"  (Job ID being the records' #) - and then I want that same function to work when my assistant opens filemaker on her machine. The actual filemaker database sits on a server. Seems it would be so easy! :)

                  • 7. Re: Novice question about paths & filenaming
                    SeattleSquirrel

                    Holy cow! I did it!!! I'm beeming with pride! :-) Thank you so much everyone!

                    For anyone else finding this thread later, I wanted to take an opportunity to explain what I did in completely novice terms.

                    I have never worked with the Control function command "Set Variable" - I have gotten away with using the more obvious ones such as "Find Record"  or "Go To Layout" - but that command was the key to making this work.

                    My mistake was trying to incorporate what everone was saying in all articles under the "Save as PDF" function. But without having set the variable seperately this did obviously not work. Here's what it looked like at the end:

                     

                    • 8. Re: Novice question about paths & filenaming
                      Sorbsbuster

                      Maybe just put the champagne on ice for a mo...  Sorry.

                      I think you've tried this, and it worked.  You may even have tried it on your assistant's machine, and it worked.  But please note that they will not be able to open the file that you saved.  The files that you save are for you, and the files they save are for them.  If you want the files to be available to anyone who uses the database (a very common requirement) you have to modify the approach.  (It doesn't matter that the file is hosted on a server.)

                      If that was what you wanted anyway, get the champers back out again.