winIDEA SDK
Loading...
Searching...
No Matches
test_index_of.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
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()