4 Replies Latest reply on Dec 14, 2009 8:28 AM by philmodjunk

    This should be simple, but...

    mattb

      Title

      This should be simple, but...

      Post

      All I'm trying to do is, from a script, copy an FP7 file (not the one the script is running from) to another FP7 file.

       

      When I do the equivalent of the following script steps manually (i.e. by making menu choices, not running a script), 

       

      1. open file ("xxx.fp7")

      2. save a copy as [copy]

       

      it works fine.

       

      But when I run the 2 script steps above as a script, it makes a copy of the file running the script, not the file which I opened

      up in step 1.  

       

      Summary:  In running a script from file "A", my intention is to copy file "B" to file "C".  But instead the script copies file "A" to file "C",

      ignoring file "B", which was opened up on top of file "A".

       

      How do I rectify this?

       

       

       

      Matt Bloomfield

        • 1. Re: This should be simple, but...
            

          "save a copy as" will only copy the file it is called from as you have found.

           

          The thing you want to do is

           

          file-manipulation from filemaker pro.

           

          To do that you need a plugin. There a several very good plugins: Troi-FilePlugin (www.troi.com) , PCFilemanipulator (www.productivecomputing.com) and 360ScriptMaster (www.360works.com)  that can help you achieve that. There are more then just these 3 :-)

          • 2. Re: This should be simple, but...
            Steve Wright
              

            You could add a script into the secondary file, which you call from your primary file.

             

            MainDB is open

            Script in main file 

                  Open File : 2ndFile Hidden

                  Perform Script : SaveCopy from 2ndFile

             

            Script in 2nd file

                 Save Copy as : 3rdFile.fp7

             

            In the second file, the script named SaveCopy would need to be added, this means you are then calling the save copy command from the correct file.

            To enable you to call the script from the second file, it will need to exist as a data source in the first file, I beleive 

             

            Hope that makes sense

            • 3. Re: This should be simple, but...
              mattb
                

              SW:

               

              Hey that worked, thanks!  And using a script parameter when calling the external script, it even names the

              copied file with a user-input name, so that's great.  For me, this is preferable to using a 3rd party plugin to

              accomplish the task.

               

               

               

               

              • 4. Re: This should be simple, but...
                philmodjunk
                   If you can do the job acceptably without installing a plug in, that's almost always the better option. I have nothing specific against using plug ins, but each time you install a plug in, you acquire possible additional update/upgrade issues to manage the next time Filemaker Inc. releases a new version of Filemaker Pro.  (Is the plug in compatible with the new version? If not, will the plug in publisher be releasing an upgrade soon?... etc.)