Skip to main content
Known Participant
October 22, 2019
Question

Script for selecting layers / files from the drop-down menu.

  • October 22, 2019
  • 5 replies
  • 6177 views

Good afternoon, tell me please.
How can I make a script so that it is possible to select layers of the current document in the drop-down menu? And also how can I select files from a folder in this way?

    This topic has been closed for replies.

    5 replies

    Known Participant
    October 23, 2019
    Stephen Marsh
    Community Expert
    Community Expert
    October 23, 2019

    I may be wrong, I'm only a beginner... My understanding is that scripts "run" until they have completed running, they will retain focus and not "float" and will not allow the user to do other tasks like a normal Photoshop panel would do.

     

    An extension/CEP/HTML panel can float and allow other areas of the GUI to obtain focus and be used while the panel is visible in the GUI.

     

    If my understanding is correct, then the issue is about the floating (modal?) nature of scriptUI windows taking focus while running and once exited they no longer appear/float like a standard panel, they are a window/dialog object not a panel.

    Known Participant
    October 23, 2019

    The pallet makes it possible to use the program further.

    In extreme cases, you can and window.

    Stephen Marsh
    Community Expert
    Community Expert
    October 22, 2019
    Known Participant
    October 22, 2019

    Thanks, but I thought it could be created inside the script ui.

    By analogy there is a script to search and run actions.

    Stephen Marsh
    Community Expert
    Community Expert
    October 22, 2019

     

    var layerName = prompt('Enter a Layer Name to Select', '');
    app.activeDocument.activeLayer = app.activeDocument.layers.getByName(layerName);

     

     

    The code above is what you would like to have in a graphical "pick list" format? So, a window or floating panel that has a drop-down menu with a list of layer names (instead of entering them into a prompt), one then selects the layer name from the list and presses OK and then the layer is selected in the layers panel?

    Known Participant
    October 22, 2019

     Floating panel that has a drop-down menu with a list of layer names (instead of entering them into a prompt), one then selects the layer name from the list and presses OK and then the layer is selected in the layers panel.

    Legend
    October 22, 2019

    What do you mean by a drop-down menu? You can use the Layers panel to select layers. As for selecting files from a folder, File->Open command is the most direct.

    Known Participant
    October 22, 2019

    It's about a script. So that being on any layer I could call up a list of layers and clicking on it I went to the desired layer. Without using the tab layers. Like for example, right-clicking on a document they are displayed, but not all.

    Ideally, I would like to get more and the ability to search for layers by name.