-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplatform_transformation_script.asc
More file actions
66 lines (50 loc) · 2.35 KB
/
platform_transformation_script.asc
File metadata and controls
66 lines (50 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
PROCEDURE HELLO_WORLD {
}
#HELLO_WORLD
PROCEDURE SELECT_DEVICE nModelID: integer sNameList: reference {
CC "AdoScript" QUERYBOX "Choose a button..." thingsboard-losant-cancel def-cancel
CC "AdoScript" INFOBOX ("The user pressed " + endbutton)
CC "AdoScript" WARNINGBOX "Another example..." retry-cancel
CC "AdoScript" INFOBOX ("The user pressed " + endbutton)
CC "AdoScript" INFOBOX "You are trying to generate a psm model from these specification"
IF (modelid = -1) {
CC "AdoScript" ERRORBOX "Please open a model first!"
EXIT
}
CC "Core" GET_MODEL_INFO modelid:(nModelID)
#--> RESULT modelname:strValue ver:strValue version:strValue version:strValue
# threadid:id modeltype:strValue libid:id libtype:strValue
# libname:strValue access:strValue ecode:intValue
#CC "Core" GET_ALL_OBJS_OF_CLASSNAME modelid:(nModelID) classname:("POI")
CC "AQL" EVAL_AQL_EXPRESSION expr:("(<\"device\">)") modelid:(nModelID)
#-->RESULT ecode:intValue objids:list
CC "AdoScript" INFOBOX ("Number of Devices: " + STR tokcnt(objids))
SET sNameList:("name, description, label, type \n")
FOR sObjectID in:(objids) sep:(" ") {
SET nObjectID:(VAL sObjectID)
CC "Modeling" SELECT objid:(nObjectID)
CC "AdoScript" SLEEP ms:100
CC "Core" GET_ATTR_VAL objid:(nObjectID) attrname:("name")
#-->RESULT ecode:intValue val:anyValue
SET sNameList:(sNameList + "," + val)
CC "Core" GET_ATTR_VAL objid:(nObjectID) attrname:("description")
SET sNameList:(sNameList + "," + val)
CC "Core" GET_ATTR_VAL objid:(nObjectID) attrname:("label")
SET sNameList:(sNameList + "," + val)
CC "Core" GET_ATTR_VAL objid:(nObjectID) attrname:("type ")
SET sNameList:(sNameList + "," + val + "\n")
}
CC "AdoScript" INFOBOX (sNameList)
}
CC "Modeling" GET_ACT_MODEL
# modelid: the modelid of the model that is currently opened and active (visible, on top) in the model editor (integer)
SELECT_DEVICE nModelID:(modelid) sNameList:sPOIList
CC "AdoScript" EDITBOX text:("List of POI: " + sPOIList )
PROCEDURE SAVE_TO_FILE sContent: string {
CC "AdoScript" FILE_DIALOG saveas filter1:"CSV Files" type1:"*.csv" default-ext:"csv"
# --> RESULT endbutton:strValue path:strValue
IF (endbutton = "ok") {
CC "AdoScript" FWRITE file:(path) text:(sContent)
}
}
SAVE_TO_FILE sContent:(sPOIList)