1

I've come across a script for InDesign that toggles on the 'Paste Remembers Layers' menu item.

I would LOVE a visual toggle as I use this all the time but for now this will do (unless anyone knows of something similar/better)

The issue is it only switches it ON. I would love to assign a keyboard shortcut to toggle it between ON/OFF or one for each, etc.

Can anyone tweak this for me or have any other suggestions?

Thanks in advance

    // toggle "Paste Remembers Layers"
var rem_paste_lay = app.menuActions.item('$ID/Set Paste Remembers');
var bk = rem_paste_lay.checked;
if (bk == true) {
  rem_paste_lay.invoke(); // if true toggle to false
};


// restore
if (rem_paste_lay.checked !== bk) {
  rem_paste_lay.invoke(); // if not eq bk toggle 
};
6
  • 1
    It is all there, assuming it works. If you remove everything except lines 2 and 5 it should toggle. If you want some indicator for the state, you can keep line 3 and add this at bottom alert('Paste Remembers Layers \n' + bk ? 'unchecked' ? 'checked' );. An alert window should pop up after every toggle that gives you the current state. — I did not test any of this. – Joonas Feb 24 at 12:27
  • Thank you! I'm not very good with scripting, I'm a designer so this is all foreign to me.. I now have this but it's not working: // toggle "Paste Remembers Layers" var rem_paste_lay = app.menuActions.item('$ID/Set Paste Remembers'); rem_paste_lay.invoke(); // if true toggle to false }; Any ideas? – Clomo Feb 25 at 14:47
  • I'm probably missing something. I'm not aware of this option. Which INDD version and where is the setting located? – Joonas Feb 25 at 14:55
  • It's version 16.1 The setting is in the layers panel menu dropdown – Clomo Feb 25 at 15:02
  • It seems to work fine for me, except that I'm noticing that it doesn't work without a document open. When you don't have a document open, the script says the state of this option gets toggled, but the menu item doesn't change visibly. Could that have been the issue? var rem_paste_lay = app.menuActions.item('$ID/Set Paste Remembers'); rem_paste_lay.invoke(); alert('Paste Remembers Layers: \n' + (rem_paste_lay.checked ? 'ON' : 'OFF') ); – Joonas Feb 25 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.