-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate_repeat.py
More file actions
22 lines (18 loc) · 981 Bytes
/
template_repeat.py
File metadata and controls
22 lines (18 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import time
from key_code import *
"""
Refer to API to see how to use repeat_api
invoker is the hotkey (list of keys) that invoked this action
"""
def action(controller, invoker):
mem = controller.shared_memory.get_instance('global') # Change string to change namespace
m = controller.mouse
k = controller.key
t = controller.tool
# k.set_timeout_sec(5) # Optional: set timeout for any of the above component if you think your call takes a long time
hk = [] if len(invoker['hotkey']) == 0 else invoker['hotkey'][0]
ks = [] if len(invoker['key_sequence']) == 0 else invoker['key_sequence'][0]
var = (invoker['variables'][0]['variable']['namespace'], invoker['variables'][0]['variable']['name']) if len(invoker['variables']) > 0 else ('', '')
mg = None if len(invoker['mouse_gesture']) == 0 else invoker['mouse_gesture'][0]['name']
phrase = None if len(invoker['phrases']) == 0 else invoker['phrases'][0]
# Begin generated code