Special file paths

Flex, Flash & CS SDK Script and Code Snippets

Moderators: Tom, Kukurykus

goro

Special file paths

Post by goro »

Hello,
I use the following script to get the path to the active file in photoshop:

function getDocumentFullName(){
var f = app.activeDocument.fullName;
return "<string>"+f+"</string>";
}

In flex I am using that path to upload the file to a server. Problem is, that when the file is on the desktop the script is returning something like ~/Desktop/file.psd. How can I get the real path to the file in such a case? Is there some kind of list of the paths, that Photoshop is recognising in a special manner? What is the difference in Mac?
I am working with Win XP 64B, Photoshop CS4, Flash builder 4, Flex SDK 3.5.
Thanx!

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Special file paths

Post by Mike Hale »

This will get you the full os path to the desktop
Code: Select allFolder.desktop.fsName;
goro

Special file paths

Post by goro »

So the trick was that I must add .fsName.toString(), to get the absolute file system path of the document. Thanx!

Code: Select allfunction getDocumentFullName(){
   return "<string>"+app.activeDocument.fullName.fsName.toString()+"</string>";
}