AutoKey (for Linux) script for generating XML tags
# Details
when typing: something#<
trigger is: "#<"
variable: something
# Actions
1. removes the whole word and types: <something></something>
2. places the cursor in the middle.
It preserves whatever was on the clipboard.
# Code
```python
import time
#from autokey.scripting import *
import time
#from autokey.scripting import *
trigger = "#<"
original_clipboard = clipboard.get_clipboard()
# Move cursor left to remove the trigger
keyboard.send_keys("<backspace>" * len(trigger))
# Select the whole word
keyboard.send_keys("<ctrl>+<shift>+<left>")
time.sleep(0.1)
keyboard.send_keys("<ctrl>+c")
time.sleep(0.1)
selected_text = clipboard.get_clipboard().strip()
if selected_text:
keyboard.send_keys(f"<{selected_text}></{selected_text}>")
# Move cursor inside the tags
keyboard.send_keys("<left>" * (len(selected_text) + 3))
clipboard.fill_clipboard(original_clipboard)
#from autokey.scripting import *
import time
#from autokey.scripting import *
trigger = "#<"
original_clipboard = clipboard.get_clipboard()
# Move cursor left to remove the trigger
keyboard.send_keys("<backspace>" * len(trigger))
# Select the whole word
keyboard.send_keys("<ctrl>+<shift>+<left>")
time.sleep(0.1)
keyboard.send_keys("<ctrl>+c")
time.sleep(0.1)
selected_text = clipboard.get_clipboard().strip()
if selected_text:
keyboard.send_keys(f"<{selected_text}></{selected_text}>")
# Move cursor inside the tags
keyboard.send_keys("<left>" * (len(selected_text) + 3))
clipboard.fill_clipboard(original_clipboard)
```
# Trigger setup (this is important as it goes along with the code)
# Demo

Hope it helps.