Reading a PCH file

Vikas Kumar_22189
Vikas Kumar_22189 Altair Community Member
edited October 2020 in Community Q&A

Dear all,

 

Is there any way to read PCH file and write into .xlsx File.

VBA code will be helpful.

 

If I am opening .pch file with notepad it is opening in single line but if i am opening .pch file in Notepad++ it is opening correctely.

 

I am looking for writting .pch file data in excel file.

Is it possible.

 

Thanks,

Vikas 

Answers

  • tinh
    tinh Altair Community Member
    edited July 2018

    Maybe, open the file by Notepad++ and then replace spaces by commas?

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited July 2018

    Nope i have to do using TCl\Tk but the thing is PCH file is behaving differently while opening in notepad as well as using code.

     

  • tinh
    tinh Altair Community Member
    edited July 2018

    Maybe it is utf-8 encoding. using 'fconfigure' to set encoding before read/write to it

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited November 2020

    Dear @tinh

     

    Yes i have done that also I am not able to read data only.

    My code is:

     

    set pchFile [open C:/Users/ABC/Desktop/JJJ/Smallpch.pch 'r']
    set dataPCHFile [read $pchFile]
    puts 'dataPCHFIle: $dataPCHFile'
    close $dataPCHFile

     

    I have attached my punch file. Please try to read it by using TCL\TK code.

     

    Regards,

    Vikas kumar

     

    Unable to find an attachment - read this blog

  • tinh
    tinh Altair Community Member
    edited July 2018

    Hi

    add red line:

    set pchFile [open C:/Users/ABC/Desktop/JJJ/Smallpch.pch 'r']

    fconfigure $pchFile -encoding utf-8
    set dataPCHFile [read $pchFile]
    puts 'dataPCHFIle: $dataPCHFile'
    close $dataPCHFile