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

listbox containg open files in javascript

Community Expert ,
Aug 29, 2008 Aug 29, 2008

Copy link to clipboard

Copied

Can anybody point me to a sample-script that shows how to create a listbox of the open documents?
Im looking for something similar to how the Script »Load Files into Stack« (which is installed with Photoshop I think) does it, but without the need for the Folder-selection-option.
I tried looking up that Scripts structure, but I dont get it ... because it utilizes libraries and stuff thats way out of my understanding of JavaScript I guess.

I know its the lazy thing to do, asking You. But that stuff really proves difficult to me ...
TOPICS
Actions and scripting

Views

1.4K

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
Valorous Hero ,
Aug 29, 2008 Aug 29, 2008

Copy link to clipboard

Copied

This will create a listbox with the opened docs names.



var dlg =

"dialog{text:'Script Interface',bounds:[100,100,350,350],"+

"panel0:Panel{bounds:[10,10,240,240] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+

"docs:ListBox{bounds:[10,40,220,190] , properties:{multiselect:false}},"+

"statictext0:StaticText{bounds:[50,10,160,27] , text:'Opened Documents' ,properties:{scrolling:undefined,multiline:undefined}},"+

"button0:Button{bounds:[40,200,200,220] , text:'Cancel' }}}";



var win = new Window(dlg,"Open Docs");

win.center();

for(var a = 0;a<documents.length;a++){

win.panel0.docs.add("item",documents.name);

}



win.show();

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 ,
Aug 29, 2008 Aug 29, 2008

Copy link to clipboard

Copied

Thanks!
Now if I may get a bit immodest: How could one set up a button to remove names from the list?

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
Valorous Hero ,
Aug 29, 2008 Aug 29, 2008

Copy link to clipboard

Copied

Here you go..



var dlg =

"dialog{text:'Script Interface',bounds:[100,100,350,350],"+

"panel0:Panel{bounds:[10,10,240,240] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+

"docs:ListBox{bounds:[10,40,220,190] , properties:{multiselect:false}},"+

"statictext0:StaticText{bounds:[50,10,160,27] , text:'Opened Documents' ,properties:{scrolling:undefined,multiline:undefined}},"+

"clear:Button{bounds:[10,200,100,220] , text:'Clear' }"+

"button0:Button{bounds:[130,200,220,220] , text:'Cancel' }}}";



var win = new Window(dlg,"Open Docs");



win.center();

for(var a = 0;a<documents.length;a++){

win.panel0.docs.add("item",documents.name);

}

win.panel0.clear.onClick = function() {

win.panel0.docs.removeAll();

}



win.show(...

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 ,
Aug 29, 2008 Aug 29, 2008

Copy link to clipboard

Copied

Thanks again and sorry, I didnt make myself clear: I meant for the removal of individual names, not all of them.

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
Valorous Hero ,
Aug 29, 2008 Aug 29, 2008

Copy link to clipboard

Copied

Sorry about that, this might be closer.
Select the name and press clear.



var dlg =

"dialog{text:'Script Interface',bounds:[100,100,350,350],"+

"panel0:Panel{bounds:[10,10,240,240] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+

"docs:ListBox{bounds:[10,40,220,190] , properties:{multiselect:false}},"+

"statictext0:StaticText{bounds:[50,10,160,27] , text:'Opened Documents' ,properties:{scrolling:undefined,multiline:undefined}},"+

"clear:Button{bounds:[10,200,100,220] , text:'Clear' }"+

"close:Button{bounds:[130,200,220,220] , text:'Close' }}}";



var win = new Window(dlg,"Open Docs");

selection=0;

win.center();

for(var a = 0;a<documents.length;a++){

win.panel0.docs.add("item",documents.name);

}

win.panel0.docs.selection=0;

win.panel0.docs.onChange = function() {

selection = parse...















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 ,
Aug 30, 2008 Aug 30, 2008

Copy link to clipboard

Copied

LATEST
Once more thanks, great help.

Have a nice weekend!

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