Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Repeting task with hotkey

Contributor ,
Feb 26, 2025 Feb 26, 2025

Hi friends!

I want to assign to a hot key:

1. insert achored obejct (text box) again and again always witht the certian settings that I will choose the first time and assign that exact action to a hot key.

Sorry if so simple

-- SF

TOPICS
Scripting
419
Translate
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 Expert ,
Feb 26, 2025 Feb 26, 2025

Hi @SuzzyFlamingo:

 

InDesign doesn't have macros/actions that you can record and assign to a hot key as you are describing. Someone with scripting knowledge can help with a script that will do this and I'll add the scripting tag to get their attention. 

 

In the meantime, without outside help (and a potential fee for development—it depends on who responds and the complexity of the job), you can create an object style for your text frame with your prefered settings. This will allow you to draw a text frame, drag to anchor it and then assign the object style (that can be assigned a keyboard shortuct!) with your frame presets.

 

See https://helpx.adobe.com/indesign/using/object-styles.html

 

~Barb

Translate
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 Expert ,
Feb 26, 2025 Feb 26, 2025

Barb nailed it: a script can place a frame and apply an object style. Here's the script. Where it says 'xyz' enter the name of your object style.

(function () {
  try {
    var tf = app.selection[0].textFrames.add ({
      appliedObjectStyle: app.activeDocument.objectStyles.item ('xyz')
    });
    tf.insertionPoints[0].select();
  } catch (_) {
    alert ('Select an insertion point');
  }
}());

The anchored frame is inserted and the cursor is placed in the frame so you can type away straight away.

 

Apply the script to a shortcut key in the keyboard editor.

Translate
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
Contributor ,
Feb 27, 2025 Feb 27, 2025

Thank you for your attention!

I tried it and I am getting this error: (the cursor is positioned within a text frame)

Screenshot_65.png

Plz inform

Thank you, and have a good day!
Susan Flamingo

Translate
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 Expert ,
Feb 27, 2025 Feb 27, 2025

As the message says: select an insertion point. In other words, click in the text where the anchor should be placed.

Translate
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
Contributor ,
Feb 27, 2025 Feb 27, 2025

I did that again and again before and after the message and still get:Screenshot_67.png

Translate
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 Expert ,
Feb 27, 2025 Feb 27, 2025
LATEST

Then you probably don't have an object style defined. The error message is too general, it's not just about the selection. So here is a different version of the script.

 

Again, insert the name of your object style. Where it says van name = 'xyz' replace xyz with the name of your style.

 

(function () {
  
  var name = 'xyz';
  var ostyle = app.activeDocument.objectStyles.item (name);
  
  if (!ostyle.isValid) {
    alert ('The object style ' + name + ' does not exist');
    exit();
  }

  if (app.selection.length === 0 
      || !(app.selection[0] instanceof InsertionPoint)) {
    alert ('Select an insertion point');
    exit();
  }
  

  var tf = app.selection[0].textFrames.add ({
    appliedObjectStyle: ostyle
  });
  tf.insertionPoints[0].select();

}());
Translate
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