6 Replies Latest reply on Apr 22, 2015 11:32 AM by philmodjunk

    Save PDF, put PDF

    Gilo

      Title

      Save PDF, put PDF

      Post

      Hi

      I want to use a script, which creates me a letter, which i can print manually, and which the script saves as pdf and then adds into a container field. But I always get the error message, that the pdf cannot be found.

      As I use FM on Mac and PC, i would need a solution for both platforms. I access a FM DB on a Mac Server, which shares the DB thru Filemaker 13 Pro Advanced, NOT FM Server.

      Here's what I have and does not work:

      set var ($Filename; Value: "name.pdf")
      set var ($PDFPath; Value: Get(DocumentPath) & $Filename)
      Save Records as PDF (No Dialog; "$PDFPath"; all found records)
      ....
      ....
      GoTo Field (Select/Execute; documents::doc_containerfield)
      insert PDF ("$PDFPath")

      And here i get the error message. 
      but why? Saving and getting is the same path as it is the same var. 

      Can someone help?

        • 1. Re: Save PDF, put PDF
          philmodjunk

          I am assuming that you've checked to be sure that the PDF is being created and saved to your documents folder.

          Either something is changing the value of $PDFPath or you haven't entered the exactly correct variable name in InsertPDF without quoting it. What you show here is a typed in script sample, so I can't be sure it's an exact match to your original...

          You might put a show custom dialog with $PDFPath in it just before the Insert PDF step to see if the correct text appears in the custom dialog.

          Note: I frequently copy and paste variable names from the initial script step that creates the variable to other script steps that reference it just to be sure that I haven't accidentally introduced a typo that results in the other step referring to a different and non-existent variable.

          • 2. Re: Save PDF, put PDF
            Gilo

            Hi

            Yes I checked, and the pdf is created in my documents folder.

            I can't copy paste my script into my post, so to show you. 

            I tried the custom dialog where i get /boot/user/gilles/documents/file.pdf. But if I try in Finder the GoToFolder, he can't find that folder. For saving it works.... 
             

            Don't have a clue why?!?!

            • 3. Re: Save PDF, put PDF
              philmodjunk

              I can't copy paste my script into my post, so to show you.

              To post a script to the forum:

                     
              1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
              2.      
              3. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
              4.      
              5. If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
              • 4. Re: Save PDF, put PDF
                Gilo

                Great thank you

                Variable setzen [ $$adr; Wert:clients::client_resilauto_compagnie ]

                Variable setzen [ $$etnum; Wert:clients::client_etiquettes_num ]

                Wenn [ Hole ( ScriptParameter ) = "Auto" ]

                Gehe zu Layout [ “Resiliation Auto” (clients) ]

                // Aktuellen Datens. ausschließen

                // Nur Ausgeschlossene anzeigen

                Seitenansichtsmodus aktivieren

                Fenster anpassen [ Alles anzeigen ]

                Drucken [ ]

                Variable setzen [ $FileName; Wert:"axabonvinires.pdf" ]

                Variable setzen [ $$PDFPath; Wert:Hole ( DokumentenPfad ) & $FileName ]

                Eigenes Dialogfeld anzeigen [ Mitteilung: $$PDFPath; Standardtaste: “OK”, Schreiben: “Ja”; Taste 2: “Abbrechen”, Schreiben: “Nein” ]

                Datensätze als PDF speichern [ Dateiname: “$$PDFPath”; Alle aufgerufenen Datensätze ] [ Dokument - Kompatibilität: Acrobat 5 und höher ] [ Seiten - 1; Aufnehmen: Alle Seiten ] [ Sicherheit - Drucken: Hohe Auflösung; Bearbeiten: Alle außer dem Extrahieren von Seiten; Kopieren aktivieren; Bildschirm-Leser aktivieren ] [ Anfängliche Ansicht - Anzeigen: Mit Seitenminiaturen; Seitenlayout: Einzelne Seite; Vergrößerung: 100% ] [ Ohne Dialogfeld ]

                Sonst

                Gehe zu Layout [ “Resiliation Contrat” (clients) ]

                // Aktuellen Datens. ausschließen

                // Nur Ausgeschlossene anzeigen

                Seitenansichtsmodus aktivieren

                Fenster anpassen [ Alles anzeigen ]

                Drucken [ ]

                Variable setzen [ $FileName; Wert:"axabonvinires.pdf" ]

                Variable setzen [ $$PDFPath; Wert:Hole ( DokumentenPfad ) & $FileName ]

                Datensätze als PDF speichern [ Dateiname: “$$PDFPath”; Alle aufgerufenen Datensätze ] [ Dokument - Kompatibilität: Acrobat 5 und höher ] [ Seiten - 1; Aufnehmen: Alle Seiten ] [ Sicherheit - Drucken: Hohe Auflösung; Bearbeiten: Alle außer dem Extrahieren von Seiten; Kopieren aktivieren; Bildschirm-Leser aktivieren ] [ Anfängliche Ansicht - Anzeigen: Mit Seitenminiaturen; Seitenlayout: Einzelne Seite; Vergrößerung: 100% ] [ Ohne Dialogfeld ]

                Ende (wenn)

                Gehe zu Layout [ “Etiquettes” (Etiquettes) ]

                Suchenmodus aktivieren [ ]

                Feldwert setzen [ Etiquettes::etiq_count; "x" ]

                Ergebnismenge suchen [ ]

                Wenn [ Hole ( AnzahlGefundeneDatensätze ) ≠ 1 ]

                Eigenes Dialogfeld anzeigen [ Titel: "Erreur"; Mitteilung: "Un problème est survenu. Veuillez contacter Gilles"; Standardtaste: “OK”, Schreiben: “Ja” ]

                Aktuelles Script verlassen [ ]

                Ende (wenn)

                Alle Datensätze anzeigen

                Feldwert setzen [ Etiquettes::etiq_exp; $$expet ]

                Feldwert setzen [ Etiquettes::etiq_adres; $$adr ]

                Gehe zu Layout [ “etiquettes print” (Etiquettes) ]

                Seitenansichtsmodus aktivieren

                Drucken [ ]

                Wenn [ Hole ( LetzteFehlerNr ) = 1 ]

                Gehe zu Layout [ “Etiquettes” (Etiquettes) ]

                Suchenmodus aktivieren [ ]

                Feldwert setzen [ Etiquettes::etiq_count; "x" ]

                Ergebnismenge suchen [ ]

                Feldwert setzen [ Etiquettes::etiq_exp; "" ]

                Feldwert setzen [ Etiquettes::etiq_adres; "" ]

                Sonst

                Gehe zu Layout [ “Etiquettes” (Etiquettes) ]

                Suchenmodus aktivieren [ ]

                Feldwert setzen [ Etiquettes::etiq_count; "x" ]

                Ergebnismenge suchen [ ]

                Feldwert setzen [ Etiquettes::etiq_exp; "" ]

                Feldwert setzen [ Etiquettes::etiq_adres; "" ]

                Feldwert setzen [ Etiquettes::etiq_count; "" ]

                Alle Datensätze anzeigen

                Gehe zu Datens./Abfrage/Seite [ Nächste(r) ]

                Wenn [ Hole ( LetzteFehlerNr ) = 101 ]

                Gehe zu Datens./Abfrage/Seite [ Erste(r) ]

                Ende (wenn)

                Feldwert setzen [ Etiquettes::etiq_count; "x" ]

                Ende (wenn)

                Variable setzen [ $$varbutton; Wert:"" ]

                Fenster schließen [ Aktuelles Fenster ]

                Gehe zu Feld [ documents::doc_description ]

                Gehe zu Ausschnittreihe [ Auswahl; Letzte(r) ]

                Feldwert setzen [ documents::doc_description; "résilitation "&clients::client_resilauto_pol1 &" "& clients::client_resilauto_pol2&" "&clients::client_resilauto_pol3&" "&clients::client_resilauto_pol4&" "&clients::client_resilauto_pol5&" "&clients::client_resilauto_pol6 ]

                Gehe zu Bezugsdatensatz [ Aus Tabelle: “documents”; Mit Layout: “DocumentPreview” (documents) ]

                Gehe zu Feld [ documents::doc_document ] [ Auswählen/Ausführen ]

                Eigenes Dialogfeld anzeigen [ Mitteilung: $$PDFPath; Standardtaste: “OK”, Schreiben: “Ja”; Taste 2: “Abbrechen”, Schreiben: “Nein” ]

                PDF einfügen [ “$$PDFPath” ]

                Gehe zu Layout [ “Données clients” (clients) ]

                Unfortunately its in german :-( Is there a way to translate it? 

                It seems that the /boot/ part of the path is causing the problem. In gotoPath in Finder I can reach /users/ but not boot/users/. But when saving as pdf, the problem does not show.... 

                • 5. Re: Save PDF, put PDF
                  Gilo

                  ok I've changed InsertPDF from $$PDFPath to imagemac:$$PDFPath and now it works.

                  If i use imagemac and imagewin in the same parameter, does FM check which system the user uses and selects the right image or do I have to do an IF-Statement??

                  • 6. Re: Save PDF, put PDF
                    philmodjunk

                    Good catch. I forgot about that detail as I usually use insert file....

                    You'd need to use a calculation that checks to see if the current user is on a mac or windows system and use the text that is appropriate for that platform.

                    Get(SystemPlatform) for example returns different values as determined by whether the user is on a Mac, Windows or iOS system.