--- a/codesys-ide/scripts/runtest.py +++ b/codesys-ide/scripts/runtest.py @@ -7,6 +7,10 @@ # disable prompts, as those are enabled in UI mode by default system.prompt_handling = PromptHandling.None + +# compile category GUID +CompileCategory = Guid("{97F48D64-A2A3-4856-B640-75C046E37EA9}") + def runtest(): # devId = device_repository.create_device_identification(4096, '0000 0001', '3.5.15.0') @@ -43,6 +47,16 @@ onlineapp.login(OnlineChangeOption.Try, True) except: print("Error: compile error") + # Get message objects which contain all the data + severities = { + Severity.FatalError : "Fatal error", Severity.Error : "Error", + Severity.Warning : "Warning", Severity.Information : "Information", + Severity.Text : "Text" + } + msgs = system.get_message_objects(CompileCategory, Severity.FatalError|Severity.Error) + for msg in msgs: + sev = severities[msg.severity] + print("{} {}{}: {}".format(sev, msg.prefix, msg.number, msg.text)) return False # run program