Serial number as filename?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Serial number as filename?

    Im new to pcdmis. I searched the forums but couldnt find the answer so i apologize in advance for such a noob question.


    I want to set up a program to automatically save the report to a specified directory using the serial number the operator entered for the filename.

    basic example,
    if the operator entered serial number 12345 i want the file to go to
    c:\results\12345.rtf

    thanks in advance for any help

  • #2
    The simplest way to do it...At the end of your program go Insert - Report Command - Print Command. Then place your cursor in the command and hit F9. Select "to file", select "Prompt", click on the little browse button next to the file name (it works even if the file name is greyed out). Navigate to the folder where you want to go and enter "type serial number here" for the file name. Click "Save", click "OK", mark the command for execution.

    Now when the program is done it will pop up a window for your operator to save the report. If you make the program read-only, whenever it pops up it will have "type the serial number here" in the file name box. They just need to change that to the serial number and click save.

    If your serial numbers are sequential (1,2,3,4,etc) you can play with having it auto index (use the same command and select the appropriate box) and it will add 1 each time it saves and your operator doesn't have to do anything. If you go this route though you can't make your program read-only.

    I guess it boils down to if you can trust your operator(s) to enter the serial number and click save.

    Comment


    • #3
      I made a small .BAT file:

      Code:
      DEL SERIAL*.PDF
      COPY *.PDF SERIAL.PDF
      It first deletes all "old" PDF file of the type serial. Then it copies the REPORT file to the name SERIAL.PDF.

      If you want to use the serial number as the file name, you will have to create a SCRIPT if you want to do this automatically.


      Jan.
      ***************************
      PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
      Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

      Comment


      • #4
        thanks for the help guys. i figured out how to get it working the way i wanted with variables. heres what i did:

        C1 =COMMENT/INPUT,YES,'SERIAL NUMBER'
        ASSIGN/V1 = C1.INPUT+".RTF"
        ASSIGN/V2 = "c:\results\SN_"
        ASSIGN/V3 = V2+V1


        PRINT/REPORT,EXEC MODE=END,$
        TO_FILE=ON,OVERWRITE=V3,$
        TO_PRINTER=ON,DRAFTMODE=OFF,$
        TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME= ,$
        REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMEN SIONS=NO,$
        PREVIOUS_RUNS=DELETE_INSTANCES

        Comment


        • #5
          Originally posted by gopher View Post
          thanks for the help guys. i figured out how to get it working the way i wanted with variables. heres what i did:

          C1 =COMMENT/INPUT,YES,'SERIAL NUMBER'
          ASSIGN/V1 = C1.INPUT+".RTF"
          ASSIGN/V2 = "c:\results\SN_"
          ASSIGN/V3 = V2+V1


          PRINT/REPORT,EXEC MODE=END,$
          TO_FILE=ON,OVERWRITE=V3,$
          TO_PRINTER=ON,DRAFTMODE=OFF,$
          TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME= ,$
          REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMEN SIONS=NO,$
          PREVIOUS_RUNS=DELETE_INSTANCES
          Didn't this ASSIGN/V2 = "c:\results\SN_" turn red on your screen? I'm toying with a similar thing to prevent the inevitable "Hey, did you keep an electronic copy of this? They want me to email it to them."

          TK
          sigpicHave a homebrew

          Comment


          • #6
            If I just put the path where I wanted the file to save, then yes, the variable would turn red and not work.

            If I added something in the beginning, like the SN_ that made it work. I dont know why that would make a difference, but it works for me.

            Comment


            • #7
              Thanks, gopher. I got my file save thing working by just setting up the reporting to a folder with the program name and an index #. I didn't need operator input in this case. While fiddling around with this idea I ran across the "red" problem, I appreciate your sharing your discovery.

              TK
              sigpicHave a homebrew

              Comment


              • #8
                What version are you using? And also what are your edit window print settings? I've tried to get this to work before but never had any luck in version 3.7 MR3.

                Comment


                • #9
                  Follow Goodluck's post, it'll work.

                  PRINT/REPORT,EXEC MODE=END,$
                  TO_FILE=ON,AUTO=2,$
                  TO_PRINTER=OFF,DRAFTMODE=OFF,$
                  TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
                  REPORT_THEORETICALS=ALL,REPORT_FEATURE_WITH_DIMENS IONS=YES,$
                  PREVIOUS_RUNS=KEEP_INSTANCES

                  3.7 mr3

                  TK
                  sigpicHave a homebrew

                  Comment


                  • #10
                    If the last character in a string that represents a directory path is a back-slash put two of them. ie "c:\PCDMIS\programs\SMS\datadir\\"

                    Comment


                    • #11
                      I kind of got this to work. The only problem is that it only works once, then I have to restart PC-DMIS to get it to work again. It will use the name I give it when I ask for a serial number the first time, then when I run it again it still uses the serial number from the first run as the file name. When I open the .pdf file it lists the correct serial number in the report but the file name is from the first run. Any ideas????

                      Comment


                      • #12
                        Originally posted by kneislyd View Post
                        If the last character in a string that represents a directory path is a back-slash put two of them. ie "c:\PCDMIS\programs\SMS\datadir\\"
                        I'm not doubting that to work at all, but I am curious - in what documentation did you find that?
                        Links to my utilities for PCDMIS

                        Comment


                        • #13
                          Here is what I am doing,
                          1 =COMMENT/INPUT,YES,'Part Number:'
                          ASSIGN/V1 = C1.INPUT+".pdf"
                          ASSIGN/V2 = "H:\CMMPrograms\Reports\\"
                          ASSIGN/V3 = V2+V1
                          .
                          . Marked set of the program
                          .
                          PRINT/REPORT,EXEC MODE=END,$
                          TO_FILE=ON,OVERWRITE=V3,$
                          TO_PRINTER=OFF,DRAFTMODE=OFF,$
                          TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME= ,$
                          REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMEN SIONS=NO,$
                          PREVIOUS_RUNS=DELETE_INSTANCES

                          Comment


                          • #14
                            Originally posted by cmmguy View Post
                            I'm not doubting that to work at all, but I am curious - in what documentation did you find that?
                            Didn't find it in PCDMIS documentation. When I ran into this problem in PCDMIS I was able to determine the slash at the end of the string was the culprit. This told me that for some reason PCDMIS is scanning string literals for special characters of which the back slash is one. But only the back slash at the end of the string is the problem. Typically, in other languages, when you want to use the special character as a normal character you enter it twice. See any documentation on using 'Regular Expressions'.

                            Comment

                            Related Topics

                            Collapse

                            Working...
                            X