InDesign hidden windows

Hi all,

I was hoping someone might be able to help me. I’ve written a script that involves opening multiple InDesign documents. It works fine as is, but I was hoping to improve it. I stumbled across a post on here that mentions opening an .indd without the window being visible. It claims that it speeds everything up. Plus, it would look a lot neater:

http://macscripter.net/viewtopic.php?id=23470

I’ve been searching around and I can’t find a way to make this work. The code below (inddPageTemplate has been defined earlier in the script) doesn’t seem to do the job:

tell application "Adobe InDesign CC 2017"
	set user interaction level of script preferences to never interact
	open inddPageTemplate without window
	tell active document

	---body of script goes here
	
	save
	close
end tell
end tell

I’m aware that this forum post is 12 years old (!). Does anyone know if this is still possible? I’m using InDesign CC 2017 on Mac OS 12.10.6.

Thanks in advance.

This works for me:



tell application "Adobe InDesign CC 2017"
	set user interaction level of script preferences to never interact
	set thisDoc to (open inddPageTemplate without window)
	tell thisDoc
		set contents of text frame "textflow1" of page 1 to "abc"
		
		---body of script goes here
		
		save
		close
	end tell
	set user interaction level of script preferences to interact with all	
end tell


Thanks kerflooey. That doesn’t seem to work for me though. Perhaps we’re running different versions of InDesign? The methods laid out in the Adobe InDesign Scripting Guide for CS6 don’t work either.

However, I have managed to achieve what I wanted with the following:

set inddPageTemplate to ((path to desktop folder) & "PageTemplate.indd") as string as alias


tell application "Adobe InDesign CC 2017"
	set user interaction level of script preferences to never interact
	set thisDoc to open inddPageTemplate without showing window
	tell thisDoc
		set contents of (every text frame whose label is "testTextFrame") to "Test"
		save
		close
	end tell
	set user interaction level of script preferences to interact with all
end tell


As you can see, your addition of ‘set thisDoc…’ made the difference. Thanks very much.