I’ve been reading the threads here, and I’m starting to think the following is not possible, but I’ll ask.
I have the user select a folder:
var sourceFolder = await require("uxp").storage.localFileSystem.getFolder();
and I store that folder’s path in a variable called folderPath:
var folderPath = sourceFolder.name;
Now I want to use that folderPath variable in batchPlay to save the current open document as a .tif file:
await require('photoshop').action.batchPlay([ {"_obj": "save","as": {"_obj": "TIFF","byteOrder": {"_enum": "platform","_value": "IBMPC"},"layerCompression": {"_enum": "encoding","_value": "RLE"}},"in": {"_path": folderPath + "\\" + documentTitle + ".tif"}}, ], {"synchronousExecution": false, "modalBehavior": "wait"})
I know that in UXP, the path in,
"_path": folderPath + "\\" + documentTitle + ".tif"
needs to be replaced by a token.
But it doesn’t look like there is any way to generate a token using just that “folderPath” variable. It seems like I’d have to at least force the user to selected the folder to save in again, which sort of defeats the purpose, as this is intended to auto-save the user’s document once they create it.