@@ -107,7 +107,7 @@ Open or switch to an application.
107107func Open (app : String ? = nil ,
108108 url : String ? = nil ,
109109 waitForLoadComplete : Bool = true ,
110- waitTime : Int = 0 )
110+ waitTime : Int = 0 )
111111```
112112
113113## Parameters
@@ -227,7 +227,7 @@ func Shortcut(key: String,
227227 ctrl : Bool ,
228228 option : Bool ,
229229 shift : Bool ,
230- waitTime : Int )
230+ waitTime : Int )
231231```
232232
233233## Parameters
@@ -247,15 +247,11 @@ Whether the option modifier should be pressed when tapping the key.
247247### shift
248248Whether the shift modifier should be pressed when tapping the key.
249249
250- ### waitTime
251- Time in second to wait after executing the action.
252-
253250
254251## Return Value
255252
256253None
257254
258-
259255## Discussion
260256
261257Examples:
@@ -438,7 +434,7 @@ Move(to: "textarea", spatialRelation: "below", anchorConcept: "verify insurance"
438434
439435
440436
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 )
442438
443439
444440Get elements that satisfy some conditions inside the current frontmost application or inside a root element (if given).
@@ -459,6 +455,7 @@ func GetElements(
459455 horizontalRank : Int ? = nil ,
460456 verticalRank : Int ? = nil ,
461457 sortBy : String = " " ,
458+ useNeighborForMissingDescription : Bool = false ,
462459 returnType : String = " elementArray"
463460 ) -> Any ?
464461```
@@ -505,6 +502,10 @@ Top-most element has rank 1.
505502Returns the found elements in sorted order, by "x" (left to right) or "y" (top to bottom).
506503Used only if ` returnType ` is "elementArray".
507504
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+
508509### returnType
509510Options are: "elementArray" (default), "string", "stringArray", "strToElemDict".
510511- elementArray: returns an array of UIElements
@@ -515,8 +516,7 @@ Options are: "elementArray" (default), "string", "stringArray", "strToElemDict".
515516
516517## Return Value
517518
518- Depending on returnType: [ UIElement] | String | [ String] | [ String: UIElement]
519-
519+ Depending on returnType: [ UIElement] , String, [ String] , [ String: UIElement]
520520
521521## Discussion
522522
@@ -599,7 +599,6 @@ Optional LLM model specification. Inquire for more details.
599599
600600String
601601
602-
603602## Discussion
604603
605604Examples:
@@ -636,7 +635,6 @@ An array of target concepts to find.
636635
637636If all concepts can be found, returns true, otherwise false.
638637
639-
640638## Discussion
641639
642640Examples:
@@ -658,25 +656,22 @@ if ConceptsExist(concepts: ["sign in button", "log in button"]) {
658656
659657# WaitForConcepts(concepts)
660658
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
663661
664662
665663``` swift
666- func WaitForConcepts (concepts : [String ])
664+ func WaitForConcepts (concepts : [String ])
667665```
668666
669667## Parameters
670668
671- ### concepts
672- An array of target concepts to find.
673669
674670
675671## Return Value
676672
677673None
678674
679-
680675## Discussion
681676
682677Examples:
@@ -711,13 +706,12 @@ Gets content from the subtree rooted at elements that match this concept.
711706Get content from the subtree rooted at this element.
712707
713708### format
714- Format of the returned content. Options are: "flat", "json", "xml"
709+ Format of the returned content. Options are: "flat", "json", "xml", "xmlSlim"
715710
716711
717712## Return Value
718713
719714If ` inElement ` argument is given or the frontmost window was used (because neither ` inConcept ` nor
720-
721715` inElement ` was given), then returns a single String. Otherwise, returns a [ String] array with one String per root element.
722716
723717## Discussion
@@ -728,9 +722,9 @@ Examples:
728722``` swift
729723var pageContent = GetContent (format : " json" )
730724```
731- - Instruction: get content from the table element
725+ - Instruction: get content from the table element in xml slim format
732726``` swift
733- var tableContent = GetContent (inElement : table)
727+ var tableContent = GetContent (inElement : table, format : " xmlSlim " )
734728```
735729- Instruction: get content inside group job post details
736730``` swift
@@ -759,7 +753,6 @@ An optional prompt for an LLM.
759753
760754String
761755
762-
763756## Discussion
764757
765758Examples:
@@ -793,7 +786,6 @@ Array of column header
793786
794787Array of column id, each is a capital letter from A to Z
795788
796-
797789## Discussion
798790
799791Examples:
@@ -826,7 +818,6 @@ For example "B42" is the cell at column B row 42.
826818
827819Value of the cell
828820
829-
830821## Discussion
831822
832823Examples:
@@ -874,6 +865,35 @@ SetGoogleSheetCellValue(cell: "B42", value: "Simular")
874865
875866
876867
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+
877897# CopyToClipboard(text)
878898
879899Copies a String to clipboard.
@@ -941,8 +961,7 @@ than thos threshold will be used.
941961## Return Value
942962
943963A [ 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.
946965
947966## Discussion
948967
@@ -983,8 +1002,7 @@ A column element that contains one or more cells.
9831002## Return Value
9841003
9851004An 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).
9881006
9891007## Discussion
9901008
@@ -1018,7 +1036,6 @@ A cell element.
10181036
10191037Value contained in the cell.
10201038
1021-
10221039## Discussion
10231040
10241041Examples:
@@ -1033,23 +1050,24 @@ var cellValue = GetCellValue(cell: cell)
10331050# GetDictFromJson(jsonStr)
10341051
10351052
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.
10371056
10381057
10391058``` swift
1040- func GetDictFromJson (jsonStr : String ) -> [String : String ]?
1059+ func GetDictFromJson (jsonStr : String ) -> [String : Any ]?
10411060```
10421061
10431062## Parameters
10441063
10451064### jsonStr
1046- A JSON-formatted String .
1065+ A string that contains JSON-formatted data .
10471066
10481067
10491068## Return Value
10501069
1051- A dictionary representation of the input.
1052-
1070+ A dictionary representation of the JSON data in the input ` jsonStr `
10531071
10541072## Discussion
10551073
@@ -1083,7 +1101,6 @@ func GetFromClipboard() -> String
10831101
10841102Content of the currrent clipboard
10851103
1086-
10871104## Discussion
10881105
10891106Examples:
@@ -1114,8 +1131,7 @@ An array of UIElements `[u_1, ..., u_n]`.
11141131## Return Value
11151132
11161133An 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 ` .
11191135
11201136## Discussion
11211137
@@ -1203,7 +1219,6 @@ A query used to search the dictionary.
12031219
12041220Dictionary value corresponding to the key that contains the query.
12051221
1206-
12071222## Discussion
12081223
12091224Examples:
@@ -1221,27 +1236,24 @@ if var elem = SoftDictLookup(dict: elemDict, query: "first name") {
12211236# Wait(unit: waitTime )
12221237
12231238
1239+
12241240Put Agent into sleep state for a certain amount of time.
12251241
12261242
12271243``` swift
1228- func Wait (unit : String , waitTime : Int )
1244+ func Wait (unit : String , waitTime : Int )
12291245```
12301246
12311247## Parameters
12321248
12331249### unit
12341250Units of waitTime, default is s for seconds. Options are s and ms.
12351251
1236- ### waitTime
1237- Duration of time to wait in the given units.
1238-
12391252
12401253## Return Value
12411254
12421255None
12431256
1244-
12451257## Discussion
12461258
12471259Examples:
@@ -1282,7 +1294,6 @@ values of the cell
12821294
12831295[ String] array of cell indices]
12841296
1285-
12861297## Discussion
12871298
12881299Examples:
@@ -1314,7 +1325,6 @@ A cell element
13141325
13151326cell's label String. Example: "A1"
13161327
1317-
13181328## Discussion
13191329
13201330Examples:
@@ -1351,7 +1361,6 @@ index of column header, e.g. "B42".
13511361
13521362Dictionary of [ String: UIElement] pair for all information in the column under header
13531363
1354-
13551364## Discussion
13561365
13571366Examples:
@@ -1365,3 +1374,48 @@ var websiteColumn = GetTableColumn(header: "Website")
13651374var A1Column = GetTableColumn (index : " A1" )
13661375```
13671376
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