hexagon logo

VBScript for reports

Hello everyone,

I got a problem.. Slight smile When the measurement ends I want to save report to specific location, depending on where the part was made (we have same part, but we make it on 2 machines)..
I am using PRINT command, but it sometimes saves blank .rtf report for no reason. so I thought, that maybe using script would be better and more secure, but my scripting knowledge is really limited at the moment, since I just started to do scripting.

I tried to get it working with some scripts, but no luck.

Does anyone have any syntax or code example that I could check and make it work ?
Basically, when measurement ends, msgbox opens and you have to choose(checkbox/list/buttons) the destination where it should save report, which has to be .rtf because we use them in some other programs for statistic.

Thank you for help, D.
Parents
  • This works really well for me. I am saving as pdf but I imagine you can make this an rtf.

    I have two sections of code for all my programs.

    The first section is the header:

    FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ; , , , , , ,
    CAL =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter Machine Calibration Date
    PART =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter part number you are running
    JOB =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter job number
    PROJECT =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter project number
    REQUESTER =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter requester name
    INSPECTOR =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter inspectors initials
    ASSIGN/TEMP="N/A"
    ASSIGN/HUMID="N/A"
    ASSIGN/CAL_DATE=CAL.INPUT
    ASSIGN/PART_NUM=PART.INPUT
    ASSIGN/JOB_NUM=JOB.INPUT
    ASSIGN/PROJECT_NUM=PROJECT.INPUT
    ASSIGN/REQUEST=REQUESTER.INPUT
    ASSIGN/INSP=INSPECTOR.INPUT
    ASSIGN/ITEM=GETTEXT(193)
    ASSIGN/PROG=GETTEXT(191)
    ASSIGN/REV="REV " +GETTEXT(192)
    ASSIGN/DIR=LEFT((GETTEXT(191)),2)

    The second section is the footer:

    ASSIGN/FAIL=GETPROGRAMINFO("NUMOOT")
    IF/FAIL>0
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Part FAIL
    END_IF/

    ELSE_IF/FAIL==0
    ASSIGN/FILE_NAME="Y:\Manufacturing\Shop QC\Machine Shop Inspection Data\"+DIR+"-\"+PROG+"\"+REV+"\"+REQUEST+"\\Item "+LEFT(ITEM,2)+"\Job " +JOB_NUM +" Part " +PART_NUM +" Item " +ITEM +" "+SYSTEMDATE("MMMM dd, yyyy")
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=FILE_NAME.PDF,AUTO OPEN REPORT=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    TO_EXCEL_OUTPUT=OFF,
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_ELSEIF/

    You can test if the part fails and send them to a reject directory as well. I have a program that Josh Carpenter created that I have modified to fit my needs. It makes inputting this data very easy. You just check a box and it fills this code in to your program.
    The long line of code is where I am sending the data to our network drive.
    Hope this helps
Reply
  • This works really well for me. I am saving as pdf but I imagine you can make this an rtf.

    I have two sections of code for all my programs.

    The first section is the header:

    FORMAT/TEXT,OPTIONS, ,HEADINGS,SYMBOLS, ; , , , , , ,
    CAL =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter Machine Calibration Date
    PART =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter part number you are running
    JOB =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter job number
    PROJECT =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter project number
    REQUESTER =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter requester name
    INSPECTOR =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Enter inspectors initials
    ASSIGN/TEMP="N/A"
    ASSIGN/HUMID="N/A"
    ASSIGN/CAL_DATE=CAL.INPUT
    ASSIGN/PART_NUM=PART.INPUT
    ASSIGN/JOB_NUM=JOB.INPUT
    ASSIGN/PROJECT_NUM=PROJECT.INPUT
    ASSIGN/REQUEST=REQUESTER.INPUT
    ASSIGN/INSP=INSPECTOR.INPUT
    ASSIGN/ITEM=GETTEXT(193)
    ASSIGN/PROG=GETTEXT(191)
    ASSIGN/REV="REV " +GETTEXT(192)
    ASSIGN/DIR=LEFT((GETTEXT(191)),2)

    The second section is the footer:

    ASSIGN/FAIL=GETPROGRAMINFO("NUMOOT")
    IF/FAIL>0
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Part FAIL
    END_IF/

    ELSE_IF/FAIL==0
    ASSIGN/FILE_NAME="Y:\Manufacturing\Shop QC\Machine Shop Inspection Data\"+DIR+"-\"+PROG+"\"+REV+"\"+REQUEST+"\\Item "+LEFT(ITEM,2)+"\Job " +JOB_NUM +" Part " +PART_NUM +" Item " +ITEM +" "+SYSTEMDATE("MMMM dd, yyyy")
    PRINT/REPORT,EXEC MODE=END,$
    TO_FILE=ON,OVERWRITE=FILE_NAME.PDF,AUTO OPEN REPORT=OFF,$
    TO_PRINTER=OFF,COPIES=1,$
    TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
    TO_EXCEL_OUTPUT=OFF,
    PREVIOUS_RUNS=DELETE_INSTANCES
    END_ELSEIF/

    You can test if the part fails and send them to a reject directory as well. I have a program that Josh Carpenter created that I have modified to fit my needs. It makes inputting this data very easy. You just check a box and it fills this code in to your program.
    The long line of code is where I am sending the data to our network drive.
    Hope this helps
Children
No Data