hasenmaus

AppleScripts and Field Contents

Discussion created by hasenmaus on Mar 10, 2017
Latest reply on Mar 13, 2017 by BruceRobertson

I would like to extract the value of field in Filemaker Pro 11 and concatenate the field value as text to a defined string constant. The concatenated string would then be used to open a file stored locally on my computer.

 

For example if the value contained in a text field called InvoiceNumber was "79121". I would like to extract the value "79121" from the field and concatenate it to two other fields to form the string "/Users/hasenmaus/Desktop/VetInvoices/Inv_" & FieldValue(79121)  & ".pdf". That concatenated string would be the path to have say Adobe Reader open the file and have its contents displayed in Adobe Reader. Can this be done in FMP v11?

 

 

AppleScript attached to a Filemaker Pro button and fires when pressed by the user

 

tell application "Adobe Reader"

   

    activate

   

    try

       

        set the chosenDocumentFile to ¬

            "/Users/hasenmaus/Desktop/VetInvoices/Inv_79121.pdf"

       

        open the chosenDocumentFile

       

    on error errorMessage number errorNumber

       

        if errorNumber is not -128 then

            display alert errorNumber message errorMessage

        end if

       

    end try

   

end tell

Outcomes