Site logo

Examples of achieving the same task using different scripting languages

We can use three scripting languages to achieve the same task:

The Scripting DOM is identical for all three languages so we can achieve the same task using any of them. For example, say, we want to make a very simple script for the batch processor which adds a page at the end of each document.

Here’s how to do this in JavaScript:

main();

function main() {
	var doc = app.activeDocument;
	var page = doc.pages.add();
}

Visual Basic Script

Set theApp = CreateObject(“InDesign.Application”)
Set theDoc = theApp.ActiveDocument
Set thePage = theDoc.Pages.Add

AppleScript

tell application "Adobe InDesign 2020"
	set myDoc to active document
	tell myDoc
		set myPage to make page
	end tell
end tell

Click here to download the sample scripts.

Back to the main Batch processor page