Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Is it possible to create a script that emulates key combinations?

Explorer ,
Oct 22, 2021 Oct 22, 2021

Copy link to clipboard

Copied

Is it possible to write scripts that emulate a key combination? 

 

As an exmaple, could you write a script that exectues "shift+right key" combination on the keyboard so if a word is highlighted, it would add an extra highlighted character to the word when activating the script.

 

Sometimes I feel like it would be easier if I just had my indesign scripts panel open and double clicking on a script instead of doing a shortcut key combination. Thanks!

TOPICS
Scripting

Views

168

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 22, 2021 Oct 22, 2021

Copy link to clipboard

Copied

You can have your Scripts panel open - Window>Utilities>Scripts

And dock the script panel with your other panels.

I have mine docked to the left beside the Tools. 

You can then Save your workspace.

https://helpx.adobe.com/indesign/using/workspace-basics.html

 

 

 

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 23, 2021 Oct 23, 2021

Copy link to clipboard

Copied

You can apply key commands to your scripts via Edit>Keyboard Shortcuts>Product Area>Scripts, or simply leave your Scripts panel open.

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 23, 2021 Oct 23, 2021

Copy link to clipboard

Copied

As an exmaple, could you write a script that exectues "shift+right key" combination on the keyboard

 

Re-read your post, are you looking for a script that will add a character to the text selection so you can avoid the key command? It is scriptable, something like this:

 

 

var a = 1;
try {
    var s = app.documents[0].selection[0];
    app.documents[0].select(s.parent.characters.itemByRange(s.characters[0].index, s.characters[s.length-1].index+a));
}catch(e) {}; 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 23, 2021 Oct 23, 2021

Copy link to clipboard

Copied

Yeah, that was just one example. I was hoping it would be possible so I could edit the script to do any number of key combinations, without having to know how to write javascript. I knew it probably wasn't possible unfortuantely. Thank you very much for that script though. I will definitely be using it a lot. For some reason if you highlight a word that has a period at the end, it doesnt highlight the period as well, so this script will come in handy for that.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 23, 2021 Oct 23, 2021

Copy link to clipboard

Copied

Not a direct solution, but I've worn out three Logitech macro keyboards in the last few years. Being able to automate actions way out at the user interface solves/enables a lot of things that even sophisticated scripting can't.

.
||| Word & InDesign to Kindle: A Professional Guide. (It's on Amazon.) |||

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 23, 2021 Oct 23, 2021

Copy link to clipboard

Copied

Yeah I bought a Motospeed numpad that I use for exactly that. Unfortunately I've already assigned shortcuts/scripts to all the keys on that now. Maybe it's time to buy a second one. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 24, 2021 Oct 24, 2021

Copy link to clipboard

Copied

AutoHotKey

Send,^+r ;it will send ctrl+shift +r in any program you want

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 24, 2021 Oct 24, 2021

Copy link to clipboard

Copied

There are a few ways that I can use to activate my scripts:

  1. Use quick apply (Command/Ctrl + Enter) - brings up a dialog where - by typing the name of the command you want, it can be called upon. There is the ability to add scripts to this by clicking the down arrow to the left of the text field and select Include Scripts (s:);
  2. Apply keyboard shortcuts to scripts as outlined by Rob Day in an earlier post;
  3. Make the script accessible via the contextual menu so that it can be called upon by right-clicking and navigating to the script in the menu - this requires some scripting knowledge.
  4. Make the script accessible via the main menu as outlined by Marc Autret over at Indiscripts: https://www.indiscripts.com/post/2010/02/how-to-create-your-own-indesign-menus
  5. If you have tons of scripts and don't want to have to scroll all day in the scripts panel, Peter Kahrel has a script launcher that can filter out scripts to make them easier to find: https://creativepro.com/files/kahrel/indesign/runscript.html
  6. Hot-key a script using an additional button on a mouse, tablet or other navigating device;
  7. If you have an old smartphone that is gathering dust, turn it into a device similar to Elgato's Streamdeck by using software called Touch Portal... or if you have access to Elgato's Streamdeck, consider using the buttons on the streamdeck.

I've written some of these tips in more description over here: https://colecandoo.com/2020/08/02/small-tips-to-save-big-time/

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 24, 2021 Oct 24, 2021

Copy link to clipboard

Copied

Cool article (small tips...) 🙂

that's exactly how I think about work. Too bad you're a Mac user :), AutoHotKey is an incredible thing. for example radial menu:

https://youtu.be/t99qBlasVmM

Když pracujete na klientovi, který má ve svém brand manuálu desítky ikon nebo dalších prvků, tak je dobré je mít vždycky rychle po ruce. Zpravidla k tomu slo...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 27, 2021 Oct 27, 2021

Copy link to clipboard

Copied

LATEST

Just stumbled onto this github that carries on from my fourth point in my post: https://github.com/grefel/addScriptFolderToMenu/ - it's in German but view it through Chrome with translation on, should be fine.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines