7 Replies Latest reply on May 4, 2016 9:40 PM by Ashlin

    Remove appended file number when updating/replacing container field

    Ashlin

      I currently have a script to save container data externally.

       

      It exports contents from a global temp container to Get(TemporaryPath) renaming the file in the process and then inserts it into the target field.

       

      Everything works well except that if you perform the script multiple times with the same savepath it appends a file number on the end of the saved document e.g. FILE_01.pdf, next time FILE_02.pdf

       

      The filename in FMP doesn't show this increment in the container, i.e. GetAsText(Container) will return "FILE.pdf" even though the actual document in Windows is named "FILE_01.pdf".

       

      It's as if FMP thinks there's already a file with that name in the directory, even though there's not.

       

      Clearing/Deleting the container contents beforehand doesn't seem to reset the counter so every time script is run it increments the number regardless of whether there is any container contents or file/document in the temp directory OR the container directory.

       

      I've tried an alternative approach with 'renaming' the document using Base64Decode script but that results in the same problem in addition to saving two copies of the container contents, one with old name, one with new.

       

      Is there a way to stop FMP from counting how many times I've saved container field contents?

       

      Current Script:

       

      I was going to paste current script here but don't how to do that. Is there a way to export script steps as text?