Highlighted

Run these scripts silently

Explorer ,
Apr 12, 2020

Copy link to clipboard

Copied

I use a script for Illustrator and Photoshop that does what I want. One thing I would like to avoid is the focusing of the app when it executes. It would be optimum if the programs (Illustrator and Photoshop) could stay hidden. To be clear the programs are open, however, I do not want them to take focus when the script runs. The way it works now they do. They jump to the forefront of what I am doing. Is there any way to do this? Thanks

Illustrator script:

var dest = new File("C:/PSUtil/new1.jpg");
function exportFileToJPEG (dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsJPEG();
var type = ExportType.JPEG;
var fileSpec = new File(dest);
exportOptions.antiAliasing = false;
exportOptions.qualitySetting = 70;
exportOptions.artBoardClipping = true;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}
exportFileToJPEG (dest);

Photoshop script:

var saveFile = File("C:/PSUtil/new2.png");
sfwPNG24(saveFile);
function sfwPNG24(saveFile){
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG;
pngOpts.PNG8 = true;
pngOpts.transparency = true;
pngOpts.interlaced = false;
pngOpts.quality = 100;
activeDocument.exportDocument(saveFile,ExportType.SAVEFORWEB,pngOpts);
}

 

Topics

Feature request, How to, Scripting

Views

361

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

Run these scripts silently

Explorer ,
Apr 12, 2020

Copy link to clipboard

Copied

I use a script for Illustrator and Photoshop that does what I want. One thing I would like to avoid is the focusing of the app when it executes. It would be optimum if the programs (Illustrator and Photoshop) could stay hidden. To be clear the programs are open, however, I do not want them to take focus when the script runs. The way it works now they do. They jump to the forefront of what I am doing. Is there any way to do this? Thanks

Illustrator script:

var dest = new File("C:/PSUtil/new1.jpg");
function exportFileToJPEG (dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsJPEG();
var type = ExportType.JPEG;
var fileSpec = new File(dest);
exportOptions.antiAliasing = false;
exportOptions.qualitySetting = 70;
exportOptions.artBoardClipping = true;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}
exportFileToJPEG (dest);

Photoshop script:

var saveFile = File("C:/PSUtil/new2.png");
sfwPNG24(saveFile);
function sfwPNG24(saveFile){
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG;
pngOpts.PNG8 = true;
pngOpts.transparency = true;
pngOpts.interlaced = false;
pngOpts.quality = 100;
activeDocument.exportDocument(saveFile,ExportType.SAVEFORWEB,pngOpts);
}

 

Topics

Feature request, How to, Scripting

Views

362

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
Adobe Community Professional ,
Apr 12, 2020

Copy link to clipboard

Copied

to my knowledge this is not possible. You can set the app.userInteractionLevel variable to prevent some dialogs from popping up, but I've never seen a way to run a script completely in the background without requiring active focus (at least on the application.. you can do work on a file that is open, but not currently active).

 

Hopefully someone else has an answer though, because at work I have a script that takes up quite a bit of time because it exports dozens or potentially hundreds of PDFs, and we have to sit and wait while the script executes.. the script even stops if you change focus to another app and it waits until illustrator has focus again. 

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...
Explorer ,
Apr 12, 2020

Copy link to clipboard

Copied

Thank you so much for the reply. Knowing this helps a great deal. I am happy to have that as an answer to begin my workarounds. I mainly don't want focus to shift from the application I am using the Illustrator and Photoshop images with. However, it is not a big deal. I just felt it could be optimum. I did not want to automate the application switching back into focus if  I did not have to. Now I will just make my application switch back into focus. Thanks again 🙂

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

Copy link to clipboard

Copied

For Illustrator, you can set interaction level. So, before starting the script you can set inetraction level as below

 

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

 

and when your script finished you can again set back to 

 

app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;

 

For photoshop, I have never tried myself, there must be something equivalent like this. If I find something for photoshop I will update here.

 

I hope this helps you.

Best regards

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...