Skip to main content
Inspiring
April 29, 2018
Question

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

  • April 29, 2018
  • 2 replies
  • 2664 views

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 ?

This topic has been closed for replies.

2 replies

Inspiring
April 30, 2018

Try this:

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

pixxxelschubser
Community Expert
Community Expert
April 29, 2018

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.

Inspiring
April 29, 2018

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

pixxxelschubser
Community Expert
Community Expert
April 29, 2018

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"); };