3 Replies Latest reply on Feb 16, 2017 5:56 AM by Prasad Bhonsule

    Dispatch Help - Strip description from file name and set onto file card.

    Prasad Bhonsule

      Hi all, need a bit of help with a Dispatch script I am working on for a customer.

       

       

      Here is a screenshot of their filenaming convention. It is a 7 digit number followed by the description.

       

      I am looking for a way to get only the descriptive part of the name into the file's datacard as a variable.

       

      Attached is a dispatch action file I made a start with but it's not quite working.

       

      Any help/advice would be greatly appreciated.

       

      Kind regards

       

      Prasad Bhonsule

        • Re: Dispatch Help - Strip description from file name and set onto file card.
          Lawson Jones

          Hi Prasad,

           

          I generally find it hard to visualize what is happening in dispatch.  I've outlined the below in excel, but it is the same calculation (although the syntax in dispatch is pretty much the same!). 

           

          You would need to create a series of variables (t_...) which are calculated as the task is run.  This can be done using static strings with values equal to 'length', 'left', 'right' functions.  Once done it is simply a case of:

          'Set Variable Value' of 'Description' to the value of the calculated 't_Description'

           

          Depending on how many files I have, I would consider also calculating the part number and then subsequently renaming the file to that value.  Throw in a "For all files" and you can do it larger groups (test first haha)

           

          I've tried to lay it out logically for you.

           

          Hope the below helps!!!

           

          Dispatch Name Grab.PNG

          • Re: Dispatch Help - Strip description from file name and set onto file card.
            Stavros Smith

            Hello Prasad,

             

            Have they not setup their serial number as " 'Counter-07' '%Description%' ".  If that were the case, they could assign the variable description to the custom props of the solidworks file.

             

            The attached file should work.  I've included a r_NoDigit in the event the serial number changes for whatever reason, if necessary you can set this to a runtime variable and have a user input the number of digits for the numeric portion of the serial number.

             

            Please note that I have not included a jump to check the files State, currently it will write to all documents regardless of the state.

            • Re: Dispatch Help - Strip description from file name and set onto file card.
              Prasad Bhonsule

              Lawson, Stavros, thank you both so much for your replies. I will try both suggestions and get back to you soon.

               

              Best regards

               

              Prasad