Skip to content

Commit 6136870

Browse files
committed
Update
1 parent 8537a6e commit 6136870

File tree

1 file changed

+175
-34
lines changed

1 file changed

+175
-34
lines changed

index.md

Lines changed: 175 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ application name, e.g., Google Chrome, iMessage.
119119
url address of a web page, e.g., google.com
120120

121121
### waitForLoadComplete
122-
Whether or not to wait for a page to complete loading after typing.
122+
Whether or not to wait for the app or URL to complete loading. Default is true.
123123

124124
### waitTime
125-
Duration in seconds to wait after typing.
125+
Duration in seconds to wait after opening the app or URL, in addition to the wait for load.
126126

127127

128128
## Return Value
@@ -153,14 +153,14 @@ Open(url: "https://simular.ai")
153153

154154

155155

156-
# `Type`(text:withReturn:waitTime:waitForLoadComplete)
156+
# Type(text:withReturn:waitTime:waitForLoadComplete)
157157

158158

159159
Type using the keyboard.
160160

161161

162162
```swift
163-
func `Type`(
163+
func Type(
164164
text: String,
165165
withReturn: Bool = false,
166166
waitTime: Int = 0,
@@ -279,7 +279,7 @@ Shortcut(key: "enter")
279279

280280

281281

282-
# Click(at:element:clickType:withCommand:spatialRelation:anchorConcept:prior:position:includeInvisible:waitForLoadComplete:waitTime)
282+
# Click(_:element:clickType:withCommand:spatialRelation:anchorConcept:prior:position:includeInvisible:waitForLoadComplete:waitTime)
283283

284284

285285
Click on something, either specified by the `at` argument or the `element` argument.
@@ -288,7 +288,7 @@ Disambiguate by specifing the spatial relation between the target element and an
288288

289289
```swift
290290
func Click(
291-
at: String = "",
291+
_ at: String = "",
292292
element: UIElement? = nil,
293293
clickType: String = "left",
294294
withCommand: Bool = false,
@@ -363,14 +363,14 @@ Click(at: "verify insurance button", withCommand: true)
363363
```swift
364364
Click(at: "Styles.zip", clickType: "doubleClick")
365365
```
366-
- Instruction: click slider closest to pointer size
366+
- Instruction: click "slider" closest to and on the right of "pointer size"
367367
```swift
368-
Click(at: "slider", spatialRelation: "closest", anchorConcept: "pointer size")
368+
Click(at: "slider", spatialRelation: "closest,right", anchorConcept: "pointer size")
369369
```
370370

371371

372372

373-
# Move(to:element:spatialRelation:anchorConcept:prior:includeInvisible:waitForLoadComplete:waitTime)
373+
# Move(_:element:spatialRelation:anchorConcept:prior:includeInvisible:waitForLoadComplete:waitTime)
374374

375375

376376
Moves the cursor to an object. Disambiguate by specifing the spatial relation between the target element and an anchor concept.
@@ -379,7 +379,7 @@ All parameters besides `to` have the same definition as those in the `Click` act
379379

380380
```swift
381381
func Move(
382-
to: String = "",
382+
_ to: String = "",
383383
element: UIElement? = nil,
384384
spatialRelation: String = "",
385385
anchorConcept: String = "",
@@ -471,7 +471,7 @@ Description of elements to get from the page. Required if elementRoles are not p
471471

472472
### threshold
473473
If `elementOverallDescription` is given, then accept candidate elements whose normalized string
474-
distance to `elementOverallDescription` is below this threshold value.
474+
similarity to `elementOverallDescription` is above this threshold value.
475475

476476
### root
477477
If given, then the search is limited to elements contained within this root element.
@@ -537,14 +537,91 @@ var cellDict = GetElements(elementRoles: ["cell"], spatialRelation: "containedIn
537537

538538

539539

540-
# Respond(message:requireConfirm)
540+
# GetAttributeOfElement(elementRole:elementOverallDescription:attribute:threshold:root:spatialRelation:anchorRole:anchorOverallDescription:anchorElements:horizontalRank:verticalRank)
541+
542+
543+
Searches for an element that matches the input criteria and gets the element's value for a specified attribute.
544+
545+
546+
```swift
547+
func GetAttributeOfElement(
548+
elementRole: String = "",
549+
elementOverallDescription: String = "",
550+
attribute: String = "",
551+
threshold: Double = 0.75,
552+
root: UIElement? = nil,
553+
spatialRelation: String = "",
554+
anchorRole: String = "",
555+
anchorOverallDescription: String = "",
556+
anchorElements: [UIElement] = [],
557+
horizontalRank: Int? = nil,
558+
verticalRank: Int? = nil
559+
) -> String
560+
```
561+
562+
## Parameters
563+
564+
### elementRole
565+
Role of the target element. Required if elementOverallDescription is not given.
566+
567+
### elementOverallDescription
568+
Description of the element. Required if elementRoles are not provided.
569+
570+
### attribute
571+
Valid options are: "role", "description", "title", "value". For example, use "value" to get the value of text elements.
572+
573+
### threshold
574+
If `elementOverallDescription` is given, then accept candidate elements whose normalized string similarity with `elementOverallDescription` is above this threshold value.
575+
576+
### root
577+
If given, then the search is limited to elements contained within this root element.
578+
579+
### spatialRelation
580+
A comma-separated String of spatial relationships between the target elements and the anchor.
581+
582+
### anchorRole
583+
Role of element(s) used as anchor for spatial relation.
584+
585+
### anchorOverallDescription
586+
Description of an object used as an anchor with spatialRelation.
587+
588+
### anchorElements
589+
Elements to use as anchor for spatial relation constraints. If `anchorElements` is provided, then anchorRole and anchorOverallDescription are ignored.
590+
591+
### horizontalRank
592+
If given, sorts the elements by x-coordinate of frame midpoint and returns the element with this rank. Left-most element has rank 1.
593+
594+
### verticalRank
595+
If given, sorts the elements by y-coordinate of frame midpoint and returns the element with this rank. Top-most element has rank 1.
596+
597+
598+
## Return Value
599+
600+
String value of an attribute of an element
601+
602+
## Discussion
603+
604+
Examples:
605+
606+
- Instruction: Get the value of the radioButton element with description "radioButton tab point & click"
607+
```swift
608+
var value = GetAttributeOfElement(elementRole: "radioButton", elementOverallDescription: "radioButton tab point & click", attribute: "value")
609+
```
610+
- Instruction: Get the value of the valueIndicator element closest to and on the right of "statictext text double-click speed"
611+
```swift
612+
var value = GetAttributeOfElement(elementRole: "valueIndicator", attribute: "value", spatialRelation: "closest,right", anchorOverallDescription: "statictext text double-click speed")
613+
```
614+
615+
616+
617+
# Respond(_:requireConfirm)
541618

542619

543620
Respond to the user with a message and optionally ask for user confirmation to proceed.
544621

545622

546623
```swift
547-
func Respond(message: String, requireConfirm: Bool = false)
624+
func Respond(_ message: String, requireConfirm: Bool = false)
548625
```
549626

550627
## Parameters
@@ -615,14 +692,14 @@ var summary = LLM(input: "Summarize the following into 50 words: \(content)")
615692

616693

617694

618-
# ConceptsExist(concepts)
695+
# ConceptsExist(_)
619696

620697

621698
Checks if all the concepts can be found on the current visible screen.
622699

623700

624701
```swift
625-
func ConceptsExist(concepts: [String]) -> Bool
702+
func ConceptsExist(_ concepts: [String]) -> Bool
626703
```
627704

628705
## Parameters
@@ -890,8 +967,6 @@ Examples:
890967
```swift
891968
Print("Simular")
892969
```
893-
///
894-
895970

896971

897972
# CopyToClipboard(text)
@@ -1083,6 +1158,37 @@ var dict = GetDictFromJson(jsonStr: llmOutput)
10831158

10841159

10851160

1161+
# GetJSONFromDict(dict)
1162+
1163+
1164+
Gets a JSON representation of a dictionary.
1165+
1166+
1167+
```swift
1168+
func GetJSONFromDict(dict: [String: Any]) -> String
1169+
```
1170+
1171+
## Parameters
1172+
1173+
### dict
1174+
A [String: Any] dictionary.
1175+
1176+
1177+
## Return Value
1178+
1179+
A JSON representation of the input dictionary.
1180+
1181+
## Discussion
1182+
1183+
Examples:
1184+
1185+
- Instruction: convert dict to json.
1186+
```swift
1187+
var json = GetJSONFromDict(dict)
1188+
```
1189+
1190+
1191+
10861192
# GetFromClipboard()
10871193

10881194

@@ -1233,21 +1339,20 @@ if var elem = SoftDictLookup(dict: elemDict, query: "first name") {
12331339

12341340

12351341

1236-
# Wait(unit:waitTime)
1237-
1342+
# Wait(_:unit)
12381343

12391344

12401345
Put Agent into sleep state for a certain amount of time.
12411346

12421347

12431348
```swift
1244-
func Wait(unit: String, waitTime: Int)
1349+
func Wait(_ waitTime: Int, unit: String = "s")
12451350
```
12461351

12471352
## Parameters
12481353

12491354
### unit
1250-
Units of waitTime, default is s for seconds. Options are s and ms.
1355+
Options are "s" for seconds (default) and "ms" for milliseconds.
12511356

12521357

12531358
## Return Value
@@ -1260,16 +1365,12 @@ Examples:
12601365

12611366
- Instruction: Wait for 3s
12621367
```swift
1263-
Wait(waitTime: 3, unit: "s")
1368+
Wait(3)
12641369
```
1265-
- Instruction: Wait for 0.5s
1370+
- Instruction: Wait for 500ms
12661371
```swift
12671372
Wait(waitTime: 500, unit: "ms")
12681373
```
1269-
- Instruction: Wait for 6 seconds
1270-
```swift
1271-
Wait(waitTime: 6)
1272-
```
12731374

12741375

12751376

@@ -1376,16 +1477,53 @@ var A1Column = GetTableColumn(index: "A1")
13761477

13771478

13781479

1379-
# WriteToFile(text:filePath:overwrite)
1480+
# ReadFile(path)
1481+
1482+
1483+
Read the contents of a file whose location is specified by `path`.
1484+
1485+
1486+
```swift
1487+
func ReadFile(path: String) -> String
1488+
```
1489+
1490+
## Parameters
1491+
1492+
### path
1493+
Either an absolute path to a file, or a name of a file (assumed to be in the default app cache directory).
1494+
1495+
1496+
## Return Value
1497+
1498+
Contents of the file as a String
1499+
1500+
## Discussion
1501+
1502+
Examples:
1503+
1504+
- Instruction: read the file named results.json
1505+
```swift
1506+
var results = ReadFile(path: "results.json")
1507+
```
1508+
- Instruction: get contents of file /Users/somebody/Documents/project/links.txt
1509+
```swift
1510+
var links = ReadFile(path: "/Users/somebody/Documents/project/links.txt")
1511+
```
1512+
1513+
1514+
1515+
# WriteToFile(text:path:overwrite)
13801516

13811517

13821518
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.
1519+
Unless specified path, writes to desktop /Library/Caches/com.simular.SimularNote/SimularActionResult/
1520+
Will throw an error if there is non-folder file named SimularActionResult also existing at desktop
13831521

13841522

13851523
```swift
13861524
func WriteToFile(
13871525
text: String,
1388-
filePath: String? = nil,
1526+
path: String? = "SimularActionResult.txt",
13891527
overwrite: Bool = false
13901528
)
13911529
```
@@ -1395,8 +1533,8 @@ func WriteToFile(
13951533
### text
13961534
Text to write to a file.
13971535

1398-
### filePath
1399-
Full path to a file. If not provided, then the default is a file "SimularActionResult.txt" at the desktop.
1536+
### path
1537+
path of the file, default at /Library/Caches/com.simular.SimularNote/SimularActionResult/{path}.txt. If path contains "/", treat it as full path
14001538

14011539
### overwrite
14021540
Whether or not to overwrite the contents if filePath points to an existing file.
@@ -1412,10 +1550,13 @@ Examples:
14121550

14131551
- Instruction: Append jsonResult to /User/somebody/Documents/result.json
14141552
```swift
1415-
WriteToFile(text: jsonResult, filePath: "/User/somebody/Documents/result.json")
1553+
WriteToFile(text: jsonResult, path: "/User/somebody/Documents/result.json")
14161554
```
14171555
- Instruction: Write jsonResult to /User/someone/Desktop/result.json, overwrite existing file.
14181556
```swift
1419-
WriteToFile(text: jsonResult, filePath: "/User/someone/Desktop/result.json", overwrite: true)
1557+
WriteToFile(text: jsonResult, path: "/User/someone/Desktop/result.json", overwrite: true)
14201558
```
1421-
1559+
- Instruction: Write jsonResult to default action result file, overwrite existing file.
1560+
```swift
1561+
WriteToFile(text: jsonResult, overwrite: true)
1562+
```

0 commit comments

Comments
 (0)