Copy link to clipboard
Copied
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
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
...Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Try using this construction
try { executeAction( idinvokeCommand, desc20, DialogModes.NO ); } catch (e) { alert(e) }
Copy link to clipboard
Copied
Thanks a lot.
This gives (translated) "General error, This function may not be available"...
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
It is Photoshop CC 2017 and the ScriptListener is the 64bits very standard from
March 15th, 2012...from Adobe Photoshop Scripting
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Never heard about Spaces Adapter! Have you been able to use bits of it in the context of Panels?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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 !
Copy link to clipboard
Copied
Invoke command does nothing. It's usefull for read-only. You can watch events inside Photoshop.