Copy link to clipboard
Copied
Is there an easy way to save the screenshot and do the process whose link I wrote? When I want to do it as an action, it does not save the operations selected from the menu, such as "Delete All Artboards", to the action. Are there any friends who can write the flow I shared in the video as a script? Thank you in advance and waiting for your answers.
Kindly regards.
Copy link to clipboard
Copied
is anyone help me please?
Copy link to clipboard
Copied
instead of a video, could you write down the steps you want the script to take, as well as any decisions the script may need to make for certain steps if necessary?
Copy link to clipboard
Copied
Of course.
open file manual with double click
Menu > Object > Unlock All because sometimes i forgot unlock some objects
Menu > Select > Deselect
Menu > Select > All on Active Artboard
Menu > Object > Lock
Menu > Select > All
Menu > Edit > Clear
Menu > Object > Unlock All
Artboards > Delete Empty Artboard
File > Export > Export for Screens...
"choose format" PDF
Export Artboard
I am doing same routine for too many times per day. So I need a jsx file. I can't do it with action because I can't assign the "delete empty artboards" command to action. Thank you very much if you can help.
Copy link to clipboard
Copied
This is untested but should do the trick. And it needs some love in terms of pdf export options. unfortunately im not aware of any access to the "export for screens" dialog or functionality. But the same functionality should be doable with pdf save options. But im not sure what options you need for your use case.
function doDailyTask()
{
var doc = app.activeDocument;
app.executeMenuCommand("unlockAll");
app.executeMenuCommand("deselectall");
app.executeMenuCommand("selectallinartboard");
app.executeMenuCommand("lock");
app.executeMenuCommand("selectall");
app.executeMenuCommand("clear");
app.executeMenuCommand("unlockAll");
app.executeMenuCommand("deselectall");
deleteEmptyArtboards();
exportPDF();
function deleteEmptyArtboards()
{
var artboards = doc.artboards;
for (var i = artboards.length - 1; i >= 0; i--)
{
doc.artboards.setActiveArtboardIndex(i);
app.executeMenuCommand("selectallinartboard");
if (doc.selection.length == 0)
{
doc.artboards.remove(i);
}
app.executeMenuCommand("deselectall");
}
}
function exportPDF()
{
var exportOptions = new PDFSaveOptions();
exportOptions.artboardRange = doc.artboards.getActiveArtboardIndex() + 1;
//unfortunately, i dont believe we have script access to the export for screens dialog
//so you will have to set the pdf options manually right here
//heres the available options: https://ai-scripting.docsforadobe.dev/jsobjref/PDFSaveOptions.html
//export the active artboard
var outFileName = doc.path + "/" + doc.name.replace(".ai", ".pdf");
var outFile = new File(outFileName);
doc.saveAs(outFile, exportOptions);
}
}
doDailyTask();
Find more inspiration, events, and resources on the new Adobe Community
Explore Now