Highlighted

RH2019 New - Scripting feature

Adobe Community Professional ,
Oct 29, 2019

Copy link to clipboard

Copied

Has anyone had a play with the scripting for RH2019 New? I'm just having a look with the idea of upgrading a bunch of ExtendScript scripts I wrote, but I'm somewhat lost.

 

The scripting guide says:

"Debugging Scripts
You can open the debug window by pressing 'Ctrl+Alt+D' to debug your scripts "

And it does open a debug window, but it seems to be debugging the RH application, rather than the script I want to debug? I tried the VariableConverter.js as a test.

 

Any tips for transitioning from ExtendScript to Javascript?

 

How does the Post Generation Script stuff work? The scripting guide all deals with RH interface stuff as far as I can tell, and I'm only familiar with javascript ephemerally modifying online html pages. Can it be run locally to make permanent file changes? Is there are good resource somewhere? Am I misreading the scripting guide?

Topics

New UI, Scripting

Views

1.1K

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

RH2019 New - Scripting feature

Adobe Community Professional ,
Oct 29, 2019

Copy link to clipboard

Copied

Has anyone had a play with the scripting for RH2019 New? I'm just having a look with the idea of upgrading a bunch of ExtendScript scripts I wrote, but I'm somewhat lost.

 

The scripting guide says:

"Debugging Scripts
You can open the debug window by pressing 'Ctrl+Alt+D' to debug your scripts "

And it does open a debug window, but it seems to be debugging the RH application, rather than the script I want to debug? I tried the VariableConverter.js as a test.

 

Any tips for transitioning from ExtendScript to Javascript?

 

How does the Post Generation Script stuff work? The scripting guide all deals with RH interface stuff as far as I can tell, and I'm only familiar with javascript ephemerally modifying online html pages. Can it be run locally to make permanent file changes? Is there are good resource somewhere? Am I misreading the scripting guide?

Topics

New UI, Scripting

Views

1.1K

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
Oct 29, 2019 1
Adobe Employee ,
Oct 30, 2019

Copy link to clipboard

Copied

Hello Amebr

 

The shortcut 'Ctrl+Alt+D' opens the debugger for the scriptiing window. To debug your script

1. Open the file 'scripting.js' in the Sources tab

2. Search for the function 'static execute(e)' in this file and put a breakpoint here

3. Now execute your script in RH2019 via the Scripts panel or the File menu. This breakpoint will be hit and the source for the script being executed will be received as an argument to this function. You can step into your source code from here after it is converted into a function.

 

There is no automatic conversion of Classic Extendscript syntax to the RH 2019 Javascript syntax but the data model of the application is similar and should be simple to write the same functionality in RH2019 Javascript.

 

Your script here works as Node.js script which has full access to the underlying operating system and can read/ write files similar to any native application. You can find a tutorial to the Node.js filesystem module 'fs' at https://www.w3schools.com/nodejs/nodejs_filesystem.asp. You can refer to the use of this 'fs' module in the sample scripts to access/ modify the project files in the sample scripts like VariableConverter.js.

 

Please feel free to inquire about any other information

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...
Oct 30, 2019 0
Adobe Community Professional ,
Apr 07, 2020

Copy link to clipboard

Copied

Long time, no follow up. I'm now giving this a go.

 

I tried putting a breakpoint on 'static execute(e)' but nothing happened, so I moved it down to 'return new Promise'. But now I'm just debugging the scripting.js and path.js and...?

 

If you can provide keystrok by keystroke details that would be great as I'm not a developer.

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...
Apr 07, 2020 0
Adobe Employee ,
Apr 08, 2020

Copy link to clipboard

Copied

Hello

Please see the following screenshots for putting a breakpoint in your script.

1. Please put a breakpoint at this line in the execute() function

        a = new Function(n.code)

Breakpoint in executeBreakpoint in execute

2. Step into the function (the default shortcut is F11 or third button in the debug toolbar on the top right)

3. Your code should open up as a new tab. Put breakpoint at any desired location and use the debug toolbar to control execution.

Breakpoint in your codeBreakpoint in your code

 

This debugger is the standard Chrome DevTools window. 

Basics of starting out with debugging, stepping through the code etc. can be referred to from here https://developers.google.com/web/tools/chrome-devtools/javascript

 

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...
Apr 08, 2020 0
Adobe Community Professional ,
Apr 08, 2020

Copy link to clipboard

Copied

I'm reading through the tutorial you linked, but it's not really helping much. How do I open a File Open dialog box so I can select multiple files? Thanks.

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...
Apr 08, 2020 0
Adobe Employee ,
Apr 08, 2020

Copy link to clipboard

Copied

Hello

Please use this snippet to launch the native Open File dialog to select files. This snippet uses the 'electron' module which is present available in the scripting context.

 

// Js snippet to launch Open File Dialog
const {dialog} = require('electron').remote;
dialog.showOpenDialog({
  properties: ['openFile', 'multiSelections']
  }, function (files) {
  if (files !== undefined) {
    console.log(files)
  }
});

 

Reference for this api

https://www.electronjs.org/docs/api/dialog

 

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...
Apr 08, 2020 0
Adobe Community Professional ,
Apr 08, 2020

Copy link to clipboard

Copied

Thanks I'll give those a go.

 

I have a suggestions. It would be useful if the scripting guide listed all the javascript libraries included. A link to the documentation for each would also be a helpful reference. 🙂

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...
Apr 08, 2020 0
Adobe Community Professional ,
Apr 08, 2020

Copy link to clipboard

Copied

Okay I can get to my script a bit easier now.

 

Next question. How to I cancel a script when I discover something has gone wrong or get into what I think is an infinite loop? (It happens a lot because I don't know programming and certainly not this all new programming.)

 

I searched online and found there is a Stop button in DevTools, but when I press it, if I try to run the script from RH again, it says "Last execution has not finished" (or similar words).

 

At the moment I have to completely close Robohelp and start again, which is not very convenient.

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...
Apr 08, 2020 0