Created
September 22, 2025 10:23
-
-
Save extratone/879bbbbb13379043b8325580dc8bcea4 to your computer and use it in GitHub Desktop.
Drafts Action Script to query, sort, and reformat all configured Action keyboard shortcuts as a markdown list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Drafts Action: List Action Keyboard Shortcuts (Markdown) | |
| function getAllActions() { | |
| let all = []; | |
| ActionGroup.getAll().forEach((grp) => (all = all.concat(grp.actions))); | |
| return all; | |
| } | |
| function parseShortcut(action) { | |
| try { | |
| const raw = decodeURIComponent(action.installURL.replace("drafts://action?data=", "")); | |
| const data = JSON.parse(raw); | |
| if (!data.keyCommand) return ""; | |
| const kc = data.keyCommand; | |
| const parts = []; | |
| // Apple style glyphs | |
| if (kc.commandKey) parts.push("⌘"); | |
| if (kc.optionKey) parts.push("⌥"); | |
| if (kc.controlKey) parts.push("⌃"); | |
| if (kc.shiftKey) parts.push("⇧"); | |
| if (kc.input && kc.input.length > 0) { | |
| switch (kc.input) { | |
| case "#LEFT": | |
| parts.push("←"); | |
| break; | |
| case "#RIGHT": | |
| parts.push("→"); | |
| break; | |
| case "#UP": | |
| parts.push("↑"); | |
| break; | |
| case "#DOWN": | |
| parts.push("↓"); | |
| break; | |
| case "#TAB": | |
| parts.push("⇥"); | |
| break; | |
| case "#ESC": | |
| parts.push("⎋"); | |
| break; | |
| default: | |
| parts.push(kc.input); | |
| } | |
| } | |
| return parts.join(""); | |
| } catch (e) { | |
| return ""; | |
| } | |
| } | |
| const items = []; | |
| getAllActions().forEach((act) => { | |
| const shortcut = parseShortcut(act); | |
| if (shortcut) { | |
| items.push({ title: act.name, keys: shortcut }); | |
| } | |
| }); | |
| // sort by title (case-insensitive) | |
| items.sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase())); | |
| const lines = items.map((itm) => `- *${itm.title.replace(/([*_])/g, "\\$1")}* - \`${itm.keys}\``); | |
| const output = lines.join("\n"); | |
| // copy to clipboard & pass to template tag | |
| app.setClipboard(output); | |
| draft.setTemplateTag("keylist", output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Y999 game download APK is a real-money gaming app offering high earning potential, instant withdrawals, and multiple game modes. With secure transactions, referral bonuses, and daily rewards, users in Pakistan can earn cash using Android phones.