Suppose I have a file structure on a CD/DVD like this:
[VIDEO FOLDER 1]
---[VFolder1]
---VideoFile1.avi
---VideoFile1.srt
---VideoFile1-ENG.srt
[VIDEO FOLDER 2]
---[VFolder2]
---VideoFile2.avi
---VideoFile2.srt
---VideoFile2-ENG.srt
[VIDEO FOLDER 3]
---[VFolder3]
---VideoFile3.avi
---VideoFile3.srt
---VideoFile3-ENG.srt
So when I open my CD/DVD I see this
[VIDEO FOLDER 1]
[VIDEO FOLDER 2]
[VIDEO FOLDER 3]
I'd like to write such a script that does the followings:
1. Open [VIDEO FOLDER 1]
2. Select all the files and folders inside it.
3. Copy the names of them with the file sizes in KB (bytes) into a .txt file.
That is I'd like to get a video.txt file with the following contents:
[VIDEO FOLDER 1]
---[VFolder1]
---VideoFile1.avi --> Size: 338 854 KB (346 986 494 bytes)
---VideoFile1.srt --> Size: 1 KB (347 bytes)
---VideoFile1-ENG.srt --> Size: 1 KB (347 bytes)
Then
4. Go to the next folder [VIDEO FOLDER 2]
Get the same information like at [VIDEO FOLDER 1]
5. Append this new text information to the file video.txt
6. Do the same with [VIDEO FOLDER 3]
At the end I'd like to get a video.txt file with the following contents:
[VIDEO FOLDER 1]
---[VFolder1]
---VideoFile1.avi
---VideoFile1.srt
---VideoFile1-ENG.srt
[VIDEO FOLDER 2]
---[VFolder2]
---VideoFile2.avi
---VideoFile2.srt
---VideoFile2-ENG.srt
[VIDEO FOLDER 3]
---[VFolder3]
---VideoFile3.avi
---VideoFile3.srt
---VideoFile3-ENG.srt
And when this is done, eject the CD/DVD.
Question:
In first round I try something like that:
sel a; #1048; wait 500; #102; writefile("test_A.txt", "<clipboard>");
I get something like that in txt file:
---[VFolder1]
---VideoFile1.avi
---VideoFile1.srt
---VideoFile1-ENG.srt
BUT how can I append the next text to this txt file
when I open the the [VIDEO FOLDER 2]?
My txt file should look like this:
---[VFolder1]
---VideoFile1.avi
---VideoFile1.srt
---VideoFile1-ENG.srt
---[VFolder2]
---VideoFile2.avi
---VideoFile2.srt
---VideoFile2-ENG.srt
How to append text copied to clipboard to a file.txt
-
xyscripter
- Posts: 7
- Joined: 08 Jan 2013 20:02
-
highend
- Posts: 14956
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: How to append text copied to clipboard to a file.txt
Code: Select all
$drive = "C:\";
$folders = folderreport("dirsrel", "r", $drive, , , "|");
$list = "";
foreach($folder, $folders, "|") {
$list = $list . $folder . "<crlf>" . folderreport("files:{name} {size kb}", "r", "$drive$folder", , , "<crlf>") . "<crlf 2>";
}
writefile("test_A.txt", $list);You'd just have to edit the drive letter for your dvd drive...
One of my scripts helped you out? Please donate via Paypal
-
xyscripter
- Posts: 7
- Joined: 08 Jan 2013 20:02
Re: How to append text copied to clipboard to a file.txt
Thank you very much. It is perfect.
-
xyscripter
- Posts: 7
- Joined: 08 Jan 2013 20:02
Re: How to append text copied to clipboard to a file.txt
I re-thought what I would like, and wrote the script too.
I share my script here if anyone intresed in it:
My file structure on my dvd:
[01 VIDEO FOLDER 1-3] - (2009) - INFO
...[info1]
...[info2]
...[info3]
...info_text.txt
[VIDEO FOLDER 1]
...[VFolder1]
...[1]
...VideoFile1.avi
...VideoFile1.srt
...VideoFile1-ENG.srt
[VIDEO FOLDER 2]
...[VFolder2]
...[1]
...VideoFile2.avi
...VideoFile2.srt
...VideoFile2-ENG.srt
[VIDEO FOLDER 3]
...[VFolder3]
...[1]
...VideoFile3.avi
...VideoFile3.srt
...VideoFile3-ENG.srt
I see this when I open my dvd:
[01 VIDEO FOLDER 1-3] - (2009) - INFO
[VIDEO FOLDER 1]
[VIDEO FOLDER 2]
[VIDEO FOLDER 3]
This is my script:
After I run my script, I will get txt files:
[01 VIDEO FOLDER 1-3] - (2009) - INFO.txt
[VIDEO FOLDER 1].txt
[VIDEO FOLDER 2].txt
[VIDEO FOLDER 3].txt
In every txt file there will be that content I can see when I click on the folder
(with the file sizes in MB, KB and bytes).
[01 VIDEO FOLDER 1-3] - (2009) - INFO.txt
CONTAINS:
[01 VIDEO FOLDER 1-3] - (2009) - INFO
[info1]
[info2]
[info3]
info_text.txt --- [0,00 MB] - [4,79 KB] - [4 903 bytes].
[VIDEO FOLDER 1].txt
CONTAINS:
[VIDEO FOLDER 1]
[VFolder1]
[1]
VideoFile1.avi --- [350,24 MB] - [358 640,74 KB] - [367 248 116 bytes].
VideoFile1.srt --- [0,05 MB] - [52,67 KB] - [53 939 bytes].
VideoFile1-ENG.srt --- [0,06 MB] - [59,27 KB] - [60 692 bytes].
[VIDEO FOLDER 2].txt
CONTAINS:
[VIDEO FOLDER 2]
[VFolder2]
[1]
VideoFile2.avi --- [350,05 MB] - [358 450,92 KB] - [367 053 744 bytes].
VideoFile2.srt --- [0,06 MB] - [61,22 KB] - [62 689 bytes].
VideoFile2-ENG.srt --- [0,06 MB] - [64,49 KB] - [66 033 bytes].
[VIDEO FOLDER 3].txt
CONTAINS:
[VIDEO FOLDER 3]
[VFolder3]
[1]
VideoFile3.avi --- [350,06 MB] - [358 464,40 KB] - [367 067 542 bytes].
VideoFile3.srt --- [0,05 MB] - [54,43 KB] - [55 734 bytes].
VideoFile3-ENG.srt --- [0,06 MB] - [58,76 KB] - [60 173 bytes].
I share my script here if anyone intresed in it:
My file structure on my dvd:
[01 VIDEO FOLDER 1-3] - (2009) - INFO
...[info1]
...[info2]
...[info3]
...info_text.txt
[VIDEO FOLDER 1]
...[VFolder1]
...[1]
...VideoFile1.avi
...VideoFile1.srt
...VideoFile1-ENG.srt
[VIDEO FOLDER 2]
...[VFolder2]
...[1]
...VideoFile2.avi
...VideoFile2.srt
...VideoFile2-ENG.srt
[VIDEO FOLDER 3]
...[VFolder3]
...[1]
...VideoFile3.avi
...VideoFile3.srt
...VideoFile3-ENG.srt
I see this when I open my dvd:
[01 VIDEO FOLDER 1-3] - (2009) - INFO
[VIDEO FOLDER 1]
[VIDEO FOLDER 2]
[VIDEO FOLDER 3]
This is my script:
Code: Select all
VideoInfosFromDVD.xys
//1.) First Pane - DVD with video folders.
//2.) Second Pane - create a folder where you want report to from the first Pane.
//3.) Start script.
End Confirm("Copy video infos from DVD?", "#") == 0, "Stopped -> !! DO IT MANUALLY !!";
Sel;
Sel f; Sel i; //SELECT FOLDERS
$NOF_folders = 0; //NOF: number of
$NOF_folders = Get("CountSelected"); //COUNT FOLDERS
Sel; Sel 1;
$i = 1;
while ($i <= $NOF_folders) {
#1048; //FOCUS
#162; //OPEN folder
$a = Report('{name} --- [{Size MB}] - [{Size KB}] - [{size B} bytes].' . "<crlf>");
$a = Replace("$a", " --- [] - [] - [ bytes].", ""); //remove folder sizes
$a = "<curfolder>" . "<crlf>" . "$a"; //add the current foldername to the string
CopyText "$a"; //copy string to the clipboard
//Msg "<clipboard>";
$b = Get("path", 2); //get the path of second pane
WriteFile("$b\<curfolder>.txt", "<clipboard>", "r"); Wait 500; //put the report to a txt file on other pane
Button "up";
sel "+1"; //next folder
//End Confirm("Repeat ##on next folder?", "#") == 0, "Stopped -> !! DO IT MANUALLY !!";
$i++;
}
After I run my script, I will get txt files:
[01 VIDEO FOLDER 1-3] - (2009) - INFO.txt
[VIDEO FOLDER 1].txt
[VIDEO FOLDER 2].txt
[VIDEO FOLDER 3].txt
In every txt file there will be that content I can see when I click on the folder
(with the file sizes in MB, KB and bytes).
[01 VIDEO FOLDER 1-3] - (2009) - INFO.txt
CONTAINS:
[01 VIDEO FOLDER 1-3] - (2009) - INFO
[info1]
[info2]
[info3]
info_text.txt --- [0,00 MB] - [4,79 KB] - [4 903 bytes].
[VIDEO FOLDER 1].txt
CONTAINS:
[VIDEO FOLDER 1]
[VFolder1]
[1]
VideoFile1.avi --- [350,24 MB] - [358 640,74 KB] - [367 248 116 bytes].
VideoFile1.srt --- [0,05 MB] - [52,67 KB] - [53 939 bytes].
VideoFile1-ENG.srt --- [0,06 MB] - [59,27 KB] - [60 692 bytes].
[VIDEO FOLDER 2].txt
CONTAINS:
[VIDEO FOLDER 2]
[VFolder2]
[1]
VideoFile2.avi --- [350,05 MB] - [358 450,92 KB] - [367 053 744 bytes].
VideoFile2.srt --- [0,06 MB] - [61,22 KB] - [62 689 bytes].
VideoFile2-ENG.srt --- [0,06 MB] - [64,49 KB] - [66 033 bytes].
[VIDEO FOLDER 3].txt
CONTAINS:
[VIDEO FOLDER 3]
[VFolder3]
[1]
VideoFile3.avi --- [350,06 MB] - [358 464,40 KB] - [367 067 542 bytes].
VideoFile3.srt --- [0,05 MB] - [54,43 KB] - [55 734 bytes].
VideoFile3-ENG.srt --- [0,06 MB] - [58,76 KB] - [60 173 bytes].
XYplorer Beta Club