Copy link to clipboard
Copied
Still on the topic dropdown list.
Kukurykus or r-bin how do I save all the list items in a.txt file so that each item is on different lines without the comma.
The best I could do was save just one line. Thanks again.
var dlg = new Window("dialog");
var conteudo = ["Item 1","Item 2","Item 3","Item 4","Item 5"];
var list = dlg.add("dropdownlist", undefined, undefined, {name: "list", items: conteudo});
list.selection= 0;
savelistatxt()
function savelistatxt(){
var selectedFolder = conteudo;
if(selectedFolder == null) return;
var fileList= list.items;
if(fileList.length>0){
var out = new File(Folder.desktop + "/ListIcons.txt");
out.open("w");
out.encoding="UTF8";
for(var a in fileList){out.writeln(fileList);}
out.close();
}
};
dlg.show();
with(File('~/desktop/lst.txt')) open('w'), write([1, 2, 3].join('\n')), close()
Copy link to clipboard
Copied
with(File('~/desktop/lst.txt')) open('w'), write([1, 2, 3].join('\n')), close()
Copy link to clipboard
Copied
var dlg = new Window("dialog");
var conteudo = ["Item 1","Item 2","Item 3","Item 4","Item 5"];
var list = dlg.add("dropdownlist", undefined, undefined, {name: "list", items: conteudo});
list.selection= 0;
savelistatxt()
function savelistatxt(){
var selectedFolder = conteudo;
if(selectedFolder == null) return;
var fileList= list.items;
if(fileList.length>0){
var out = new File(Folder.desktop + "/ListIcons.txt");
out.open("w");
out.encoding="UTF8";
for(var a = 0; a < fileList.length; a++){
out.writeln(fileList[a]);
}
out.close();
}
};
dlg.show();
Copy link to clipboard
Copied
Perfect! Both scripts worked very well! Thanks to the two friends for sharing their knowledge.