Copy link to clipboard
Copied
Observe the following lines of code:
#target Photoshop
var joy = app.activeDocument.path;
alert(joy);
Test this when you have some file open in Photoshop. For example, it outputs something that looks like this:
/d/5)%20Projects/My%20Projects
but I need it to look like this:
D:\5) Projects\My Project
Now, let me make this clear; I need it in EXACTLY the format that I showed immediately above. I'm working on a Windows machine, and I need to return this filepath in the Windows format for my HTML panel so that the user has easy access to it. I need it to be just a standard string that includes the spaces and doesn't add in those extra percent signs and twenties. Unfortunately, I have no idea how to do this.
So the real question here is; how can I obtain the active document's file path in the typical Windows format?
Current string of what ?! Decoding changes object, that path of active document becomes a string. You say you want to change object into string before you decode it? It gives you the same result. I completetly don't understand it Perhaps you want to check is activeDocument an active one from all others they can be opened, or maybe your document is not saved yet so there's no any location bound to? Ah I'm sorry I just read a title of your post again, so:
activeDocument.path.fsName
Copy link to clipboard
Copied
decodeURI(activeDocument.path)
Copy link to clipboard
Copied
This almost works, and I think it would, except I'm not sure that the app.activeDocument.path is an actual string. So when I try it, it just completely fails. So I think that I need to figure out how to convert app.activeDocument.path into a string first, but I haven't been able to find a way to do this.
Copy link to clipboard
Copied
Current string of what ?! Decoding changes object, that path of active document becomes a string. You say you want to change object into string before you decode it? It gives you the same result. I completetly don't understand it Perhaps you want to check is activeDocument an active one from all others they can be opened, or maybe your document is not saved yet so there's no any location bound to? Ah I'm sorry I just read a title of your post again, so:
activeDocument.path.fsName
Copy link to clipboard
Copied
Yes, that was it, thank you so much. Works perfectly. No matter how hard I searched, I couldn't figure out what member function / variable was responsible for returning the correct file path. Thanks!
Copy link to clipboard
Copied
Searching is well is an art with pratice you can find what you need. Often you find too many tings you do not want. Search engines vary.
Copy link to clipboard
Copied
What is the c++ equivalent of app.activeDocument.path