How get the file extension of the output file

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

  • How get the file extension of the output file

    I would like get the number to be used for the file extension of the output file. I can read in pc-dmis basic help that you can set in an object "part.editwindow.setprintoptions", but I don't know how get it. I need it to introduce in printed report in order to get traceability of report and file you can get it.

    Thanks in advance.

  • #2
    If I understand your question you can go to File,Print. Edit print. Then select file and where you want it saved, then append. that will save the file and tag eacvh one with a new number ect.
    Time for the Trolls to leave.

    Comment


    • #3
      There is way in VB to read it!

      You need to do a Dir command (see the example that comes with it and you will find how it works). It will create a list of files. The last one in that list is typically the file you want to have (the last listed file). Then use left and right to parse the file name and find the number. Works every time.

      Attached a small example of how I find something similar (the data and time for a journal file (this is an PC-DMIS/NC specific problem)).


      Jan.


      Code:
      temp = Dir(strJournalDir & "\*.cna",0)  'find the latest journal file 
      count =0
      While temp<>""
          count=count+1
          temp=dir
      Wend
      Dim x() As String
      ReDim x(count)
      x(0)=dir( strJournalDir & "\*.cna",0)
      For i=1 To count
        x(i)=dir
      Next i
      If count <> 0 Then
        strFoundTheFile=x(i-2)
      Else
        strFoundTheFile=""
      End If
      
      findDotPosition=InStr(1,strFoundTheFile,".")    
      strLeftName=left(strFoundTheFile,findDotPosition-1)                 
      cnaFileName=strLeftName
      ***************************
      PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
      Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

      Comment


      • #4
        When a report is saved automatically the format is:
        program_name extension_number . extension_file
        example: CCB_LHD 004.PDF
        Program_name: CCB_LHD
        extension_number: 004
        extension_file: PDF

        I need to get the extension file of next report before to be saved, in this example it will be "005".

        Thanks.

        Comment


        • #5
          OK, then I would use a similar program as mine, and find the latest file as it exists. Parse, per my code, and you will find 004. Then add 1 to it and you know you'll be looking for a number 5....


          Jan.
          ***************************
          PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
          Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

          Comment


          • #6
            Like Jan said step through it with Dir and evaluate a substring where you trim off the last 4 chars. If you keep all of your reports in the same directory then you'll want to pass from pcdmis to your script the filename, if you keep them in different directories then pass the path name. That way you can use the same script in multiple part programs without hard coding.
            <internet bumper sticker goes here>

            Comment

            Related Topics

            Collapse

            Working...
            X