Yesterday I made the mip plugin open a file with insert embedded in photoshop, but I noticed a problem and I don’t know how to solve it
in the file I have to insert the path of the file which is this
_path: await tokenify(“/Users/username/Desktop/Leo.jpg”),
this is fine for my pc
but if I use it on another PC I have to change the username and this is a limit for me
I used this in the past to work around the problem
~/Desktop/Leo.jpg
but I saw that it doesn’t work
Where am I dazzling?
const {executeAsModal} = require("photoshop").core;
const {batchPlay} = require("photoshop").action;
const {localFileSystem: fs} = require("uxp").storage;
const app = require('photoshop').app;
async function tokenify(url){
return fs.createSessionToken(await fs.getEntryWithUrl("file:" + url));
}
async function importLayer() {
const result = await batchPlay(
[
{
_obj: "placeEvent",
null: {
_path: await tokenify("/Users/nameuser/Desktop/Leo.jpg"),
_kind: "local"
},
freeTransformCenterState: {
_enum: "quadCenterState",
_value: "QCSAverage"
},
offset: {
_obj: "offset",
horizontal: {
_unit: "pixelsUnit",
_value: 0
},
vertical: {
_unit: "pixelsUnit",
_value: 0
}
},
_options: {
dialogOptions: "dontDisplay"
}
}
],
{}
);
}
await executeAsModal(importLayer, {commandName: "importLayer"});