Get file path

Hi, I use following code to open an image file, and I can get its base64 encoding.
const aFile = await fs.getFileForOpening();
const contents = await aFile.read({format: storage.formats.binary});
var photo_obj_base64 = await base64ArrayBuffer(contents);
Now, how can I get the path of the selected image? Thanks.

aFile.nativePath should get you what you need. Cf. https://adobexdplatform.com/plugin-docs/reference/uxp/module/storage.html#entrynativepath--string

Hope this helps :slightly_smiling_face:

3 Likes

OK, It gets what I want, thanks! :grinning:

1 Like

I want to make a new rectangle, I can fill it with Rect.fill = new Color("#D3D3D3");
but how can I set the border color? Thanks.

Rect.stroke = new Color('#D3D3D3'); should get you what you’re looking for. Cf. https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#graphicnodestroke--color

Possibly, if the stroke isn’t enabled at this point, you might have to enable it by using Rect.strokeEnabled = true;

(Careful–two typos there that might mislead the unwary.)

1 Like