4 Replies Latest reply on May 3, 2013 12:35 PM by hamrichards

    Script Steps Copy and Paste fail

    hamrichards

      Summary

      Script Steps Copy and Paste fail

      Product

      FileMaker Pro

      Version

      FMP Advanced v.12.4

      Operating system version

      Mac OS X 10.8.3

      Description of the issue

      The two script steps Copy and Paste are not working in FMPA 12.0v4. The failure of Paste is revealed by running the script shown in "Steps to reproduce the problem" after using Copy in another application to load the clipboard. The failure of Copy is revealed by pasting into a text file after running the script.

      When the same script is run in FMP Advanced 11.0v4, it shows that Copy and Paste work correctly.

      Steps to reproduce the problem

      Run this script:

      Show Custom Dialog ["Copy-Paste Test"; Global::CopyPasteTest1]
      Copy [Select; Global::CopyPasteTest1]
      Set Field [Global::CopyPasteTest2; "PASTE FAILED"]
      Paste [Select; No style; Global::CopyPasteTest2]
      Show Custom Dialog ["Copy-Paste Test Result"; Global::CopyPasteTest2]

      Expected result

      Second dialog shows the text input into first dialog.

      Actual result

      Second dialog shows "PASTE FAILED".

      Exact text of any error message(s) that appear

      No error messages.

      Configuration information

      I can't think of anything else.

      Workaround

      None.

        • 1. Re: Script Steps Copy and Paste fail
          Fred(CH)

               Hi hrichards,

               Thank you for posting.

               I cannot replicate this issue, except if one or both fields are not included on the layout where the script is executed.

               Please note that most of Edit steps require an enterable focused field's object on layout where they are performed.

               Behind this, Copy and Paste steps are supposed to be similar to their related menu command.

               You can modify your script by doing directly a Set Field, thus bypassing the system clipboard :

          Set Field [Global::CopyPasteTest2; Global::CopyPasteTest1]

               Bye, Fred

          • 2. Re: Script Steps Copy and Paste fail
            hamrichards

                 Fred, many thanks for the correction. Having programmed for many years in conventional languages, I sometimes overlook the significance of layouts in FM scripts.

                 The reason the FMPA 11 test doesn't fail is that it's a one-off ad hoc file with a default layout which includes those two fields. The FMPA 12 test was part of a much larger system, and in the layout effective when the script was running, those two fields were missing.

                 Concerning your suggestion to bypass the system clipboard, I actually need to use it. The real purpose for using Paste is to obtain a file path copied to the clipboard by this AppleScript script:

                               "set the clipboard to (choose folder with prompt "Choose a folder") asstring"

                 If FMP had a Choose Folder script step, I wouldn't have to use AppleScript's choose folder, but I sure haven't found one.

                 Again, thanks,

                 --Ham

            • 3. Re: Script Steps Copy and Paste fail
              philmodjunk

                   AppleScript can set a value in a Filemaker Field so are you sure you need to use the clipboard?

              • 4. Re: Script Steps Copy and Paste fail
                hamrichards

                     Thanks for the question, Phil. The clipboard is eliminated in this script:

                     tell application \"FileMaker Pro Advanced\"¶
                     set data field \"Global::folderPath\" to (choose folder with prompt \"" & $prompt & "\") as string¶
                     end tell
                      
                     --Ham