Copy link to clipboard
Copied
Hi,
is there any way to stop the Generator "Image Assets".
To activate i use
var desc1 = new ActionDescriptor();
desc1.putString(app.stringIDToTypeID("javaScriptName"), "Bild-Assets");
executeAction(app.stringIDToTypeID('AdobeScriptAutomation Scripts'), desc1, DialogModes.NO);
Try universal localized code. I have it working in the russian version ).
var d = new ActionDescriptor();
d.putString( charIDToTypeID( "jsNm" ), localize("$$$/JavaScripts/Generator/ImageAssets/Menu") );
d.putString( charIDToTypeID( "jsMs" ), "undefined" );
executeAction( stringIDToTypeID( "AdobeScriptAutomation Scripts" ), d, DialogModes.NO );
You can also take the code from the one that is executed in the Scripts / generate.jsx file. It seems to work as it should.
...start_assets()
function start_assets
Copy link to clipboard
Copied
Never used this thing. If I correctly understood what you meant, then in the CC2018 you can turn off for the active document in this way (verified):
try {
var r = new ActionReference();
r.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "generatorSettings" ) );
r.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var d = executeActionGet(r);
var generatorSettings = d.getObjectValue(stringIDToTypeID("generatorSettings"));
var generator_45_assets = generatorSettings.getObjectValue(stringIDToTypeID("generator_45_assets"));
var json = generator_45_assets.getString(stringIDToTypeID("json"));
generator_45_assets.putString(stringIDToTypeID("json"), "{\"enabled\":false}");
generatorSettings.putObject(stringIDToTypeID("generator_45_assets"), stringIDToTypeID("generator_45_assets"), generator_45_assets);
var d = new ActionDescriptor();
d.putReference( charIDToTypeID( "null" ), r );
d.putObject( charIDToTypeID( "T " ), charIDToTypeID( "null" ), generatorSettings );
executeAction( charIDToTypeID( "setd" ), d, DialogModes.NO );
}
catch(e) { alert(e); }
Copy link to clipboard
Copied
My goal is to activate and deactivate the generator (Image Assets) from my html panel
File > Generate > Image Assets
The code from the scriptlistener looks like this:
var desc1 = new ActionDescriptor();
desc1.putString(app.stringIDToTypeID("javaScriptName"), "Bild-Assets");
executeAction(app.stringIDToTypeID('AdobeScriptAutomation Scripts'), desc1, DialogModes.NO);
But with that I can only activate the generator (Image Assets)
Thank you very much
Copy link to clipboard
Copied
Thank you! I have another question, though.
Is it possiblt to start the generator the same way?
With my code, it only works in the german Photoshop version.
Setting the value for generatorSettigns "{\"enabled\":false}" to true only works, once the generator is started.
generator_45_assets.putString(stringIDToTypeID("json"), "{\"enabled\":true}");
Copy link to clipboard
Copied
Try universal localized code. I have it working in the russian version ).
var d = new ActionDescriptor();
d.putString( charIDToTypeID( "jsNm" ), localize("$$$/JavaScripts/Generator/ImageAssets/Menu") );
d.putString( charIDToTypeID( "jsMs" ), "undefined" );
executeAction( stringIDToTypeID( "AdobeScriptAutomation Scripts" ), d, DialogModes.NO );
You can also take the code from the one that is executed in the Scripts / generate.jsx file. It seems to work as it should.
start_assets()
function start_assets()
{
var pluginName = "generator-assets-dummy-menu";
try {
var generatorDesc = new ActionDescriptor();
generatorDesc.putString (app.stringIDToTypeID ("name"), pluginName);
var returnDesc = executeAction( app.stringIDToTypeID ("generateAssets"), generatorDesc, DialogModes.NO );
}
catch( e ) { alert(); }
}
Copy link to clipboard
Copied
Thanks a lot!
Copy link to clipboard
Copied
r-bin,
I have tried your code but it does not stop Generator "Image Assets" for me (As I believe was Joachim_Hiller's question.) It will only start asset generation. I am not a pro on Action Manager so I might be missing something basic.
I've tried this exact code in a JS and, as I mentioned, it will TURN ON asset generation but not off...
start_assets()
function start_assets()
{
var pluginName = "generator-assets-dummy-menu";
try {
var generatorDesc = new ActionDescriptor();
generatorDesc.putString (app.stringIDToTypeID ("name"), pluginName);
var returnDesc = executeAction( app.stringIDToTypeID ("generateAssets"), generatorDesc, DialogModes.NO );
}
catch( e ) { alert(); }
};
Many thanks,
Copy link to clipboard
Copied
Start means start? 😛 For stop look few posts higher.
Copy link to clipboard
Copied
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("pluginPicker"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
d1.putBoolean(stringIDToTypeID("generatorEnabled"), false);
d1.putBoolean(stringIDToTypeID("generatorDisabled"), true);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("pluginPicker"), d1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
Copy link to clipboard
Copied
r-bin,
(I obviously copied and pasted the wrong code in my post... Had intended to past the stop code).
Yeah, it appears it something broke it in the 2019 release. It still works on 2018.
Turning off the generator completely will get me through for now.
Thanks!