Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

get path of script you're running

Explorer ,
Dec 23, 2009 Dec 23, 2009

I know you can get path of the documet you're working on activeDocument.path, but can you get the path of the script you're running as well?

TOPICS
Actions and scripting
4.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Explorer ,
Dec 23, 2009 Dec 23, 2009

I might not even need to now that I think of it, I'm just trying to target and copy item from photoshop and paste it over in illustrator, here is how I am doing it:


     illustrator.executeScript(illustrator.jsx);

     photoshop.executeScript (photoshop.jsx);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 23, 2009 Dec 23, 2009

You have to be carefull how you use path and name in a script as they are read only properties of app.

var p = activeDocument.fullName;
alert(p);// alerts full path to doc
var path = activeDocument.fullName;
alert(path);// alerts full path to Photoshop

alert($.fileName)// full path to script

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 23, 2009 Dec 23, 2009

If you want the path of a running script you could use..

function WhoAmI() {
var where;
try {var F = FO;
  }catch( err ) {where = File(err.fileName);}
return where;
}

As for using:-  photoshop.executeScript (photoshop.jsx);

This is supposed to do an eval, so it's not executing "photoshop.jsx" it is trying to evaluate it into a command.

I have never seen a working example of executeScript and have never managed to get it to work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 23, 2009 Dec 23, 2009

Paul,

Is there a reason not to use $.fileName?

And I think that the BridgeTalk wrapper for executeScript in both the illustrator.jsx and photoshop.jsx startup scripts in broken. For example it you run this in ESKT with Photoshop as the target you will get an alert.

photoshop.executeScript ("alert('Hello World');");

But run it again after switching the target to Bridge or Illustrator and you will not get the alert.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 23, 2009 Dec 23, 2009

Your right Mike, I keep thinking of compatibility with CS2 as $.fileName is CS3 or better.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 25, 2010 Jun 25, 2010

$.fileName and err.fileName both return the path to Photoshop directory, instead of script path - when running from CS Extension panel. Is there a way to get the real path to the script?

Thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 25, 2010 Jun 25, 2010

I thought that panels could only be run if they are installed and they are only installed in one place.

new Folder(app.path + '/Plug-Ins/Panels/yourPanelName.jsx');
// or if you has AEM install into a folder
new Folder(app.path + '/Plug-Ins/Panels/yourInstallFolder/yourPanelName.jsx');

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 25, 2010 Jun 25, 2010

Thanx, but it doesn't work - in CS5 panels are being installed in a different place. Actually several different places.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 25, 2010 Jun 25, 2010
LATEST

Are you talking about the new CSIDE panels? What does Folder.startup return for you?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines