import isystem.connect as ic
winidea_id = ''
def test_index_of():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
optCtrl = ic.COptionController(connMgr, "/IDE/System.Debug.Applications")
index = optCtrl.index_of("Name", "App")
print(f"Index of the item whose 'Name' attribute has value 'App': {index}")
index = optCtrl.index_of("Name", "x")
print(f"Index of the item whose 'Name' attribute has value 'x' (-1 = does not exist): {index}")
try:
optCtrl.index_of("xzy", "App")
except Exception as err:
print(f"Attribute name must be correct, otherwise exception is raised: 'xzy':\n{err}")
if __name__ == "__main__":
test_index_of()