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

a quick question, how to call from a script "force redraw"?

Advisor ,
Sep 19, 2013 Sep 19, 2013

Copy link to clipboard

Copied

For "debuging" purposes, i want to call from a script a "force redraw" of the current layout window (default keyboard shortcut Shift+F5). I can't find anything like that in the DOM, and i was thinking of invoking a menu.. but can't find the menu item for it either..

anyone?

TOPICS
Scripting

Views

2.0K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Sep 19, 2013 Sep 19, 2013

Or maybe minimizing, maximizing the specific layoutWindow of the document?

"Force Redraw" should be available by its ID value 318:

//Invoke the menu "Force Redraw":

try{app.scriptMenuActions.itemByID(318).invoke()}catch(e){$.writeln(e.message)};

Uwe

Votes

Translate

Translate
Community Expert ,
Sep 19, 2013 Sep 19, 2013

Copy link to clipboard

Copied

Maybe recompose something (a text frame or something like that). Does that work?

Or juggle with the screen mode:

app.windows[0].screenMode = ScreenModeOptions.PREVIEW_OFF

app.windows[0].screenMode = ScreenModeOptions.PREVIEW_TO_BLEED

Never done this: I usually try to prevent screen redraws!

Peter

Votes

Translate

Translate

Report

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 ,
Sep 19, 2013 Sep 19, 2013

Copy link to clipboard

Copied

Or maybe minimizing, maximizing the specific layoutWindow of the document?

"Force Redraw" should be available by its ID value 318:

//Invoke the menu "Force Redraw":

try{app.scriptMenuActions.itemByID(318).invoke()}catch(e){$.writeln(e.message)};

Uwe

Votes

Translate

Translate

Report

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
Advisor ,
Sep 20, 2013 Sep 20, 2013

Copy link to clipboard

Copied

Thanks Uwe.

@Peter: I don't dare recompose anything, as this script is basicly a helper tool for a last visual inspection of the document, before signing it off. The screenmode toogleing creates a huge visual flicker, that mostly defeats the purpose of fast previewing the document, and if the document is large enough will give you a headache at least (at most it will make you spill your lunch).

Votes

Translate

Translate

Report

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 ,
Sep 20, 2013 Sep 20, 2013

Copy link to clipboard

Copied

Absolutely. I didn't know Force Redraw existed. Where in the menus is it (just curious)?

Votes

Translate

Translate

Report

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
Advisor ,
Sep 20, 2013 Sep 20, 2013

Copy link to clipboard

Copied

good question.. i only know (and use extensivly) the keyboard shortcut (shift+F5). probably it's hidden by default.

Votes

Translate

Translate

Report

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 ,
Sep 20, 2013 Sep 20, 2013

Copy link to clipboard

Copied

@Vamitul & Peter – "Force Redraw" ("Aktualisierung erzwingen" in my German version of InDesign) is a very old feature that dates back at least to InDesign CS3.


You can guess that from its relative low ID value of 318.

I don't know if it ever got an individual UI component like a menu command visible to the user, but it resides in the [Standard] set of keyboard shortcuts.

I just opened my German InDesign CS3 and it  is available there:

Ansichten-Navigation-Aktualisierung erzwingen.png

"Ansichten, Navigation" in German.
Maybe "Views, Navigation" in English?

Uwe

Votes

Translate

Translate

Report

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 ,
Sep 20, 2013 Sep 20, 2013

Copy link to clipboard

Copied

And there are several others in the same section:

ID Menu Command

318
Force redraw
319
New default document
324
Activate last-used field in panel
325
Close all
326
Save all
327
Close document
328
Open context menu
329
Next window
330
Previous window

Uwe

Votes

Translate

Translate

Report

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 ,
Mar 14, 2019 Mar 14, 2019

Copy link to clipboard

Copied

Laubender  wrote

Or maybe minimizing, maximizing the specific layoutWindow of the document?

"Force Redraw" should be available by its ID value 318:

//Invoke the menu "Force Redraw": try{app.scriptMenuActions.itemByID(318).invoke()}catch(e){$.writeln(e.message)};

Uwe

FWIW:

it seems that itemByID(318) is working, but itemByName() is not working with "Force Redraw":

// Looking in vain for a working string with "Force Redraw":

// I would expect that with my German version of InDesign:

app.scriptMenuActions.itemByName("Force Redraw").isValid; // returns false

// Let's see if the found string "$ID/Force Redraw" will work. Apparently not:

var resultsArray = app.findKeyStrings( app.scriptMenuActions.itemByID(318).title );

app.scriptMenuActions.itemByName( resultsArray[0] ).isValid; // returns false

// Here a variant of the same result:

var resultsArray = app.findKeyStrings( app.scriptMenuActions.itemByID(318).name );

app.scriptMenuActions.itemByName(resultsArray[0]).isValid; // returns false

// Also this will not work using my German version of the string in my German InDesign:

app.scriptMenuActions.itemByName( app.scriptMenuActions.itemByID(318).name ).isValid; // returns false

app.scriptMenuActions.itemByName( app.scriptMenuActions.itemByID(318).title ).isValid; // returns false

// However using itemByID() instead of itemByName() would work.

// Just tested with my German InDesign CC 2019 on Windows 10:

app.scriptMenuActions.itemByID(318).isValid; // returns true

Regards,
Uwe

Votes

Translate

Translate

Report

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
Guide ,
Mar 14, 2019 Mar 14, 2019

Copy link to clipboard

Copied

Hello Uwe,

This worked very well for me, thanks.

It would be nice if there was a more subtle way. I really just want to redraw a story, even better a selection.

P.

Votes

Translate

Translate

Report

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 ,
Mar 14, 2019 Mar 14, 2019

Copy link to clipboard

Copied

Hi Pickory ,

"Recompose All Stories" could be an alternative perhaps.

But it's also not that subtle:

app.menuActions.itemByName("$ID/Recompose all stories").invoke();

See also this:

Updating a document's layout

Also consider method recompose() that is available for all text objects, tables, rows and columns or individual table cells.

Regards,
Uwe

Votes

Translate

Translate

Report

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
Engaged ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

LATEST

I'm trying to add a page refresh to a script of mine, and it doesn't seem to be working in a loop:

for(i = 0;i<5;i++){
app.activeWindow.activePage = app.activeDocument.pages[i];
$.sleep(2000);
try{app.scriptMenuActions.itemByID(318).invoke()}catch(e){$.writeln(e.message)};
}

Are there any methods that would allow the document to refresh after navigating to each page and pausing for a few seconds? Just a nice to have in the script.

Votes

Translate

Translate

Report

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