Highlighted

Development Environments for InDesign VBScripts

Community Beginner ,
Jun 20, 2020

Copy link to clipboard

Copied

Does anyone have any recommndations for suitable development environments for Adobe InDesign VBScripts?

 

Has anyone tried developing them in Visual Studio, for instance?

TOPICS
Scripting

Views

183

Likes

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

Development Environments for InDesign VBScripts

Community Beginner ,
Jun 20, 2020

Copy link to clipboard

Copied

Does anyone have any recommndations for suitable development environments for Adobe InDesign VBScripts?

 

Has anyone tried developing them in Visual Studio, for instance?

TOPICS
Scripting

Views

184

Likes

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
Jun 20, 2020 0
Explorer ,
Jun 20, 2020

Copy link to clipboard

Copied

I've been writing a lot of InDesign scripts in Visual Studio over the years. You get all the benefits of the "Visual Studio" environment (Intellisense, object browsing, to name a few), which is nice, but there are also shortcomings. For example, I still haven't figured out how to implement event handlers.

Likes

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
Reply
Loading...
Jun 20, 2020 0
Community Beginner ,
Jun 22, 2020

Copy link to clipboard

Copied

Many tbanks for your posting.

 

Which version(s) of Visual Studio are you using?

 

Do you use one of the predefined project templates when starting a project?

 

I think the Visual Studio development emvironment is pretty good and would like to be able to use it for InDesign scripts - it would certainly be a big improvement over Notepad!

Likes

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
Reply
Loading...
Jun 22, 2020 0
Explorer ,
Jun 22, 2020

Copy link to clipboard

Copied

Hi.

 

I've used Visual Studio 2012, 2013, 2017, and 2019. All of them work fine.

 

I've been writing scripts for years, so I usually use something I used in the past as a template.

 

As you already know, the best thing about Visual Basic on Visual Studio is the availability of the rich UI controls. Dropping files onto UI controls, Treeview, combo boxes, richtext text boxes, and so on.

The other thing I like about it is the independent window (nonmodal dialog box). Being able to show progress (status) in a separate window while the script is running is convenient.

 

On another note, I've started to use javascript on Visual Studio Code (with ExtendScript Debugger) recently. The reason is the extremely efficient javascript code you can write with the "Everyitem" function.

Likes

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
Reply
Loading...
Jun 22, 2020 0
Community Beginner ,
Jun 25, 2020

Copy link to clipboard

Copied

Many thanks for your posting.

I am trying it with Visual Studio 2019.

Did you manage to load the Adobe InDesign Object Model into Visual Studio?

Likes

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
Reply
Loading...
Jun 25, 2020 0
Explorer ,
Jun 25, 2020

Copy link to clipboard

Copied

Yes. If you need help with the setup, check out the following URL.

 

https://stackoverflow.com/questions/43325744/indesign-automated-tests

 

This is an example for C++, but most of the information regarding the setup applies to Visual Basic.

 

Hope this helps.

Likes

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
Reply
Loading...
Jun 25, 2020 0
Adobe Community Professional ,
Jun 22, 2020

Copy link to clipboard

Copied

Hi Chris,

why not developing with ExtendScript ? Then you could use the ExtendScript Toolkit application.

Is there something with InDesign VBScript that cannot be done with ExtendScript?

 

Thanks,
Uwe Laubender

( ACP )

Likes

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
Reply
Loading...
Jun 22, 2020 0
Community Beginner ,
Jun 22, 2020

Copy link to clipboard

Copied

Many thanks for your posting.

 

The fact is, it's so long since I did any InDesign scripting that I'd forgotten about ExtendScript Toolkit!

 

Someone else mentioned it and I've been investigating.

 

I'm having a problem getting the InDesign script running in ESTK at the moment though All of the Debug menu options, including Run, appear disabled.and I haven't quite figured out how to fix it.

 

 

Likes

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
Reply
Loading...
Jun 22, 2020 0
Adobe Community Professional ,
Jun 22, 2020

Copy link to clipboard

Copied

Hi Chris,

did you start up InDesign before you tried to running the code?

Next step will be to connect the ESTK to InDesign:

 

From this, where the ESTK targets itself:

ESTK-ConnectedWithItself.PNG

 

To that ( InDesign is already running) :

ESTK-GreenChain-InDesign-2020.PNG

 

Allow the ESTK a few seconds to a minute to read in all the scripting DOM before you procede.

The ESTK will do that only the first time when connected to an application.

 

Regards,
Uwe Laubender

( ACP )

 

 

Likes

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
Reply
Loading...
Jun 22, 2020 0
Community Beginner ,
Jun 23, 2020

Copy link to clipboard

Copied

Many thanks for your posting.

 

I started InDesign.

 

Then I started ESTK.

 

The VBScript loaded ok and everything seemed to be in place - but the script wouldn't run.

 

All of the relevant Debug menu options are disabled.

 

I've tested this on Windows 7 Pro 64 bit andWindows 10 Pro 64 with the same result.

 

At the moment, I'm baffled.

 

Also, if I try the Edit Script option from the Scripts window in InDesign all it does is to invoke Windows Notepad as the editor.

Likes

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
Reply
Loading...
Jun 23, 2020 0
Adobe Community Professional ,
Jun 23, 2020

Copy link to clipboard

Copied

Hi Chris,

the ESTK is a development environment for ExtendScript, not VBScript.

However, you could run VBScript code with the doScript() method.

Found this sample by Kasyan Servetsky on the forum:

 

Execute a VBScript inside a JavaScript
Correct answer by Kasyan_Servetsky, Oct 25, 2017

https://community.adobe.com/t5/indesign/execute-a-vbscript-inside-a-javascript/m-p/9406191?page=1

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Reply
Loading...
Jun 23, 2020 0
Community Beginner ,
Jun 23, 2020

Copy link to clipboard

Copied

Many thanks for your posting - I appreciate the trouble you are going to.

 

But, so far, I haven't been able to get anything at all to run from ESTK.

 

To check it out, I tried a script from the Scripting Tutorial manual, whuch ran ok when called from within InDesign but wouldn't run at all, with all Debug options disabled, in ESTK.

 

This is the script:

//DoScriptParameters.jsx
//An InDesign CS5 JavaScript
//
//Shows how to send parameters to a script called using
//the doScript method.
main();
function main(){
	var myParameters = ["Hello from DoScript", "Your message here."];
	mySetup();
	mySnippet(myParameters);
	myTeardown();
}
function mySetup(){
}
function mySnippet(myParameters){
	//For JavaScript, the parameters passed to do script must
	//be the same as the parameters passed to the function
	//containing the doScript call.
	//<fragment>
	var myJavaScript = "alert(\"First argument: \" + arguments[0] + \"\\rSecond argument: \" + arguments[1]);";
	app.doScript(myJavaScript, ScriptLanguage.javascript, myParameters);
	if(File.fs == "Windows"){
		var myVBScript = "msgbox arguments(1), vbOKOnly, \"First argument: \" & arguments(0)";
		app.doScript(myVBScript, ScriptLanguage.visualBasic, myParameters);
	}
	else{
		var myAppleScript = "tell application \"Adobe InCopy CS3\\rdisplay dialog(\"First argument\" & item 1 of arguments & return & \"Second argument: \" & item 2 of arguments & return & end tell";
		app.doScript(myAppleScript, ScriptLanguage.applescriptLanguage, myParameters);
	}
	//</fragment>
}
function myTeardown(){
}

 

Likes

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
Reply
Loading...
Jun 23, 2020 0