Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Copy files from folder to folder content file txt

Explorer ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

// ========
var Thehouse = new Window("dialog");
    Thehouse.text = "The House Copy File";
    Thehouse.orientation = "column";
    Thehouse.alignChildren = ["center","top"];
    Thehouse.spacing = 10;
    Thehouse.margins = 16;

// PANEL1
// ======
var panel1 = Thehouse.add("panel", undefined, undefined, {name: "panel1"});
    panel1.orientation = "column";
    panel1.alignChildren = ["left","top"];
    panel1.spacing = 10;
    panel1.margins = 10;

// GROUP1
// ======
var group1 = panel1.add("group", undefined, {name: "group1"});
    group1.orientation = "row";
    group1.alignChildren = ["left","center"];
    group1.spacing = 10;
    group1.margins = 0;

var statictext1 = group1.add("statictext", undefined, undefined,"Select File txt");
    statictext1.text = "TXT Text File";
    statictext1.preferredSize.width = 100;

var edittext1 = group1.add('edittext {properties: {name: "edittext1"}}');
    edittext1.preferredSize.width = 250;

var button1 = group1.add("button", undefined, undefined, {name: "button1"});
    button1.text = "Select file TXT";
    button1.preferredSize.width = 110;
    button1.helpTip = "Select folder source";
    button1.onClick = function () {
   //Select txt file file
    }

// PANEL2
// ======
var panel2 = Thehouse.add("panel", undefined, undefined, {name: "panel2"});
    panel2.orientation = "column";
    panel2.alignChildren = ["left","top"];
    panel2.spacing = 10;
    panel2.margins = 10;

// GROUP2
// ======
var group2 = panel2.add("group", undefined, {name: "group2"});
    group2.orientation = "row";
    group2.alignChildren = ["left","center"];
    group2.spacing = 10;
    group2.margins = 0;

var statictext2 = group2.add("statictext", undefined, undefined, {name: "statictext2"});
    statictext2.text = "Souce Folder";
    statictext2.preferredSize.width = 100;

var edittext2 = group2.add('edittext {properties: {name: "edittext2"}}');
    edittext2.preferredSize.width = 250;

var button2 = group2.add("button", undefined, "Select folder");
    button2.text = "Select folder";
    button2.preferredSize.width = 110;
    button2.helpTip = "Select folder source";
    button2.onClick = function () {
        try {
            if (Prefs.folder2 != undefined) {
                var Folder2 = Folder(Prefs.folder2);
                topLevelFolder = Folder(Prefs.folder2);
            } else {
                var Folder2 = "";
            }
        } catch (e) {

        }
        topLevelFolder = Folder.selectDialog("Please select the folder containing the library", Folder2);
        if (topLevelFolder != null) {
            edittext2.text = decodeURI(topLevelFolder.fsName);
            Prefs.folder2 = decodeURI(topLevelFolder.fsName);
        }
    };

    if (Prefs.folder2 != undefined) {
        edittext2.text = Prefs.folder2;
        topLevelFolder = Folder(Prefs.folder2);
    }

// GROUP3
// ======
var group3 = panel2.add("group", undefined, {name: "group3"});
    group3.orientation = "row";
    group3.alignChildren = ["left","center"];
    group3.spacing = 10;
    group3.margins = 0;

var statictext3 = group3.add("statictext", undefined, undefined, {name: "statictext3"});
    statictext3.text = "New Folder";
    statictext3.preferredSize.width = 100;

var edittext3 = group3.add('edittext {properties: {name: "edittext3"}}');
    edittext3.preferredSize.width = 250;

var button3 = group3.add("button", undefined, undefined, {name: "button3"});
    button3.text = "Select folder";
    button3.preferredSize.width = 110;
    button3.helpTip = "Select folder source";
    button3.onClick = function () {
        try {
            if (Prefs.folder2 != undefined) {
                var Folder2 = Folder(Prefs.folder2);
                topLevelFolder = Folder(Prefs.folder2);
            } else {
                var Folder2 = "";
            }
        } catch (e) {

        }
        topLevelFolder = Folder.selectDialog("Please select the folder containing the library", Folder2);
        if (topLevelFolder != null) {
            edittext3.text = decodeURI(topLevelFolder.fsName);
            Prefs.folder2 = decodeURI(topLevelFolder.fsName);
        }
    };

    if (Prefs.folder2 != undefined) {
        edittext3.text = Prefs.folder2;
        topLevelFolder = Folder(Prefs.folder2);
    }

// GROUP4
// ======
var group4 = Thehouse.add("group", undefined, {name: "group4"});
    group4.orientation = "row";
    group4.alignChildren = ["left","center"];
    group4.spacing = 10;
    group4.margins = 0;

var button4 = group4.add("button", undefined, undefined, {name: "button4"});
    button4.text = "Apply";
    button4.onClick = function(){

    }

var button5 = group4.add("button", undefined, undefined, {name: "button5"});
    button5.text = "Cannel";
    button5.onClick = function(){
    Thehouse.close();
  };
Thehouse.show();

i have txt file content

thehouse1.jpg, thehouse2.jpg,thehouse3.jpg,.....,thehousename.jpg

I did a script that reads the txt content, then selects the folders "Source Folder" and "New Folder" 

Then it will copy all files named in txt file from "Source Folder" to "New Folder"

Anyone help me with the code, thank you and receive my gratitude

 

TOPICS
Actions and scripting

Views

43

Likes

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 Professional ,
Jul 10, 2021 Jul 10, 2021

Copy link to clipboard

Copied

LATEST

Prefs is undefined

Likes

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