12 Replies Latest reply on May 13, 2011 1:49 PM by philmodjunk

    ?script for viewing PDF docs with WEB VIEWER



      ?script for viewing PDF docs with WEB VIEWER



      I have a database program that requires viewing of multiple PDF documents. I am trying to view these PDFs with web viewer, but the script that I write always comes up with 'file not found'. 

      My files are in a folder called "VAS PDFs".

      The script I link this to is:

      "file://volumes/Macintosh HD/library/filemaker server/data/documents/VAS PDFs/" & $$PIX

      Your help would be much appreciated. 

      Thank you. 

        • 1. Re: ?script for viewing PDF docs with WEB VIEWER

          Don't have a Mac so I can't confirm whether you FilePath to /VAS PDFs/ is correct. Nor can I see the value of $$PIX here.

          You might try this expression:

          "File:" & Get ( DocumentsPath ) & "/VAS PDFs/" and $$PIX

          • 2. Re: ?script for viewing PDF docs with WEB VIEWER

            Thanks PMJ - unfortunately that did not work. The file path to the desired folder is correct in terms of directories/subdirectories. Any other suggestions? 

            • 3. Re: ?script for viewing PDF docs with WEB VIEWER

              yes, spaces in names of the path will not help, try removing them or use an underscore in place of all spaces.

              example: VAS_PDFs

              • 4. Re: ?script for viewing PDF docs with WEB VIEWER

                wait, let me be more specific here...I thought about how I said that LOL.

                The path will still need to be correct of course, I am sure you know that Adrian, but my thinking is other people will follow your thread later to learn so I wanted to be very specific about my statement and exactly what I meant.

                If your path is: /my/little file/path

                You can't just change what you have in your solution to /my/little_file/path

                You would have to either put the documents you are calling to in a new directory that will have no names inside it's path that contain spaces....OR you will go through each directory in the path up to your calling directory and physically change each directory name, so that none of the names in your path will have spaces in them. AND the easiest way to do that is to simply replace all the spaces with an underscore _.


                Granted this may not be the fix, but I do know (being a UNIX & LINUX lover) that UNIX-like operating systems, like UNIX itself, do not like character spaces. As you know, OS X is FreeBSD (a flavor of UNIX - one of the first freely available for students in fact) with a windowing system running over the top of it.

                Disclaimer to my Mac friends: Although changes are made and functions are designed to give you a unique Mac users experience, and even though I enjoy Macs myself...yes, it now runs just like any LINUX or FreeBSD system has always run, a Windowing system for GUI on top of one of the many flavors of UNIX. In this case the original copycat of UNIX, FreeBSD. Smart guy that Steve!  ;)

                • 5. Re: ?script for viewing PDF docs with WEB VIEWER

                  Thanks rjl

                  The only 'space' is in the folder name (VAS PDFs); each file within that folder has a specific reference that contains no spaces. eg 001-Ref1.pdf

                  I then enter that file name in my database's look up table. It tries to run that script in my first post, but comes up with 'file doesn't exist'. So I suspect it is because the path leading to it is incorrect, but I've tried many combinations and even pasted the folder on my desktop to limit the subdirectories it looks up but to no avail. I will try taking the space out of the folder name and let you know. 

                  • 6. Re: ?script for viewing PDF docs with WEB VIEWER

                    no luck. 

                    Perhaps you can tell me a better way to look at PDFs within FMP databases? I run the database from FM server so can store all images on the server (Mac mini) - I tried using a container but it only displayed the first page of a set of documents. 

                    • 7. Re: ?script for viewing PDF docs with WEB VIEWER


                      try puttin ur pdf  file directly under "My Documents", and use (Get (DocumentsPath) )


                      • 8. Re: ?script for viewing PDF docs with WEB VIEWER

                        There's a typo in my original suggestion.

                        Try Embarassed

                        "File:" & Get ( DocumentsPath ) & "VAS PDFs/" and $$PIX

                        Instead of:

                        "File:" & Get ( DocumentsPath ) & "/VAS PDFs/" and $$PIX

                        Get (DocumentsPath)

                        should work for you as long as $$Pix contains the correct name and the directory VAS PDFs exists within the documents folder of the current user. It's intended to enable you to reference the documents folder of any Mac or Windows machine so that a system can be more "portable".

                        • 9. Re: ?script for viewing PDF docs with WEB VIEWER

                          Hi again - sorry the delayed response but it's been busy. 

                          Unfortunately it didn't work. Perhaps the script is wrong? I've pasted it below:

                          #*** SET WEB VIEWER ***

                          Go to Portal Row [No dialog; $$PortalRow]

                          Set Field [REF LETTERS Archive::Yellow Selection BG; GRAPHICS 3::YELLOW Highlight Row]

                          If [PATIENTS::SCANS Local|Remote = "Remote"]

                          Set Web Viewer [Object Name: "PIX";URL: "File:" & Get ( DocumentsPath ) & "VAS PDFs/" and $$PIX

                          End If

                          End If

                          Go to field []

                          End if

                          End if

                          • 10. Re: ?script for viewing PDF docs with WEB VIEWER

                            And when/where does $$PIX get its value?

                            Assuming $$PortalRow stores the correct value, the script itself looks to have the correct syntax, but I can't tell what value you have in $$PIX here.

                            • 11. Re: ?script for viewing PDF docs with WEB VIEWER

                              $$PIX refers to the files under the folder heading. 

                              The next query I have is if I run my filemaker server from my mac mini and my target folder is saved on the mac mini hard drive, how do I direct the script such that it selects the mac mini when looking up the folder? (ie they all seem to start with Macintosh HD/users...etc Is there a rule to put in front of the Macintosh HD to make it look at the mac mini directories, not at the computer which is accessing the database?

                              • 12. Re: ?script for viewing PDF docs with WEB VIEWER

                                Yes, but some method must assign a value to it or you have an empty string in that variable.

                                I think you'll need to map the shared directory with a volumne name that you keep the same for all users. I know how to do that on a Windows machine but haven't tried it with Macs. If you use the same mapping/mounting of the shared directory on all your client machines, you then have a common file path that will work with all of them.