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 '21 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 '21 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 '21 at 14:55
  • It's version 16.1 The setting is in the layers panel menu dropdown
    – Clomo
    Feb 25 '21 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 '21 at 15:21
0

Did some prelim searching for a better solution and found this post, in case anyone wants an alternate solution I use a workaround at work to avoid scripting (is this the right crowd for that? :)).
It's not ideal but you can create 2 custom Toggle on / Toggle off actions:
1. Create a new action (Windows > Actions > ---ActionPanelMenu > New Action...)
2. Once the new action (Action 1) is recording:
3. Navigate to Layers to toggle/ check "Paste Remember Layers"
(---LayersPanelMenu > Past Remember Layers)
4. > Stop recording (Square stop icon on the Actions panel)
5. Repeat 1-3 for Action 2, but this time toggle / uncheck Paste Remember Layers
6. > Stop recording
You should have 2 actions, I named them and gave them a keyboard shortcut:
Action 1 = PasteRememberLayers ON (I assigned F10)
Action 2 = PasteRememberLayers OFF (I assigned Ctrl+F10)

Unfortunately Illustrator still doesn't have conditionals to do this with 1 action... Hope that helps!

Illustrator Actions Toggle Paste Remember Layers

1
  • Welcome to GD.SE!
    – Mensch
    Dec 3 '21 at 19:37

Your Answer

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

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