@@ -107,7 +107,7 @@ Open or switch to an application.
107
107
func Open (app : String ? = nil ,
108
108
url : String ? = nil ,
109
109
waitForLoadComplete : Bool = true ,
110
- waitTime : Int = 0 )
110
+ waitTime : Int = 0 )
111
111
```
112
112
113
113
## Parameters
@@ -227,7 +227,7 @@ func Shortcut(key: String,
227
227
ctrl : Bool ,
228
228
option : Bool ,
229
229
shift : Bool ,
230
- waitTime : Int )
230
+ waitTime : Int )
231
231
```
232
232
233
233
## Parameters
@@ -247,15 +247,11 @@ Whether the option modifier should be pressed when tapping the key.
247
247
### shift
248
248
Whether the shift modifier should be pressed when tapping the key.
249
249
250
- ### waitTime
251
- Time in second to wait after executing the action.
252
-
253
250
254
251
## Return Value
255
252
256
253
None
257
254
258
-
259
255
## Discussion
260
256
261
257
Examples:
@@ -438,7 +434,7 @@ Move(to: "textarea", spatialRelation: "below", anchorConcept: "verify insurance"
438
434
439
435
440
436
441
- # GetElements(elementRoles:elementOverallDescription:threshold:root:spatialRelation:anchorRole:anchorOverallDescription:anchorElements:horizontalRank:verticalRank:sortBy: returnType )
437
+ # GetElements(elementRoles:elementOverallDescription:threshold:root:spatialRelation:anchorRole:anchorOverallDescription:anchorElements:horizontalRank:verticalRank:sortBy:useNeighborForMissingDescription : returnType )
442
438
443
439
444
440
Get elements that satisfy some conditions inside the current frontmost application or inside a root element (if given).
@@ -459,6 +455,7 @@ func GetElements(
459
455
horizontalRank : Int ? = nil ,
460
456
verticalRank : Int ? = nil ,
461
457
sortBy : String = " " ,
458
+ useNeighborForMissingDescription : Bool = false ,
462
459
returnType : String = " elementArray"
463
460
) -> Any ?
464
461
```
@@ -505,6 +502,10 @@ Top-most element has rank 1.
505
502
Returns the found elements in sorted order, by "x" (left to right) or "y" (top to bottom).
506
503
Used only if ` returnType ` is "elementArray".
507
504
505
+ ### useNeighborForMissingDescription
506
+ Whether or not to use the description of an element's neighbor
507
+ as a substitute if the element's description is empty. This is only used if returnType involves returning element descriptions.
508
+
508
509
### returnType
509
510
Options are: "elementArray" (default), "string", "stringArray", "strToElemDict".
510
511
- elementArray: returns an array of UIElements
@@ -515,8 +516,7 @@ Options are: "elementArray" (default), "string", "stringArray", "strToElemDict".
515
516
516
517
## Return Value
517
518
518
- Depending on returnType: [ UIElement] | String | [ String] | [ String: UIElement]
519
-
519
+ Depending on returnType: [ UIElement] , String, [ String] , [ String: UIElement]
520
520
521
521
## Discussion
522
522
@@ -599,7 +599,6 @@ Optional LLM model specification. Inquire for more details.
599
599
600
600
String
601
601
602
-
603
602
## Discussion
604
603
605
604
Examples:
@@ -636,7 +635,6 @@ An array of target concepts to find.
636
635
637
636
If all concepts can be found, returns true, otherwise false.
638
637
639
-
640
638
## Discussion
641
639
642
640
Examples:
@@ -658,25 +656,22 @@ if ConceptsExist(concepts: ["sign in button", "log in button"]) {
658
656
659
657
# WaitForConcepts(concepts)
660
658
661
- Waits until all concepts can be found in the current frontmost window. If not all concepts can be found within 10 seconds, then
662
- returns failure.
659
+ Waits until all concepts can be found in the current frontmost window.
660
+ If not all concepts can be found within 10 seconds, action returns failure
663
661
664
662
665
663
``` swift
666
- func WaitForConcepts (concepts : [String ])
664
+ func WaitForConcepts (concepts : [String ])
667
665
```
668
666
669
667
## Parameters
670
668
671
- ### concepts
672
- An array of target concepts to find.
673
669
674
670
675
671
## Return Value
676
672
677
673
None
678
674
679
-
680
675
## Discussion
681
676
682
677
Examples:
@@ -711,13 +706,12 @@ Gets content from the subtree rooted at elements that match this concept.
711
706
Get content from the subtree rooted at this element.
712
707
713
708
### format
714
- Format of the returned content. Options are: "flat", "json", "xml"
709
+ Format of the returned content. Options are: "flat", "json", "xml", "xmlSlim"
715
710
716
711
717
712
## Return Value
718
713
719
714
If ` inElement ` argument is given or the frontmost window was used (because neither ` inConcept ` nor
720
-
721
715
` inElement ` was given), then returns a single String. Otherwise, returns a [ String] array with one String per root element.
722
716
723
717
## Discussion
@@ -728,9 +722,9 @@ Examples:
728
722
``` swift
729
723
var pageContent = GetContent (format : " json" )
730
724
```
731
- - Instruction: get content from the table element
725
+ - Instruction: get content from the table element in xml slim format
732
726
``` swift
733
- var tableContent = GetContent (inElement : table)
727
+ var tableContent = GetContent (inElement : table, format : " xmlSlim " )
734
728
```
735
729
- Instruction: get content inside group job post details
736
730
``` swift
@@ -759,7 +753,6 @@ An optional prompt for an LLM.
759
753
760
754
String
761
755
762
-
763
756
## Discussion
764
757
765
758
Examples:
@@ -793,7 +786,6 @@ Array of column header
793
786
794
787
Array of column id, each is a capital letter from A to Z
795
788
796
-
797
789
## Discussion
798
790
799
791
Examples:
@@ -826,7 +818,6 @@ For example "B42" is the cell at column B row 42.
826
818
827
819
Value of the cell
828
820
829
-
830
821
## Discussion
831
822
832
823
Examples:
@@ -874,6 +865,35 @@ SetGoogleSheetCellValue(cell: "B42", value: "Simular")
874
865
875
866
876
867
868
+ # Print(_ )
869
+
870
+
871
+ Writes the textual representations of the given item into debug console.
872
+
873
+ ``` swift
874
+ func Print (_ item : Any )
875
+ ```
876
+
877
+ ## Parameters
878
+
879
+
880
+
881
+ ## Return Value
882
+
883
+ None
884
+
885
+ ## Discussion
886
+
887
+ Examples:
888
+
889
+ - Instruction: print("Simular") in console
890
+ ``` swift
891
+ Print (" Simular" )
892
+ ```
893
+ ///
894
+
895
+
896
+
877
897
# CopyToClipboard(text)
878
898
879
899
Copies a String to clipboard.
@@ -941,8 +961,7 @@ than thos threshold will be used.
941
961
## Return Value
942
962
943
963
A [ String] array with length equal to the number of elements. The i-th entry is the concatenated attribute values
944
-
945
- for the i-th element.
964
+ for the i-th element.
946
965
947
966
## Discussion
948
967
@@ -983,8 +1002,7 @@ A column element that contains one or more cells.
983
1002
## Return Value
984
1003
985
1004
An array of cell elements contained in the given row or column. If input is a row, the output array is sorted by
986
-
987
- increasing x-coordinate (left to right). If input is a column, the output array is sorted by increasing y-coordinate (top to bottom).
1005
+ increasing x-coordinate (left to right). If input is a column, the output array is sorted by increasing y-coordinate (top to bottom).
988
1006
989
1007
## Discussion
990
1008
@@ -1018,7 +1036,6 @@ A cell element.
1018
1036
1019
1037
Value contained in the cell.
1020
1038
1021
-
1022
1039
## Discussion
1023
1040
1024
1041
Examples:
@@ -1033,23 +1050,24 @@ var cellValue = GetCellValue(cell: cell)
1033
1050
# GetDictFromJson(jsonStr)
1034
1051
1035
1052
1036
- Gets a dictionary from the given JSON-formatted input.
1053
+ Gets a dictionary from the JSON-formatted part of a string.
1054
+ The input string must contain at most one pair of outermost curly braces { ... }.
1055
+ Returns an empty dictionary if the input does not contain a JSON-formatted substring.
1037
1056
1038
1057
1039
1058
``` swift
1040
- func GetDictFromJson (jsonStr : String ) -> [String : String ]?
1059
+ func GetDictFromJson (jsonStr : String ) -> [String : Any ]?
1041
1060
```
1042
1061
1043
1062
## Parameters
1044
1063
1045
1064
### jsonStr
1046
- A JSON-formatted String .
1065
+ A string that contains JSON-formatted data .
1047
1066
1048
1067
1049
1068
## Return Value
1050
1069
1051
- A dictionary representation of the input.
1052
-
1070
+ A dictionary representation of the JSON data in the input ` jsonStr `
1053
1071
1054
1072
## Discussion
1055
1073
@@ -1083,7 +1101,6 @@ func GetFromClipboard() -> String
1083
1101
1084
1102
Content of the currrent clipboard
1085
1103
1086
-
1087
1104
## Discussion
1088
1105
1089
1106
Examples:
@@ -1114,8 +1131,7 @@ An array of UIElements `[u_1, ..., u_n]`.
1114
1131
## Return Value
1115
1132
1116
1133
An array of String ` [s_1, ..., s_n] ` , where each ` s_i ` is an XML-formatted description of the contents
1117
-
1118
- rooted at `u_i`.
1134
+ rooted at ` u_i ` .
1119
1135
1120
1136
## Discussion
1121
1137
@@ -1203,7 +1219,6 @@ A query used to search the dictionary.
1203
1219
1204
1220
Dictionary value corresponding to the key that contains the query.
1205
1221
1206
-
1207
1222
## Discussion
1208
1223
1209
1224
Examples:
@@ -1221,27 +1236,24 @@ if var elem = SoftDictLookup(dict: elemDict, query: "first name") {
1221
1236
# Wait(unit: waitTime )
1222
1237
1223
1238
1239
+
1224
1240
Put Agent into sleep state for a certain amount of time.
1225
1241
1226
1242
1227
1243
``` swift
1228
- func Wait (unit : String , waitTime : Int )
1244
+ func Wait (unit : String , waitTime : Int )
1229
1245
```
1230
1246
1231
1247
## Parameters
1232
1248
1233
1249
### unit
1234
1250
Units of waitTime, default is s for seconds. Options are s and ms.
1235
1251
1236
- ### waitTime
1237
- Duration of time to wait in the given units.
1238
-
1239
1252
1240
1253
## Return Value
1241
1254
1242
1255
None
1243
1256
1244
-
1245
1257
## Discussion
1246
1258
1247
1259
Examples:
@@ -1282,7 +1294,6 @@ values of the cell
1282
1294
1283
1295
[ String] array of cell indices]
1284
1296
1285
-
1286
1297
## Discussion
1287
1298
1288
1299
Examples:
@@ -1314,7 +1325,6 @@ A cell element
1314
1325
1315
1326
cell's label String. Example: "A1"
1316
1327
1317
-
1318
1328
## Discussion
1319
1329
1320
1330
Examples:
@@ -1351,7 +1361,6 @@ index of column header, e.g. "B42".
1351
1361
1352
1362
Dictionary of [ String: UIElement] pair for all information in the column under header
1353
1363
1354
-
1355
1364
## Discussion
1356
1365
1357
1366
Examples:
@@ -1365,3 +1374,48 @@ var websiteColumn = GetTableColumn(header: "Website")
1365
1374
var A1Column = GetTableColumn (index : " A1" )
1366
1375
```
1367
1376
1377
+
1378
+
1379
+ # WriteToFile(text:filePath: overwrite )
1380
+
1381
+
1382
+ Writes the given text to a file. If the file already exists, then appends text to it, with an option to overwrite the existing content.
1383
+
1384
+
1385
+ ``` swift
1386
+ func WriteToFile (
1387
+ text : String ,
1388
+ filePath : String ? = nil ,
1389
+ overwrite : Bool = false
1390
+ )
1391
+ ```
1392
+
1393
+ ## Parameters
1394
+
1395
+ ### text
1396
+ Text to write to a file.
1397
+
1398
+ ### filePath
1399
+ Full path to a file. If not provided, then the default is a file "SimularActionResult.txt" at the desktop.
1400
+
1401
+ ### overwrite
1402
+ Whether or not to overwrite the contents if filePath points to an existing file.
1403
+
1404
+
1405
+ ## Return Value
1406
+
1407
+ None
1408
+
1409
+ ## Discussion
1410
+
1411
+ Examples:
1412
+
1413
+ - Instruction: Append jsonResult to /User/somebody/Documents/result.json
1414
+ ``` swift
1415
+ WriteToFile (text : jsonResult, filePath : " /User/somebody/Documents/result.json" )
1416
+ ```
1417
+ - Instruction: Write jsonResult to /User/someone/Desktop/result.json, overwrite existing file.
1418
+ ``` swift
1419
+ WriteToFile (text : jsonResult, filePath : " /User/someone/Desktop/result.json" , overwrite : true )
1420
+ ```
1421
+
0 commit comments