0

I have no experience with scripting, but I can maybe explain what the intented script should do:

  1. Select text, cut it. Ctrl + X after mouseUp.
  2. Make textbox (manually). Drag with mouse, if possible "toggle" the hold Alt function to draw same x,y valued box.
  3. Check if box is created then paste text inside it. Ctrl + V

Rough idea of what I could find on the forums so far:

app.selection[0].endHorizontalOffset - app.selection[0].horizontalOffset
var textBox = app.selection[0].textFrames.add();
textBox.geometricBounds[];
app.select(ip, SelectionOptions.REPLACE_WITH);
textBox.contents = app.paste();

My job requires to do this a tedious number of times, possibly leading to repetitive strain injury.

9
  • If the text frame is to be drawn manually, what possible benefit would a script contain over simply using keyboard shortcuts to copy/draw frame/paste ? The "repetitive strain injury" comment seems a bit hyperbolic. Thousands do this, and have been doing this for years without such issues. You're more likely to develop issues using a mouse than copy/pasting.
    – Scott
    Apr 10, 2021 at 4:42
  • If there might be a way to make this automated, why not? It doesn't justify "have been doing this for years" in my opinion, can help speed up the process.
    – Amorim
    Apr 10, 2021 at 4:54
  • My point is, you are essentially looking to script ... copy... paste... All I'm asking is how a script would be faster than merely using two keyboard shortcuts. At the very most.... a script would reduce things to 1 keyboard shortcut while running slower overall.
    – Scott
    Apr 10, 2021 at 5:23
  • I would not have to need to use the keyboard and 2/3 fingers to do the shortcuts (those that are also in a bad position), making me remove 2/3 more clicks every text I have to add. Also the "hold alt" to make the box W/H better is another button I would remove from my hand strain. If we have the tecnology to make it easier/ faster to use (using only the mouse), won't be a problem to use it.
    – Amorim
    Apr 10, 2021 at 5:48
  • I don’t think there is a way to do this. You could make a script that runs at a shortcut key and pastes the clipboard content into the selected text frame, but as Scott says, that would just be trading Ctrl + V for a different shortcut (or mouse click) to run the script. You could perhaps save a tiny bit of work by making a script that cuts selected text and inserts it into a new text frame, which you can then resize manually – but that’s also a very minor improvement over simply doing Ctrl + X, escape, Ctrl + C, resize new frame. Apr 10, 2021 at 7:26

1 Answer 1

0

Got an Auto Hotkey macro to do what I needed and it indeed saved me a lot of time, Script was a bad idea. Won't publish it here since it's not related to the inDesign Scripts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.