11 Replies Latest reply on Jul 6, 2010 10:15 AM by philmodjunk

    Cross platforms and save as Pdf script step

    laneystewart

      Title

      Cross platforms and save as Pdf script step

      Post

      I am developing a database that has always been used by MAC users and I develop on a MAC.  I am using either Filemaker 9 or 10 pro advanced.  I now have a few PC users that are using the database and now I am experiencing problems with the Save as Pdf script step.  

       

      I  have it set up to save the file as a variable including the record name.  The variable is set up as a $filename using the path to our server.  I realized that I use the "filemac:" beginning to the location and that a PC is set up a different file path variable for "filewin:' as the beginning.  

       

      Can I use both of these in the save as pdf script step?

       

      I have tried to set it up as to set the varaible according to the (Get(application platform) but was unsuccessful.  As I have always developed for MAC users and work on a MAC, i am kind of lost.  

       

      Any suggestions or help would be appreciated.

        • 1. Re: Cross platforms and save as Pdf script step
          Orlando
            

          Hi laneystewart,

           

          If the actual file path is the same, apart from the difference in filemac / filewin, try using this calculation in your Set Variable script step in replace of "filemac:" and it should then work.

           

          If ( Abs ( Get ( SystemPlatform ) ) = 1 ; "filemac:" ; "filewin:" )  

           

          Otherwise you could use the same calculation to extent to the whole path if required.

           

          With the Get ( SystemPlatform ) function the values returned are 1 or -1 for a Mac and -2 for a PC.

           

          I hope this helps 

          • 2. Re: Cross platforms and save as Pdf script step
            laneystewart

            OK, so I set this up with the following script steps:

             

             If [Abs (Get (SystemPlatform)) = -2]

            Set Variable [$Filename: Value: "filewin:// My location "& Substitute (TrCr Spring 2008: FullName;" ":"-")&"IntEval.pdf"]

            ElseIf [ [Abs (Get (SystemPlatform)) = 1]

            Set Variable [$Filename: Value: "filemac:/ My location "& Substitute (TrCr Spring 2008: FullName;" ":"-")&"IntEval.pdf"]

            Save Records as PDF [Restore; No dialog; $Filename; Records being browsed]

             

            I initially used Save as Pdf. script step to get an accurate filepath from the PC and copied it directly from the script step to the set variable script step so that I could ensure that the location was not the problem.

             

            I can not get the Save as Pdf from the PC to work.  It keeps giving me an error that I can not save to this location.  I can save a file from the menu bar Save as Pdf and navigating to the location with not trouble but the script step with the variable setting the filepath will not work.  Has anyone else experienced this problem???

             

            Thanks in advance for any help!

             

            • 3. Re: Cross platforms and save as Pdf script step
              DLW-BPEX

              Absolute value cannot be a negative number, so your test fails. Probably want to omit "Abs" from the IF statement for the Windows platform.

               

              David

              • 4. Re: Cross platforms and save as Pdf script step
                laneystewart

                GREAT!!!  Now that part works.......

                 

                OK, so now I want the variable to change if it is a specific year and save to the desktop.  It works for the MAC, but not for the PC with the following:

                 

                set variable [$FILEname; value:Get ( DesktopPath )& Substitute ( TrCr Spring 2007 Old::Full Name; " " ; "_" ) & "TC.pdf"]

                 

                Is there a different set of script steps that I should be using for a PC to get the desktop location??  It tells me that the FILEname can not be saved to this location.


                • 5. Re: Cross platforms and save as Pdf script step
                  fitch

                  I like to break things out for easy reading:

                   

                  Set Variable [ $prefix ; If ( Abs( Get( SystemPlatform ) ) = 1 ; "filemac:" ; "filewin:" ) ]
                  Set Variable [ $Filename ; Substitute( TrCr Spring 2008: FullName;" ":"-" ) & "IntEval.pdf" ]
                  Set Variable [ $FilePATH ; $prefix & "My location" & $Filename ]
                  Save Records as PDF [ Restore; No dialog; $FilePATH ; Records being browsed]

                   

                  Aside from the Abs error, I noticed you had two slashes in the filewin path vs. one in filemac. If that's needed, just add it to the $prefix. And you have a space after "My location" which may not be intentional.

                   

                  Edit: never mind, I see you got it working, glad to hear it.

                  • 6. Re: Cross platforms and save as Pdf script step
                    fitch

                    Could be a beginning or ending slash tripping you up.

                    http://www.fmforums.com/forum/showtopic.php?tid/187509/

                    • 7. Re: Cross platforms and save as Pdf script step
                      laneystewart

                      OK, so it appears that the error was due to the fact that the computer this user was working on did not recognize the font in the document.  SO, now that I have it working to save to the right location, I try to open the document and get this error from my MAC:

                       

                      There was an error opening this document. There was a Macintosh system error (-5000).

                       

                      AND this error from my parallels Windows Environment:

                       

                      There was an error opening this document.  Access denied.

                       

                      The user can open the document with no trouble, but I, on my MAC ( and in my parallels Window environment) can not access the document.  Any ideas on why and how I can fix it?????

                      • 8. Re: Cross platforms and save as Pdf script step
                        laneystewart

                        OK, so I have found that this is a problem with FM 11 thru a report a bug topic here on this forum, and read about the solutions BUT now can not get the solution to work OR find the page again...... UGH  (found it!!)

                        http://forums.filemaker.com/posts/43d2b4bfc4

                        Here is what I can use help with now:

                        Using FMP 11 on MAC OSX 10.5.8 on a hosted DB from Windows 2003 FMS V10

                        I am feeling pretty stupid here but need some help.......I have a user using FMP11 on this hosted Db that has been having trouble producing a .pdf that is viewable to others  See my posts here: http://forums.filemaker.com/posts/445295eee8

                        ok, so I tried these solutions with no success :

                        Set Variable [$_myFileName; "filewin:/F:/foo/bar/myfile.pdf"] //Variable to pass to Save Records as PDF

                        Save Records as PDF [$_myFileName] //Do the Save

                        Set Variable [$_fileToFix; Right($_myFileName;Length($_myFileName)-9)]  //removes preceding "filewin:/" text from saved path above

                        Set Variable [$_fixCommand; "cmd /c icacls \"" & $_fileToFix & "\" /reset" //gives me a string that reads: cmd /c icacls "F:/foo/bar/myfile.pdf" /reset

                        Send Event ["aevt";"odoc";$_fixCommand] //the call to the windows command prompt (Send Event -> Open Document) which fixes the file.

                         and the shorted version:

                        Send Event ["aevt";"odoc";"cmd /c icacls \"" &Substitute ( $FilePath; ["filewin:" ; ""] ; ["/" ; "\\"] ) & "\" /reset"]

                        I am making the script changes on my MAC and have never used Send Event before.  When I open the send event script step I have chosen Open Document and entered a calculation with the statements as well as tried the do script option with the statement in it.

                        It ends up looking like:

                        Set Variable [$filetofix; Value:Right($FILEname;Length($FILEname)-10)]  

                        Set Variable [$fixcommand; Value:"cmd /c icacls \"" & $filetofix & "\" /reset"

                        Send Event ["<unknown>" ;"aevt";"odoc";$fixcommand]


                        What I am REALLY unsure of is that it asks me to choose a target application.  What would this be???  I am not on the server that FMS V10 is on and because I am on a Mac I can not open the windows command prompt..... Can anyone help me thru this so that my user can save the .pdf's that she needs to from her location???  ANY help would be appreciated!!!

                        • 9. Re: Cross platforms and save as Pdf script step
                          philmodjunk

                          I use this script step on a windows system with no trouble:

                           Set Variable [$Path ; Value: "file:" & Get ( DesktopPath ) & "filename.PDF"]

                          I think this will work on the Mac also. What you have to look out for is to make sure you don't use any illegal characters such as \ in the file name.

                          • 10. Re: Cross platforms and save as Pdf script step
                            laneystewart

                            I got the save to the desktop working AND the save to a specific location from wither platform.  Now when the user saving from a PC to a file share saves a .pdf no one but them can open it.  This is where it goes back to the other post http://forums.filemaker.com/posts/445295eee8.  I believe that the permissions that the PC gives the document when using the save as .pdf script step, does not allow any others to view the document on that file share.  I will have the user do the update for FM V11.02 and hope that it fixes the problems......

                            • 11. Re: Cross platforms and save as Pdf script step
                              philmodjunk

                              If they are saving the PDF, to a shared directory, then indeed this is the bug described in the other link: 

                              FM Pro v11 and "Save as PDF" permission bug - Windows

                              And the updater is supposed to fix that issue.