Can't get past a try catch finally syntax error in jsx

Hi all,

I can't seem to fix this error I get with the following macro

Screenshot 2022-06-01 at 18.09.26

  1. I'm trying to use three hotkey triggers using the up, left and right arrow keys.
  2. Depending upon which hotkey trigger is used, it's passed as a variable and used to append the text of another variable, e.g. 1C1-left, 1C1-up, 1C1-right.
  3. That appended variable is then used in a script to see if it matches existing text. If a match is found, the geometric bounds of a graphic or text frame are altered in InDesign, i.e. the box is resized.

But that flipping error comes up and the script won't work when in KM.

Write or Append a File.kmactions (9.3 KB)

Any help much appreciated. Many thanks.

I'm no JavaScript guru, but usually in programming you have a try, a catch, and in JS a finally. You've got one try, multiple catches, and a finally.

Try (ha!) taking out all the catches except the final one so it goes

try {
    all
    your
    if
    statements
}
catch (e) {
}
finally {
    app.scriptPreference.measurementUnit = savedUnits;
}

If that doesn't work, try posting the actual JavaScript file that's being created. That's the easiest place to see the problem and we can then work back to what's causing it in the KM action.

Aha, nice and simple. Thanks ever so much for your help.