Facing error in Script for taking Screenshots

Neil Handa
Neil Handa Altair Community Member
edited June 2023 in Community Q&A

Hello everyone, I am working on a script to automate the process of taking screenshots of graphs in Hypergraph. I am using the below commands in Tcl for the same:

for {set i 0} {$i < $numOfWindows} {incr i} {     set filename "pic$picnum.jpg"     "page$cnt" SetActiveWindow $activeWindow     "page$cnt" SetActiveWindowExpanded true     sess CaptureActiveWindow jpeg $filename percent 100 100     "page$cnt" SetActiveWindowExpanded false     incr activeWindow     incr picnum }

However the issue is that sometimes, I am not getting the screenshot of the graph and instead I am getting blank / black images. I have attached pictures for reference. Any help regarding the same would be appreciated. Thanks.

EDIT:
After some changes to the code, it is working fine now. I am now using CaptureActiveScreen instead of CaptureActiveWindow.

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited June 2023

    is your graphic card driver updated?

     

    Not to solve your issue, but have you heard of HWC? these are new APIs much easier to automate some post-processing activities.

    You can enable the HWC console (View>>HWC Console).

    It logs most of the commands into a console, that you could then copy to TCL and easily script on top of it.

     image

     

  • Neil Handa
    Neil Handa Altair Community Member
    edited June 2023

    is your graphic card driver updated?

     

    Not to solve your issue, but have you heard of HWC? these are new APIs much easier to automate some post-processing activities.

    You can enable the HWC console (View>>HWC Console).

    It logs most of the commands into a console, that you could then copy to TCL and easily script on top of it.

     image

     

    Thank you, sir, for your answer. Yeah, I have heard of HWC, will learn more about it. I was preferring TCL because it has good amount of documentation from Altair's side.

    Not related to the issue, can you suggest certain tasks that would be worth automating in Hypergraph software just like this one of taking screenshots. Thanks