⌨️📝 Keyboard Shortcuts in the Description

by Trapier Marshall

Version 5 (December 9, 2024)

Download (44 downloads)

Describe a keyboard shortcut for a particular app in the description below and Automate will do the rest.

Built-in shortcut ctrl+h shows shortcuts active in the current app.

See below for examples. Changes take effect without restarting the flow.

Shortcuts consist of:
1) A key combination. Block 107 has key names.
2) A comma separated sequence of buttons to click, identified by one of the following:
- Text supports glob (*) matching and is case insensitive for English characters A-Z.
- Element id using the syntax id=element_id. Specify fully qualified IDs including the '@' prefix, or in the common case where the ID contains the package name prefix like
"@com.android.somepackage:id/someid", just provide "someid".
- To click by xpath instead, use the syntax xpath=xpath. No more than one button can be clicked when using this syntax.
- To click by xpath with an offset, use syntax xpathOffset=xoffset,yoffset,xpath. x and y offset are specified as ratios of the element height. Negative offsets are untested but should work.

This flow is logging intensive. Suggest disabling logging once it's up and running.

This flow is a work in progress. Syntax may change with future updates.

CHANGELOG
=========
v5
- don't completely bail on an app if we can't determine screen dimensions when it comes up
v4
- ctrl+h for help works more than once
v3
- fix "xpath=" or "xpathoffset=" shortcuts only work once
v2
- Support Automate
- Add targets fully qualified id, xpath, xpathOffset
- Fix multi-target shortcuts are single use
- Fix repeatedd clicks in gmail

REFERENCES
===========
- Description-as-config borrowed from Hub Space @ https://llamalab.com/automate/community/flows/44477

TODO
=====
- [x] add support for Automate
- [x] toast when combo pressed
- [ ] allow restricting shortcuts by activity class
- [ ] support Alt
- [ ] support Shift
- [ ] handle app (un)installation

VVVVVVVVVVV
Automate
- ctrl+b Add
- ctrl+c id=@android:id/copy
- ctrl+d more options, Delete
- ctrl+e id=edit_flow
- ctrl+g more options, Go to
- ctrl+r id=start
- ctrl+s SAVE
# select first auto-completion
- ctrl+enter xpathOffset=0.5,1.2,//*[@android:editable='true' and @android:focused='true' and (@android:id='@com.llamalab.automate:id/edit_expression' or @android:id = '@com.llamalab.automate:id/edit_variable')]
# select first result from block add menu
- ctrl+enter xpath=//android.widget.ExpandableListView/android.view.ViewGroup[2]/android.widget.TextView[1]

ChatGPT
- ctrl+d Dictation
- ctrl+d tap to stop*
- ctrl+enter Send message
- ctrl+L Message

Firefox Nightly
- ctrl+a reAder view
- ctrl+f menu, Find*
- ctrl+t tabs, Add*
- ctrl+p tabs, Private Tabs, Add*
- ctrl+L search or enter Address
- ctrl-r menu, Refresh

Gmail
- ctrl+u Mark unread
- ctrl+b More options, Snooze
- ctrl+e Archive
- ctrl+r Reply
- ctrl+3 Delete
- ctrl+m More options,Mute

Messages
- ctrl+enter Send sms

TickTick
- ctrl+enter id=iv_save
- ctrl+w id=fl_overflow, Won't do

WhatsApp
- ctrl+enter Send