如何通过ExtendScript调用Premiere Pro已有快捷键?
Hey there! I’ve been stuck in this exact spot while building Premiere automation scripts, so I totally get how frustrating it is when the official guide doesn’t cover the functionality you need. Let’s break down your best options for triggering those shortcut-reliant actions:
1. Use Internal Command IDs (Most Reliable Approach)
Skip simulating shortcuts directly if you can—Premiere maps nearly all its actions to internal command IDs that you can call directly via ExtendScript. This is way more stable because it doesn’t depend on a user’s custom shortcut setup.
To find the command ID for your target action:
- Run this quick script in Premiere’s ExtendScript Toolkit to list all available commands and their IDs:
var allCommands = app.findMenuCommandIds(); for (var i = 0; i < allCommands.length; i++) { try { var cmdName = app.getMenuCommandName(allCommands[i]); $.writeln(`${allCommands[i]}: ${cmdName}`); } catch (e) { // Skip hidden/system commands that throw errors continue; } } - Search the output for your desired action (e.g., "Split Clip" or "Export Media")
- Execute the command using its numeric ID:
app.executeCommand(12345); // Replace with the ID you found
2. Simulate Keyboard Shortcuts (Fallback for Unlisted Commands)
If the action you need doesn’t have a corresponding command ID, you’ll need to simulate keystrokes at the system level. The method varies by operating system:
Windows
Use AutoHotkey (AHK) to create a tiny script that triggers your shortcut, then call it from your ExtendScript:
- Create an AHK file (e.g.,
triggerShortcut.ahk) with your target shortcut:; Example: Trigger Ctrl+K (Split Clip) Send ^k - Call the script from your ExtendScript:
$.shellExecute("C:\\path\\to\\triggerShortcut.ahk");
Pro tip: Add WinActivate, Adobe Premiere Pro CC 2019 to the AHK script to ensure Premiere is focused before the shortcut runs.
Mac
Use AppleScript via the system shell to simulate keystrokes. Run this from your ExtendScript:
$.shellExecute(`osascript -e 'tell application "Adobe Premiere Pro CC 2019" to activate' -e 'tell application "System Events" to keystroke "k" using {control down}'`);
Replace "k" and the modifier keys with your target shortcut.
Quick Notes
- Always prioritize command IDs over shortcut simulation—simulated keystrokes can fail if Premiere isn’t active, or if the user has modified their shortcut mappings.
- Test thoroughly! Premiere’s command list includes some hidden or duplicate IDs, so verify each ID works as expected before deploying your script.
内容的提问来源于stack exchange,提问作者Louwrens Jacobus Labuschagne

