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

How to track the name of the active document in the PS panel (main.js file)

Participant ,
Apr 28, 2018 Apr 28, 2018

Copy link to clipboard

Copied

Hello everybody

I have in my instrument the concepts of "active project". I want to make sure that if the document is not opened from the active project, then the "save" button on the panel was unaffordable.

What event in main.js do I need to track when changing active documents ?

TOPICS
Actions and scripting

Views

2.2K

Translate

Translate

Report

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
Community Expert ,
Apr 29, 2018 Apr 29, 2018

Copy link to clipboard

Copied

If I understand you right - check, if the name and the path to the file are the correct ones.

alert(activeDocument.fullName);

could be helpful for you in this case.

Votes

Translate

Translate

Report

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
Participant ,
Apr 29, 2018 Apr 29, 2018

Copy link to clipboard

Copied

I understand that you need to compare FullName, but the meaning of the question is different:

* Open 2 documents - 1 from drive C, the other - from drive D

* If I selected a document from the C drive in Photoshop, the button on my html-panel should be locked, if I then select the document from the D drive, then the button should be unlocked.

The question is - what event in the application should I keep track of on main.js file

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 29, 2018 Apr 29, 2018

Copy link to clipboard

Copied

to little informations, sorry

Provided your project file has the

name: Projectfile1.psd

and is in

folder: D:\Mainproject

if (activeDocument.fullName == "/d/Mainproject/Projectfile1.psd") { alert ("Active document is from project folder"); };

Votes

Translate

Translate

Report

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
Participant ,
Apr 29, 2018 Apr 29, 2018

Copy link to clipboard

Copied

thanks for the line of the script, I know it. I asked what event (onLoad, onClick) and what Jquery element it is possible to put this line?

main.js file:

  1. $( ????).???? (function{
  2. if (activeDocument.fullName == "/d/Mainproject/Projectfile1.psd") {
  3. alert ("Active document is from project folder");
  4. }; 
  5. })

Votes

Translate

Translate

Report

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
Explorer ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

LATEST

Try this:

app.notifiers.add('slct', File("/c/script.jsx"), 'Dcmn')

Votes

Translate

Translate

Report

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