So I'd like to save as a .psb to a specific folder on the desktop with NO save dialog. This is what I have so far. It isn't working though. I can see in the designated folder it starts to write a psd (not psb) but then it disappears from the folder and nothing else happens.
function dM(v) {
displayDialogs = eval('DialogModes.' + (v ? 'ALL' : 'NO'))
}
for(aD = activeDocument, i = 0; i < 2; i++) {
dM(i); if (i) File(aD.fullName).remove()
pth = '~/desktop/DO_NOT_TOUCH_FOR_SCRIPTING/ALL_VERSIONS'
aD.saveAs(File(pth)); if (i) dM(!i)
}
I understand that 'DO_NOT_TOUCH_FOR_SCRIPTING' folder on desktop is already created? If so, and you want to save a file without dialog popping up, then use following code:
displayDialogs = DialogModes.NO, sTT = stringIDToTypeID
dsc1 = new ActionDescriptor(), dsc2 = new ActionDescriptor()
fle = File('~/desktop/DO_NOT_TOUCH_FOR_SCRIPTING/ALL_VERSIONS.psb')
dsc2.putBoolean(sTT('maximizeCompatibility'), true)
dsc1.putObject(sTT('as'), sTT('largeDocumentFormat'), dsc2)
dsc1.putPath(sTT('in'), fle), executeAction(sTT('save'), dsc1)