hexagon logo

Saving Pdf and Csv reports without prompting the user

Currently I am trying to write a C# app that will run a PCDmis program and then save the reports with specific names, in a specific folder based on some inputs from another source. I found an example of what I'm trying to do but it involves changing the prg file directly and I was wondering if I can do the same thing in C#?

I found this code from from 2021 but it's an embedded script.

GROUP_PRINT_COMMANDS=GROUP/SHOWALLPARAMS=YES
ASSIGN/NUMOOT=GETPROGRAMINFO("NUMOOT")
ASSIGN/PROG_NAME=GETPROGRAMINFO ("PARTNAME")
ASSIGN/DATE=STR(SYSTEMDATE ("dMMMyyyy"))
ASSIGN/TIME=STR(SYSTEMTIME ("HHmmss"))
ASSIGN/REJECT="____REJECT____"
IF/NUMOOT=="0"
ASSIGN/REPORT_NAME="O:\\CMM PROGRAMS\\CMM_PDF_PC DMIS\\AG0OFFLINETEST\\"+PROG_NAME+"__"+VAR_SERIAL_ NUMBER+"__"+VAR_RUNNUMBER+"__"+DATE+"__"+TIME+"__. PDF"
END_IF/
ELSE/
ASSIGN/REPORT_NAME="O:\\CMM PROGRAMS\\CMM_PDF_PC DMIS\\AG0OFFLINETEST\\"+PROG_NAME+"__"+VAR_SERIAL_ NUMBER+"__"+VAR_RUNNUMBER+"__"+DATE+"__"+TIME+"__" +REJECT+".PDF"
END_ELSE/
PRINT/REPORT,EXEC MODE=END,$
TO_FILE=ON,AUTO=1,AUTO OPEN=OFF,$
TO_PRINTER=OFF,COPIES=1,$
TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME= [B]REPORT_NAME[/B],$
REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
TO_EXCEL=OFF,$
PREVIOUS_RUNS=KEEP_INSTANCES
ENDGROUP/ID=GROUP_PRINT_COMMANDS
Parents



  • SCRIPT:
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,APPEND=G:\My Drive\My Folder\Customer Inspections\Reports\Customer\9-03\RM-51\#1.PDF,AUTO OPEN=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=[B]REPORT_NAME[/B],$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    TO_EXCEL=OFF,$
    PREVIOUS_RUNS=DELETE_INSTANCES
    


    I have literally spent all day tinkering with this code and cannot get it to work. This feels insanely complicated for something that seems like it should be easy. Can anyone see what the heck I'm doing wrong?


    Are you writing to the G drive location?

    Are you using the "REPORT_NAME" function in FILENAME?

    If you're trying to use both, that could be the combatting factor.

    the can be removed. I think Dan tried bolding those, but that functionality doesn't work in the code function.
  • Is 'REPORT_NAME' a function? I think I was assuming it was just a variable name. I think I renamed it to be PDF_REPORT_NAME. Maybe that's the issue.
Reply Children
No Data