Auto open PDF

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

  • Auto open PDF

    Anyone know a way to automatically open the report PDF on creation?

  • #2
    I find it easier to write it to a file that I name the path and filename for and then open that one, if you're interested I'll dig up some code for you.

    TK
    sigpicHave a homebrew

    Comment


    • #3
      We've been using BullZip PDF printer (freeware), and that's been OK.
      But it's limited in the file name department, it uses time and date.
      We're running 9 machines in production and it's tedious to find a file if you don't know what time and date your part was run.

      Comment


      • #4
        I've been using this, but it's a date and time thing too, if you compare the report time to the file time you should find your report, right?

        Code:
        COMMENT/DOC,NO,***************************************************
        ,Common finish code
        ,***************************************************
        ,
        STATS/UPDATE
        LOOP/END
        CS4 =SCRIPT/FILENAME= C:\PCDMISW\MSGOUTOL.BAS
        FUNCTION/Main,SHOW=YES,,
        STARTSCRIPT/
        ENDSCRIPT/
        FPTR =FILE/OPEN,C:\PCDMISW\OUTFILE,READ
        NUMBEROUT =FILE/READ_UPTO,FPTR,"eof"
        ASSIGN/DATE = SYSTEMDATE("MM_dd_yyyy")
        ASSIGN/TIME = SYSTEMTIME("HH_mm")
        ASSIGN/FILENAME = "P:\Reports\modern\65696\_"+DATE+"_"+TIME+".rtf"
        ASSIGN/TOTALTIME = INT((SYSTEMTIME("HH")*3600)+INT(SYSTEMTIME("mm")*60)+INT(SYSTEMTIME("ss"))-STARTTIME)/60
        COMMENT/REPT,"Run time = "+ TOTALTIME +" Minutes"
        EXTERNALCOMMAND/DISPLAY ; c:\sounds\wmplayer.exe c:\sounds\Alert!.wav c:\sounds\silent15.wav 
        COMMENT/REPT,"Out of tolerance features found : " + NUMBEROUT
        COMMENT/OPER,NO,You may preview the report now,
        ,select OK to continue
        ,
        ,"Out of tolerance features found : " + NUMBEROUT
        PRINT_IN =COMMENT/INPUT,YES,'Select a print option:
        ,
        ,1 .... Print the report
        ,2 .... Skip the printed report
        IF_GOTO/PRINT_IN.INPUT=="1",GOTO = YESPRINT
        IF_GOTO/PRINT_IN.INPUT=="2",GOTO = NOPRINT
        GOTO/PRINT_IN
        YESPRINT =LABEL/
        PRINT/REPORT,EXEC MODE=END,$
        TO_FILE=ON,OVERWRITE=FILENAME,$
        TO_PRINTER=ON,DRAFTMODE=OFF,$
        TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
        REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
        PREVIOUS_RUNS=DELETE_INSTANCES
        GOTO/END_PROGRAM
        Maybe there's something there for you.

        TK
        sigpicHave a homebrew

        Comment


        • #5
          Yes it's very easy. Send me your email, I'll need to send you a file and some simple code.
          Mnfctr: Hexagon,
          Model: Global B Perf,
          Hardware: Control FBII,
          Software: PcDmis CAD 2010MR3
          PH10MQ, TP20, Leitz equipped

          Comment


          • #6
            Well it turns out I couldn't email the .BAS file so there's nothing stopping me giving the instructions here: i've attached a PDF print screen of the code.

            Regards the print screen, at the end of the print screen the pc-dmis code details:
            • Assign/date
            • Assign/time
            • Assign/file name (file path-file name-date-time)
            • Print command (you should be able to see where rptname variable is used in this command)
            • Script call (insert tab, then basic script)


            Sub Main(strFileName As String)

            Shell "C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe " & strFileName

            End Sub

            1. Correct the file path above to where your adobe is installed.
            2. Create a folder named ‘Report Open’ in C:\Program Files\WAI\PC-DMIS
            3. Open Notepad, copy in the highlighted yellow text above, save as: ‘Report Open.BAS’ (type Report Open.BAS in the save box) (save in folder created in step 2)
            4. See print screen in the attached word document for how to program the code in PC-DMIS (not the script code). The ‘rptname‘ variable can be called anything you like.
            5. Edit the file path for where you want the report to be saved.
            6. Edit the file path in the script call out for where you saved Report Open.BAS file.
            7. You can use operator comment inputs if you wish, i.e. + C2.input + (the spaces between the +’s are critical).

            Ps) It will continually open new windows of adobe, you have to close them manually.
            Attached Files
            Last edited by AlexA; 04-29-2014, 10:12 AM. Reason: clarity
            Mnfctr: Hexagon,
            Model: Global B Perf,
            Hardware: Control FBII,
            Software: PcDmis CAD 2010MR3
            PH10MQ, TP20, Leitz equipped

            Comment


            • #7
              Problem is that I don't want to over write my files.

              HTML Code:
              ASSIGN/FILE_NME="\ "+STR(GETTEXT(191,1,{FILEHEDR}))+" CHIRON "+ELEMENT(1,"-",C1.INPUT)
                          ASSIGN/RPTNAME="Y:\C_PL1\CMM_PDF\Test Folder"+FILE_NME+".PDF"
                          COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                          RPTNAME
                          PRINT/REPORT,EXEC MODE=END,$
                            TO_FILE=ON,OVERWRITE=RPTNAME.PDF,$
                            TO_PRINTER=OFF,$
                            TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
                            REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                            PREVIOUS_RUNS=DELETE_INSTANCES
              I've pulled the file name from PC-DMIS and directed it to a file using the elements of a comment to identify which machine the parts came from.
              But as I say I need to save the file and not overwrite.

              Comment


              • #8
                HTML Code:
                ASSIGN/DATE1=SYSTEMDATE("MMM dd, yyyy")
                            ASSIGN/TIME1=SYSTEMTIME("hh.mm.ss")
                            ASSIGN/FILE_NME="\ "+STR(GETTEXT(191,1,{FILEHEDR}))+" CHIRON "+ELEMENT(1,"-",C1.INPUT)
                            ASSIGN/RPTNAME="Y:\C_PL1\CMM_PDF\Test Folder"+FILE_NME+" "+DATE1+" "+TIME1+".PDF"
                            COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                            RPTNAME
                            PRINT/REPORT,EXEC MODE=END,$
                              TO_FILE=ON,OVERWRITE=RPTNAME.PDF,$
                              TO_PRINTER=OFF,$
                              TO_DMIS_REPORT=OFF,FILE_OPTION=INDEX,FILENAME=,$
                              REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                              PREVIOUS_RUNS=DELETE_INSTANCES
                Never mind.
                If I add the date and time that solved the problem.
                Thanks Alex.

                Comment


                • #9
                  No problem. If you need it I have a 'file exists' check which will stop reports being overwritten.
                  Mnfctr: Hexagon,
                  Model: Global B Perf,
                  Hardware: Control FBII,
                  Software: PcDmis CAD 2010MR3
                  PH10MQ, TP20, Leitz equipped

                  Comment


                  • #10
                    I use something like this. I also have a script for operator input upon execution.

                    Program Stuff
                    Code:
                    [SIZE=2][COLOR=#0000ff]ASSIGN/RTIME=SYSTEMTIME("HHmm")
                    ASSIGN/DATE=SYSTEMDATE("MMddyyyy")
                    ASSIGN/INFO="_"+DATE+"_"+RTIME+"_"+OPERATOR+"-"+SHIFT+"_"+JOB+"_"+SAMP+"_"
                    ASSIGN/NAM="Default\\" 
                    ASSIGN/NAME=CMMPROGRAM+INFO+".PDF"
                    
                    [SIZE=2][COLOR=#0000ff]ASSIGN/DEFAULTPATH="W:\\Quality\\CMM Reports\\"
                    ASSIGN/RPTPATH=DEFAULTPATH + NAM
                    [SIZE=2][COLOR=#0000ff]ASSIGN/NAME=STR(NAME)
                    ASSIGN/RPTPATH=STR(RPTPATH)
                    
                    [SIZE=2][COLOR=#0000ff]TO_PRINT =COMMENT/YESNO,NO,Do you wish to print the report?
                    IF/TO_PRINT.INPUT=="YES"
                    PRINT/REPORT,EXEC MODE=END,$
                    TO_FILE=ON,APPEND=RPTPATH+NAME,$
                    TO_PRINTER=ON,$
                    TO_DMIS_REPORT=OFF,FILE_OPTION=APPEND,FILENAME=,$
                    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                    PREVIOUS_RUNS=KEEP_INSTANCES
                    END_IF/
                    IF/TO_PRINT.INPUT=="NO"
                    PRINT/REPORT,EXEC MODE=END,$
                    TO_FILE=ON,APPEND=RPTPATH+NAME,$
                    TO_PRINTER=OFF,$
                    TO_DMIS_REPORT=OFF,FILE_OPTION=APPEND,FILENAME=,$
                    REPORT_THEORETICALS=NONE,REPORT_FEATURE_WITH_DIMENSIONS=NO,$
                    PREVIOUS_RUNS=KEEP_INSTANCES
                    END_IF/[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE]
                    script at end of program
                    Code:
                    PDF_VIEW =SCRIPT/FILENAME= C:\PC-DMIS\4_3\BASIC SCRIPTS\PDF VIEW AFTER EXECUTE.BAS
                    FUNCTION/Main,SHOW=YES,ARG1=STR(RPTPATH+NAME),,
                    STARTSCRIPT/
                    ENDSCRIPT/
                    script :
                    Code:
                    Sub[SIZE=2][COLOR=#000000] Main(strFileName [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000])[/COLOR]
                    [/SIZE][SIZE=2][COLOR=#007f00][SIZE=2][COLOR=#007f00]'assign ARG1=STR(RPTPATH+Name) In script Line after SHOW=YES
                    [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]Shell "C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe " & strFileName
                    [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub
                    [/COLOR][/SIZE][/COLOR][/SIZE]

                    Comment


                    • #11
                      I'm looking for something similar. I would like the operator to review the report, insert a comment at the end and the print it to a pdf. Our process is to run a part, read a report, and then gage any diameters that appear to be out. We need a comment at the end of the report that states this part was completed. Any thoughts??


                      Thanks in advance.

                      Comment

                      Related Topics

                      Collapse

                      Working...
                      X