I would like to extract an unusual file property that a software package (OrcaFlex) adds when it creates a file. In Windows Explorer, when I hover my cursor over the file listing such as SomeSimulation.sim in the first screenshot below, a popup window appears with properties including 'Model state'. Here I learned these are called infotips. I want to retrieve the Model state value (the string "Time domain dynamics complete") using Perl or any other command line language. How do I do that? I am using Windows 7 and James' comment helped me see that I will have to use this, perhaps like this.
I'm one of the authors of OrcaFlex. With absolutely no warranty the following Python code will hack out what you need.
import struct def readModelStateText(fileName): with open(fileName, 'rb') as f: content = f.read(0x4000) # hope that the text appears this early in the file signature = b'\xff\xfa\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' index = content.find(signature) if index == -1: return '<model state not found>' index += len(signature) + 2 # skip over block length stringLength = struct.unpack('<H', content[index:index + 2]) index += 2 return content[index:index + stringLength].decode('utf-8')
This hunts for a specific block in the file with knowledge of the block header signature. It is plausible (very unlikely I suspect) that the code will find the body of an earlier block that matches the signature. And there are other ways that this code might fail.
I'm just offering it because it is possibly useful, but with a hefty caveat emptor.