Script Idea (Auto create CSV export)

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

  • Script Idea (Auto create CSV export)

    I've recently been doing alot of VBA and the thought hit me. Below is a sample of the code i use in every program. This just pulls all the measurements Exports them into an excel CSV file in a row and appends so the data for all parts is in a single sheet. Alot of the time i can have up to 50+ assignments especially pulling basics/Bonus from TP. It can be time consuming but worth it once its all set up.

    So I want to try and create the below code using a script. I'm going to attempt this myself. If any of you have experience with VB want to attempt it by all means go for it lol.

    Im not so concerned about the pathing for where the file is going that will change and its not hard to do. Just the assigning of variables is the long part.

    Thoughts??



    Code:
    $$ NO,
                #########################################_Export_To_CSV_################################################
    $$ NO,
                " CSV COPY FOR FCF "
                GETTEXT(647,1,{FCFLOC1}) - Line 1 Measure 
                GETTEXT(688,1,{FCFLOC1}) - Line 2 Measure
                GETTEXT(658,1,{FCFLOC1}) - Line 2 Bonus
                GETTEXT(692,1,{FCFLOC1}) - Summary basic
                GETTEXT(695,1,{FCFPROF1}) - Profile Max
                GETTEXT(696,1,{FCFPROF1}) -  Profile Min
    
                ASSIGN/V1=LOC9.D.MEAS
                ASSIGN/V2=GETTEXT(688,1,{FCFSTRA1})
                ASSIGN/V3=GETTEXT(647,1,{FCFLOC1})
                ASSIGN/V4=GETTEXT(688,1,{FCFLOC1})
                ASSIGN/V5=GETTEXT(647,1,{FCFLOC3})
                ASSIGN/V6=GETTEXT(688,1,{FCFLOC3})
                ASSIGN/V7=GETTEXT(647,1,{FCFLOC2})
                ASSIGN/V8=GETTEXT(688,1,{FCFLOC2})
                ASSIGN/V9=LOC2.R.MEAS
                ASSIGN/V10=GETTEXT(688,1,{FCFLOC8})
                ASSIGN/V11=GETTEXT(647,1,{FCFLOC4})
                ASSIGN/V12=GETTEXT(688,1,{FCFLOC4})
                ASSIGN/V13=GETTEXT(647,1,{FCFLOC5})
                ASSIGN/V14=GETTEXT(688,1,{FCFLOC5})
                ASSIGN/V15=GETTEXT(647,1,{FCFLOC9})
                ASSIGN/V16=GETTEXT(688,1,{FCFLOC9})
                ASSIGN/V17=GETTEXT(647,1,{FCFLOC7})
                ASSIGN/V18=GETTEXT(688,1,{FCFLOC7})
                ASSIGN/V19=DIST1.M.MEAS
                ASSIGN/WRITESTRING=DATE+","+TIME+","+MACHINE+","+REPORT3+","+V1+","+V2+","+V3+","+V4+","+V5+","+V6+","+V7+","+V8+","+V9+","+V10+","+V11+","+V12+","+V13+","+V14+","+V15+","+V16+","+V17+","+V18+","+V19+"
    FPTR       =FILE/OPEN,Z:\QUALITY CONTROL\JAKE P\FAI REPORTS\FIRING PIN 9.26.19\BOOK1.CSV,APPEND
                FILE/WRITELINE,FPTR,WRITESTRING
                FILE/CLOSE,FPTR,KEEP

  • #2
    What type of dimensioning are you using, Legacy or Xact?
    PcDmis 2015.1 SP10 CAD++
    Global 7-10-7 DC800S

    Comment


    • #3
      Mainly Xact. Thats what all the "GETTEXT" is for. However some legacy is used if Xact just doesn't want to work right.

      Comment


      • #4
        Originally posted by Jakep379 View Post
        Thoughts??
        While you have this code in the edit window, select File - Export - BASIC and it will be converted to script format automatically. Open the resultant BAS file (Notepad, etc.) and you'll see. Quite verbose, every other line is a comment, but what you need will be there. . . .

        Comment


        • Jakep379
          Jakep379 commented
          Editing a comment
          Thanks Don! this will help

      • #5
        You could take a look at the Excel export script(s) available in the code forum, and then 'just' change it to generate the correct code (with the help of the trick from Don)
        instead of directly exporting.
        AndersI
        SW support - Hexagon Metrology Nordic AB

        Comment

        Related Topics

        Collapse

        Working...
        X