a/codesys-ide/scripts/runtest.py | b/codesys-ide/scripts/runtest.py | ||
---|---|---|---|
... |
... |
||
6 | sys.stdout = open('.codesys.output.txt', 'w') |
6 | sys.stdout = open('.codesys.output.txt', 'w') |
7 | 7 | ||
8 | # disable prompts, as those are enabled in UI mode by default |
8 | # disable prompts, as those are enabled in UI mode by default |
9 | system.prompt_handling = PromptHandling.None |
9 | system.prompt_handling = PromptHandling.None |
10 | 10 | ||
11 | # compile category GUID |
||
12 | CompileCategory = Guid("{97F48D64-A2A3-4856-B640-75C046E37EA9}") |
||
13 | |||
14 | |||
11 | def runtest(): |
15 | def runtest(): |
12 | # devId = device_repository.create_device_identification(4096, '0000 0001', '3.5.15.0') |
16 | # devId = device_repository.create_device_identification(4096, '0000 0001', '3.5.15.0') |
13 | devId = None |
17 | devId = None |
14 | devices = device_repository.get_all_devices("CODESYS Control Win V3") |
18 | devices = device_repository.get_all_devices("CODESYS Control Win V3") |
15 | for device in devices: |
19 | for device in devices: |
... |
... |
||
41 | onlineapp = online.create_online_application(app) |
45 | onlineapp = online.create_online_application(app) |
42 | try: |
46 | try: |
43 | onlineapp.login(OnlineChangeOption.Try, True) |
47 | onlineapp.login(OnlineChangeOption.Try, True) |
44 | except: |
48 | except: |
45 | print("Error: compile error") |
49 | print("Error: compile error") |
50 | # Get message objects which contain all the data |
||
51 | severities = { |
||
52 | Severity.FatalError : "Fatal error", Severity.Error : "Error", |
||
53 | Severity.Warning : "Warning", Severity.Information : "Information", |
||
54 | Severity.Text : "Text" |
||
55 | } |
||
56 | msgs = system.get_message_objects(CompileCategory, Severity.FatalError|Severity.Error) |
||
57 | for msg in msgs: |
||
58 | sev = severities[msg.severity] |
||
59 | print("{} {}{}: {}".format(sev, msg.prefix, msg.number, msg.text)) |
||
46 | return False |
60 | return False |
47 | 61 | ||
48 | # run program |
62 | # run program |
49 | onlineapp.start() |
63 | onlineapp.start() |
50 | 64 |