One of my NY resolutions for 2025 is to ditch AutoHotkey for any cross-platform equivalents, and Espanso is one of them. However, an AHK script I heavily rely on is a modular address autocomplete (I refuse to store address data in the browser), which I just don’t know how to replicate in Espanso. I know it can use Python, but I’m not well-versed enough in Python to figure out:
- Storage of 2-3 addresses (and the selection of 1 of them):
- Street Name
- Line 2 (but only for certain addresses)
- City
- State
- ZIP Code
- 4-digit ZIP extension
- Google Maps (or OpenStreetMap…) share URL
- Send only the street name
- Send everything with modular inclusion or exclusion of the ZIP extension and/or related URL as:
- One line (comma-divided)
- Separate lines for pre-city data and the URL
- Simulate tab keystrokes to navigate through a webpage
- Be able to account for whether the web form has a separate line for Line 2 or not (like with a checkbox in the Espanso form or whatever’d work)
Any help with this would be much appreciated. This is as far as I got:
- trigger: '`address'
replace: '{{output}}'
vars:
- name: form
type: form
params:
layout: |
[[street]]
[[city]]
[[zip]]
[[zipext]]
[[share_url]]
fields:
street:
type: list
values:
- 123 Main St
- 456 Elm St
city:
type: list
values:
- It was at this point that I realized that the cities should be bundled with the prior lines in some sort of list, or dictionary; I don't know what would be best
- name: output
type: script
params:
args:
- python
- -c
- |
if '{{form.}}':
print(f'{{form.street}}, {{form.city}} {{form.zip}}-[[form.zipext]] [[share_url]]')
else:
print(f'Alternative rendering methods here')
You must log in or register to comment.