hexagon logo

Dmis Skips Printing Commands?

EDIT: THE SOLUTION TO THIS IS ON PAGE 2




I wrote a bit of code based off of information on this message board for printing at the end of a program.

SAVE       =COMMENT/YESNO,NO,Do you want to save this report?
                            ,This will save a PDF of the report
                            ,on the computer.
            IF/SAVE.INPUT=="YES"
            PRINT/REPORT,EXEC MODE=END,$
              TO_FILE=ON,APPEND=FINALFILENAME,$
              TO_PRINTER=OFF,$
              TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
              REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
              PREVIOUS_RUNS=DELETE_INSTANCES
            END_IF/
PRINT      =COMMENT/YESNO,NO,Do you want to print a report?
            IF/PRINT.INPUT=="YES"
            PRINT/REPORT,EXEC MODE=END,$
              TO_FILE=OFF,AUTO=1,$
              TO_PRINTER=ON,$
              TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
              REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
              PREVIOUS_RUNS=DELETE_INSTANCES
            END_IF/


The variable FINALFILENAME is assigned earlier in the code:

WORKORDER  =COMMENT/INPUT,NO,'Enter the workorder #,
                            ,using a period instead of a slash.'
SERIALNUMBER =COMMENT/INPUT,NO,'Enter the Serial # of the piece being inspected.
                              ,If there is no serial number, leave this blank.'
CLOCKNUMBER =COMMENT/INPUT,NO,'Enter your clock #.'
            ASSIGN/PART=STR(GETTEXT(191,1,{FILEHEDR}))
            ASSIGN/DATE=SYSTEMDATE ("MMddyy")
            ASSIGN/TIME=SYSTEMTIME ("HHmm")
            ASSIGN/FILESTORE="C:\PROGRAM FILES\WAI\PC-DMIS V4.3 MR1\PROGRAM FILES\PROGRAM REPORTS\056-000-460-6\ "
            ASSIGN/FILENAME=PART + "_" + WORKORDER.INPUT + "_" + DATE + "_" + TIME + ".PDF"
            ASSIGN/FINALFILENAME=FILESTORE + FILENAME


I have a program that utilizes marked sets to execute different part operations. All of the marked sets go to the print options at the end. The problem is that when you say YES to print PDF, it just skips over it and moves on. Same thing with YES to the print to Printer. When I hold my mouse over the IF statements, it confirms that it "read" the comment answer as Yes, it just chooses not to execute the PRINT/REPORT statements.

I CAN get it to print to PDF and Printer ONCE. For the PDF print, I just modify the name. Change it to SAVE1. Whatever. And it prints to file, for 1 Execution. For the printer print, I change the printer to another printer and then change it back. And it prints 1 time. AngryAngryAngry

