-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom-functions.py
29 lines (27 loc) · 918 Bytes
/
custom-functions.py
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
from talon import Context, actions, Module
mod = Module()
@mod.action_class
class NatCustomFunctions:
def hunt_and_enter(text: str,occurrence: int = 0):
"""Searches for text in browser, exits the search box, presses enter to activate link result)"""
actions.key("cmd-f")
actions.sleep("300ms")
actions.key("backspace")
actions.sleep("300ms")
actions.insert("keyword_clear")
actions.sleep("300ms")
actions.key("cmd-a")
actions.sleep("300ms")
actions.key("backspace")
actions.sleep("300ms")
actions.insert(text)
actions.sleep("300ms")
counter = 0
while counter < occurrence - 1:
# actions.sleep("200ms")
actions.key("enter")
counter += 1
actions.sleep("300ms")
actions.key("escape")
actions.sleep("300ms")
actions.key("enter")