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

Script from ScripListener does not do anything (Eclise or Brackets) - Where am I wrong ?

New Here ,
Nov 04, 2017 Nov 04, 2017

Hi,

I've just started a mini project and would like to reuse activity code from the ScriptListener.8li.

My Brackets project works fine, button and function in the .jsx...

But when I insert the full text from ScriptListener_JS.log

it doesn't react at all.

No error. Just like there was no code.

NB : standard JS scrip like app.document work fine.

NB : Eclipse project has the same behavior.

Is there anything to do to "activate" or reuse this ScriptListener code ?

Thanks for help

TOPICS
Actions and scripting
2.9K
Translate
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 , Nov 05, 2017 Nov 05, 2017

Hi,

testing in ESTK, I have got an error right after OK2. Since the "invokeCommand" thing is useless, and what you're actually interested is what comes after OK3, just get rid of everything else and keep only:

var idMrgV = charIDToTypeID( "MrgV" );

    var desc21 = new ActionDescriptor();

    var idDplc = charIDToTypeID( "Dplc" );

    desc21.putBoolean( idDplc, true );

executeAction( idMrgV, desc21, DialogModes.NO );

Those "invokeCommand" etc. are relics of the now apparently dead Design Space (was it

...
Translate
Adobe
Community Expert ,
Nov 04, 2017 Nov 04, 2017

Hi,

I assume you're referencing JSX in the context of HTML Panels (since you mention Eclipse), am I correct?

ScriptListener code should work straight away, can you post a sample? You should make sure the button (or whatever triggers the extendscript code) is actually linked to the function call, e.g. if you put an alert there, does it pop up?

Davide

Davide Barranca - PS developer and author
www.ps-scripting.com
Translate
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
New Here ,
Nov 05, 2017 Nov 05, 2017

Hi Davide, I'm honored to have an answer from you...(I've crossed your name many times ! ;-D)

Interface is, yes, HTML / jquery / JSX based.

And actually  the sample/simple code is (for a "merge all layers" result)

function testMe(){

    alert('Ok1');

var idinvokeCommand = stringIDToTypeID( "invokeCommand" );

    var desc20 = new ActionDescriptor();

    var idcommandID = stringIDToTypeID( "commandID" );

    desc20.putInteger( idcommandID, 1139 );

    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );

    desc20.putBoolean( idkcanDispatchWhileModal, true );

    alert('Ok2');

executeAction( idinvokeCommand, desc20, DialogModes.NO );

    alert('Ok3');

   

var idMrgV = charIDToTypeID( "MrgV" );

    var desc21 = new ActionDescriptor();

    var idDplc = charIDToTypeID( "Dplc" );

    desc21.putBoolean( idDplc, true );

executeAction( idMrgV, desc21, DialogModes.NO );

}

Got the Ok1, The OK2 but not the OK3.

The executeAction doesn't seems to work or exists (?).

Is there a specific extra library to includes or declare for this specific function ?

Or does it have to be in a specific folder ?...

Well, I have no clue for this (i'm sure so simple) issue.

Thanks a lot for the time you took already for me.

Have a nice day.

Translate
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
People's Champ ,
Nov 05, 2017 Nov 05, 2017

Try using this construction

try { executeAction( idinvokeCommand, desc20, DialogModes.NO ); } catch (e) { alert(e) }

Translate
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
New Here ,
Nov 05, 2017 Nov 05, 2017

Thanks a lot.

This gives (translated) "General error, This function may not be available"...

Translate
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
People's Champ ,
Nov 05, 2017 Nov 05, 2017

What version of Photoshop and what version of ScriptingListener?
I do not know what the "invokeCommand" command does, and what are these codes.
But it seems they do not work at least in CC2018.

Do not use the code from ScriptingListener, which starts with
var idinvokeCommand = stringIDToTypeID ("invokeCommand");
and is completed
executeAction (idinvokeCommand, any_desc, DialogModes.NO);

Translate
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
New Here ,
Nov 05, 2017 Nov 05, 2017

It is Photoshop CC 2017 and the ScriptListener is the 64bits very standard from

‎March 15th, ‎2012...from Adobe Photoshop Scripting

Translate
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 ,
Nov 05, 2017 Nov 05, 2017

Hi,

testing in ESTK, I have got an error right after OK2. Since the "invokeCommand" thing is useless, and what you're actually interested is what comes after OK3, just get rid of everything else and keep only:

var idMrgV = charIDToTypeID( "MrgV" );

    var desc21 = new ActionDescriptor();

    var idDplc = charIDToTypeID( "Dplc" );

    desc21.putBoolean( idDplc, true );

executeAction( idMrgV, desc21, DialogModes.NO );

Those "invokeCommand" etc. are relics of the now apparently dead Design Space (was it called design? Anyway, that alternative UI that Photoshop had as a technology preview for some versions, then disappeared). We've asked to remove them, they're still there...

Davide

Davide Barranca - PS developer and author
www.ps-scripting.com
Translate
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
Enthusiast ,
Nov 05, 2017 Nov 05, 2017

Davide: I think new learn panel still use it. And it also uses Spaces Adapter. (GitHub - adobe-photoshop/spaces-adapter: Adobe Photoshop Spaces Plugin Adapter  ) So they can run actions before action intended by user is performed. E.g. if you want quit Photoshop, you can play your custom task before Photoshop quit happens.

Translate
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 ,
Nov 05, 2017 Nov 05, 2017

Never heard about Spaces Adapter! Have you been able to use bits of it in the context of Panels?

Davide Barranca - PS developer and author
www.ps-scripting.com
Translate
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
Enthusiast ,
Nov 05, 2017 Nov 05, 2017

Not yet. I already only read code. Maybe later I will try to do custom extension with this technology. If you look into Search tool, Learn panel, New new document dialog ect. you can find minified spaces adapter here.

Translate
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 ,
Nov 05, 2017 Nov 05, 2017

I'm the same opinion like Davide_Barranca

The TO only needs the part for merging (in the long form or) in the short form

(desc1 = new ActionDescriptor()).putBoolean(charIDToTypeID( "Dplc" ), true);

executeAction(charIDToTypeID( "MrgV" ), desc1, DialogModes.NO);

And the other lines of code are "useless code". Some scripters gave these lines the name: Junkcode.

Translate
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
New Here ,
Nov 06, 2017 Nov 06, 2017
LATEST

Junkcode is effectively the issue !

It works now fine ! Graat !

Thanks a lot for your help and the time you took to set me on the right path !

Have a nice and sunny day !

Translate
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
Enthusiast ,
Nov 05, 2017 Nov 05, 2017

Invoke command does nothing. It's usefull for read-only. You can watch events inside Photoshop.

Translate
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