Am I screwing this up somehow with how it is using the variables? Or maybe the marked sets? I am totally lost here, because it worked beautiful in my test program I created.
  • Just for the heck of it, don't use the words "SAVE" and "PRINT" for variables and see what happens. I don't think it will do anything, but it's a thought.
  • I actually changed them to SAVE and PRINT to make my question more clear. I had concerns about naming them that also, so in the program they are named SAVE_REPORT, PRINT_REPORT, things like that. Thanks for the suggestion though.
  • I actually changed them to SAVE and PRINT to make my question more clear. I had concerns about naming them that also, so in the program they are named SAVE_REPORT, PRINT_REPORT, things like that. Thanks for the suggestion though.

    Add a second \ after the C:. Dont ask me why. I don't know, but i've seen it work. I'm sure some BASIC language guru can explain why.

    C:\\PROGRAM FILES\WAI\PC-DMIS V4.3 MR1\PROGRAM FILES\PROGRAM REPORTS\056-000-460-6\

    Also, I would skip the "ASSIGN/FINALFILENAME=FILESTORE + FILENAME" and just put it on one assignment. No real reason other than it seems to add a chance to screw things up. Such as;

    ASSIGN/FINALFILENAME="C:\\PROGRAM FILES\WAI\PC-DMIS V4.3 MR1\PROGRAM FILES\PROGRAM REPORTS\056-000-460-6\" + PART + "_" + WORKORDER.INPUT + "_" + DATE + "_" + TIME + ".PDF"
  • Why don't you just keep one print command (PDF)?

    It's simple and you can always print reports from saved files...my .02
  • To Roberto, Operator simplicity. I want the operator to be asked directly yes or no to print. I don't want him hunting around the Report PDF folder, possibly printing the wrong report. Even if I had the file open on creation, it is just an extra step to wait for Adobe to start up and then find the print button in Acrobat. With this mentality, I am a couple steps closer to having monkeys run the programs. Then the next step is operators!

    To Otto, I will try that as soon as my machine boots up, thanks.
  • I wrote a bit of code based off of information on this message board for printing at the end of a program.

    SAVE       =COMMENT/YESNO,NO,Do you want to save this report?
                                ,This will save a PDF of the report
                                ,on the computer.
                IF/SAVE.INPUT=="YES"
                PRINT/REPORT,EXEC MODE=END,$
                  TO_FILE=ON,APPEND=FINALFILENAME,$
                  TO_PRINTER=OFF,$
                  TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    


    When you input the variable (FINALFILENAME) and tabbed from it, did it give you a message about "variable with the name FINALDFILENAME exists..."? Did you answer "Yes" to that question?

    If I anser "Yes" to that question, it saves the report. If I answer "No", it skips it.
  • ...The variable FINALFILENAME is assigned earlier in the code:

    WORKORDER  =COMMENT/INPUT,NO,'Enter the workorder #,
                                ,using a period instead of a slash.'
    SERIALNUMBER =COMMENT/INPUT,NO,'Enter the Serial # of the piece being inspected.
                                  ,If there is no serial number, leave this blank.'
    CLOCKNUMBER =COMMENT/INPUT,NO,'Enter your clock #.'
                ASSIGN/PART=STR(GETTEXT(191,1,{FILEHEDR}))
                ASSIGN/DATE=SYSTEMDATE ("MMddyy")
                ASSIGN/TIME=SYSTEMTIME ("HHmm")
                ASSIGN/FILESTORE="C:\PROGRAM FILES\WAI\PC-DMIS V4.3 MR1\PROGRAM FILES\PROGRAM REPORTS\056-000-460-6\ "
                ASSIGN/FILENAME=PART + "_" + WORKORDER.INPUT + "_" + DATE + "_" + TIME + ".PDF"
                ASSIGN/FINALFILENAME=FILESTORE + FILENAME


    I have a program that utilizes marked sets to execute different part operations. All of the marked sets go to the print options at the end. The problem is that when you say YES to print PDF, it just skips over it and moves on. Same thing with YES to the print to Printer. When I hold my mouse over the IF statements...


    What about if you hover the mouse pointer over the variable FINALFILENAME? Does it display "C:\PROGRAM FILES\WAI\...." (the file name you want) as the result?
  • The message was something like, the variable FINALFILENAME exists. Does this refer to this variable. I answered yes to that. And when I put the cursor over the variable in the PRINT command code, it comes up with the filename I want. I even copied the filename and entered it into the address bar to make sure it was a valid path.

    PC-DMIS seems to be counting the PRINT commands as finished even though it doesn't execute them. It gets to the IF statements, reads YES, and right after that, the PRINT code immediately turns green in the edit window like it has been executed, though nothing has been done. Not even a pause like it is thinking about the code.

    I know it would be very easy to screw up the PDF printing section, with its variables and operator inputs creating the filename. But this is also skipping right over the print to Printer command. So whatever the problem is, it is affecting both of these. I imagine there is a lot less that could cause PC-DMIS to screw up a basic printing command rather than a custom PDF printing command. But so far everything I try only works for 1 execution.
  • Well, I seem to be able to replicate your problem. Are you placing your cursor in this line

    SAVE       =COMMENT/YESNO,NO,Do you want to save this report?
                                ,This will save a PDF of the report
                                ,on the computer.


    and using ctrl+u or is it not working when you execute the entire program?

    Because, if I try to ctrl+u from my comment line, it will skip the print command whether it is inside the if/end_if or if it is after it. If I put my cursor in the dimension just before the comment line and ctrl+u from there, it works every time. It also seems to work when I run the entire program.
  • To Roberto, Operator simplicity. I want the operator to be asked directly yes or no to print. I don't want him hunting around the Report PDF folder, possibly printing the wrong report. Even if I had the file open on creation, it is just an extra step to wait for Adobe to start up and then find the print button in Acrobat. With this mentality, I am a couple steps closer to having monkeys run the programs. Then the next step is operators!

    To Otto, I will try that as soon as my machine boots up, thanks.



    ..that still sets you up for a 50% chance of Failure..it will happen... Wink