I need script that mass renames SRTs using AVI file basename
-
xyka
- Posts: 22
- Joined: 21 Oct 2010 22:17
I need script that mass renames SRTs using AVI file basename
I have a directory D:\MY_VIDEOS
and I have a list of folders inside it:
STARGATE UNIVERSE - 2 x 05 - FQM
SUPERNATURAL - 6 x 05 - FQM
and so on
-----------------------------------------------------------------------------------------
Inside a folder looks like this:
In case of STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
In case of SUPERNATURAL - 6 x 05 - FQM
1
Supernatural - 06x05 - Live Free or Twihard.FQM.Eng.srt
Supernatural s06e05 (hdtv-fqm) magyar.rar
Supernatural s06e05 (hdtv-fqm, 720p-ctu) angol.rar
supernatural.s06e05.hdtv.xvid-fqm.avi
where 1 is also a folder,
and .zip or.rar files always have the same ending:
magyar.zip or angol.zip OR magyar.rar or angol.rar OR mixed
All my folders have this same look or pattern.
-----------------------------------------------------------------------------------------
What I would like to do automatically using XYplorer are the followings:
shortly:
MY FOLDER BEFORE THE SCRIPT:
In case of STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt <= 1. give it the basename of avi + .ENG2.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
2. unzip Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip <= 3. move this to folder 1
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt <= 4. move this to folder 1 if this exists
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt <= 5. give it the basename of avi + .ENG.srt
6. unzip Stargate Universe s02e05 (hdtv-fqm) magyar.zip <= 7. move this to folder 1
stargate universe s02e05 hdtv-fqm.srt <= 8. give it the basename of avi + .srt
MY FOLDER AFTER THE SCRIPT:
Let my folder STARGATE UNIVERSE - 2 x 05 - FQM look like this
1
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
9. REPEAT THESE STEPS all the folders inside my directory D:\MY_VIDEOS
10. DONE
-----------------------------------------------------------------------------------------
What I would like to do automatically using XYplorer are the followings:
detailed and algoritmically thinking
(1.) Go to D:\MY_VIDEOS directory
(2.) Open the first folder -> STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
(4.) Find the .avi file -> stargate.universe.s02e05.hdtv.xvid-fqm.avi
(5.) Copy its basename without the .avi -> stargate.universe.s02e05.hdtv.xvid-fqm
(6.) Find the .srt file -> Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
(6.1.) first copy&paste it to folder 1, just a backup, after that
(6.2.) give the basename of the .avi file and a .ENG2 tag to the .srt file -> stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
So, now my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(7.1) Extract/unzip/unrar using WinRAR Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
(7.2) and if it is done move Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip to the folder 1, just a backup.
(Sometimes there can be more than 1 or 2 .srt files inside the extracted .zip file.)
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(8.) Find the .srt files inside the folder
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
(9.1) If the ending of the .srt file is .ENG2.srt, then do nothing with it.
(9.2) If there is a 720p string in the name of the .srt file (not always exists this file), then move it to the folder 1, just a backup.
(9.3) Count how many .srt files left, if there is exactly 2,
then give the basename of the .avi file and a .ENG tag to the .srt file that has not been renamed yet -> stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
else if there are more .srt files left than 2, then create a folder 2 below folder 1 and copy all the .srt files inside it.
I will rename them manually.
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(10.1) Extract/unzip/unrar using WinRAR Stargate Universe s02e05 (hdtv-fqm) magyar.zip
(10.2) and if it is done move Stargate Universe s02e05 (hdtv-fqm) magyar.zip to the folder 1, just a backup.
(there is only one .srt file inside the .zip file)
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
stargate universe s02e05 hdtv-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
(11.) Find the .srt files inside the folder
If there is no .ENG tag in the name of the .srt file
then give the basename of the .avi file to the .srt file -> stargate.universe.s02e05.hdtv.xvid-fqm.srt
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(12.) Go to D:\MY_VIDEOS directory
(13.) Open the second folder -> SUPERNATURAL - 6 x 05 - FQM
and repeat the above steps to each folder which are inside the D:\MY_VIDEOS directory.
If these steps can be solved using XYplorer's scripts, that would be a great help for me.
thanks
---
and I have a list of folders inside it:
STARGATE UNIVERSE - 2 x 05 - FQM
SUPERNATURAL - 6 x 05 - FQM
and so on
-----------------------------------------------------------------------------------------
Inside a folder looks like this:
In case of STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
In case of SUPERNATURAL - 6 x 05 - FQM
1
Supernatural - 06x05 - Live Free or Twihard.FQM.Eng.srt
Supernatural s06e05 (hdtv-fqm) magyar.rar
Supernatural s06e05 (hdtv-fqm, 720p-ctu) angol.rar
supernatural.s06e05.hdtv.xvid-fqm.avi
where 1 is also a folder,
and .zip or.rar files always have the same ending:
magyar.zip or angol.zip OR magyar.rar or angol.rar OR mixed
All my folders have this same look or pattern.
-----------------------------------------------------------------------------------------
What I would like to do automatically using XYplorer are the followings:
shortly:
MY FOLDER BEFORE THE SCRIPT:
In case of STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt <= 1. give it the basename of avi + .ENG2.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
2. unzip Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip <= 3. move this to folder 1
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt <= 4. move this to folder 1 if this exists
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt <= 5. give it the basename of avi + .ENG.srt
6. unzip Stargate Universe s02e05 (hdtv-fqm) magyar.zip <= 7. move this to folder 1
stargate universe s02e05 hdtv-fqm.srt <= 8. give it the basename of avi + .srt
MY FOLDER AFTER THE SCRIPT:
Let my folder STARGATE UNIVERSE - 2 x 05 - FQM look like this
1
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
9. REPEAT THESE STEPS all the folders inside my directory D:\MY_VIDEOS
10. DONE
-----------------------------------------------------------------------------------------
What I would like to do automatically using XYplorer are the followings:
detailed and algoritmically thinking
(1.) Go to D:\MY_VIDEOS directory
(2.) Open the first folder -> STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
(4.) Find the .avi file -> stargate.universe.s02e05.hdtv.xvid-fqm.avi
(5.) Copy its basename without the .avi -> stargate.universe.s02e05.hdtv.xvid-fqm
(6.) Find the .srt file -> Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
(6.1.) first copy&paste it to folder 1, just a backup, after that
(6.2.) give the basename of the .avi file and a .ENG2 tag to the .srt file -> stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
So, now my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(7.1) Extract/unzip/unrar using WinRAR Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
(7.2) and if it is done move Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip to the folder 1, just a backup.
(Sometimes there can be more than 1 or 2 .srt files inside the extracted .zip file.)
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(8.) Find the .srt files inside the folder
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
(9.1) If the ending of the .srt file is .ENG2.srt, then do nothing with it.
(9.2) If there is a 720p string in the name of the .srt file (not always exists this file), then move it to the folder 1, just a backup.
(9.3) Count how many .srt files left, if there is exactly 2,
then give the basename of the .avi file and a .ENG tag to the .srt file that has not been renamed yet -> stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
else if there are more .srt files left than 2, then create a folder 2 below folder 1 and copy all the .srt files inside it.
I will rename them manually.
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(10.1) Extract/unzip/unrar using WinRAR Stargate Universe s02e05 (hdtv-fqm) magyar.zip
(10.2) and if it is done move Stargate Universe s02e05 (hdtv-fqm) magyar.zip to the folder 1, just a backup.
(there is only one .srt file inside the .zip file)
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
stargate universe s02e05 hdtv-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
(11.) Find the .srt files inside the folder
If there is no .ENG tag in the name of the .srt file
then give the basename of the .avi file to the .srt file -> stargate.universe.s02e05.hdtv.xvid-fqm.srt
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(12.) Go to D:\MY_VIDEOS directory
(13.) Open the second folder -> SUPERNATURAL - 6 x 05 - FQM
and repeat the above steps to each folder which are inside the D:\MY_VIDEOS directory.
If these steps can be solved using XYplorer's scripts, that would be a great help for me.
thanks
---
Last edited by xyka on 01 Nov 2010 12:11, edited 3 times in total.
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: I need script that mass renames SRTs using AVI file basename
First and foremost, may I ask how much of what you would like scripted you have attempted to do yourself?
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
xyka
- Posts: 22
- Joined: 21 Oct 2010 22:17
Re: I need script that mass renames SRTs using AVI file basename
zer0 wrote:First and foremost, may I ask how much of what you would like scripted you have attempted to do yourself?
I have no idea how to do that.
I'm totally beginner.
I don't know either if it is possible what I want to do using XYplorer.
How should I begin to learn this scripting thing?
Where can I find how to use the script commands?
Which does what? What parameters can I use?
Are there example scripts?
.
What I want above is very complex.
I couldn't do it within a week.
So if there are here more experienced script writers,
please give me a solution.
I only need this one script because
it is a repetitive task and very boring to rename files manually.
thanks for your help
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: I need script that mass renames SRTs using AVI file basename
Stay tuned, Xyka. Now and then one skilled scripter show up and solve our users' scripting problems. You already got one in another thread and sooner or later this other issue of yours may find an answer over here too.
Regarding references, here are some:
>Scripts Library;
>New User's Reference Guide (part 1 has some scripting references gathered up to v8.70);
>XYplorer interface > Help > Help on Scripting Commands, or in script language...:
Regarding references, here are some:
>Scripts Library;
>New User's Reference Guide (part 1 has some scripting references gathered up to v8.70);
>XYplorer interface > Help > Help on Scripting Commands, or in script language...:
Code: Select all
"Open the Help"
run "<xypath>\XYplorer.chm";
wait 1000;
SendKeys "{DOWN}";
SendKeys "{DOWN}";
SendKeys "{DOWN}";
SendKeys "{ENTER}";
SendKeys "{DOWN}";
SendKeys "{DOWN}";
SendKeys "{DOWN}";
SendKeys "{DOWN}";
SendKeys "{DOWN}";
SendKeys "{ENTER}";
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: I need script that mass renames SRTs using AVI file basename
An extra source of info: XYwiki, script-related content.
Use it wisely.
Use it wisely.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
-
xyka
- Posts: 22
- Joined: 21 Oct 2010 22:17
Re: I need script that mass renames SRTs using AVI file basename
SkyFrontier
thanks for your tips
I have tried some simple scripts found on XYplorer download site.
What I know that I need a lot of knowledge to solve my very complex problem.
As a beginner it is impossible for me to solve it right now.

thanks for your tips
I have tried some simple scripts found on XYplorer download site.
What I know that I need a lot of knowledge to solve my very complex problem.
As a beginner it is impossible for me to solve it right now.
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: I need script that mass renames SRTs using AVI file basename
You're trying to run before you can walk. A better approach would be to work through your algorithm incrementally and add lines to your script one by one. I will provide you with a few pointers later on, but you've got to get past the "blank sheet" stagexyka wrote:As a beginner it is impossible for me to solve it right now.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: I need script that mass renames SRTs using AVI file basename
OK, let's do things sequentially as per your algorithm. I'm going to include code on a per-step basis so you can see how each action is done.
4.
5.
6.
6.1
6.2
Tomorrow (Wednesday), I'll try to tackle steps 7 & 8, maybe even 9 if there's time. Feel free to experiment by yourself -- practice makes perfect! 
4.
Code: Select all
Selfilter "*.avi", f;Code: Select all
$avi_basename = <curbase>;Code: Select all
Selfilter "*.srt", f;Code: Select all
copyto ("1");Code: Select all
rename b, $a;
rename b, "*.ENG2";
Last edited by zer0 on 05 Nov 2010 22:14, edited 3 times in total.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: I need script that mass renames SRTs using AVI file basename
Class in session 
7.1 Substitute my path and switches to WinZip with appropriate data for your archiving software
7.2
9.2
9.3
Based on the above, do you feel confident to attempt steps 10 and 11? 
7.1 Substitute my path and switches to WinZip with appropriate data for your archiving software
Code: Select all
Selfilter "angol", f;
$curitem = "<curitem>";
run """C:\Program Files (x86)\WinRAR\WinRAR.exe"" e -- $curitem",,1;Code: Select all
Selfilter "angol", f;
moveto ("1");Code: Select all
Selfilter "720p", f;
$count = getinfo("CountSelected");
if $count == 1 {
moveto ("1");
}Code: Select all
Selfilter "*.srt", f;
$countLeft = getinfo("CountSelected");
if $countLeft == 2 {
Selfilter "com.srt", f;
rename b, $a;
rename b, "*.ENG";
}
elseif $countLeft > 2 {
new "2", dir;
Selfilter "*.srt", f;
moveto ("2");
}
Last edited by zer0 on 05 Nov 2010 22:15, edited 2 times in total.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: I need script that mass renames SRTs using AVI file basename
Final lesson...
10.1
10.2
11.
So, putting it all together, we get this...
As you are not that familiar with scripting, I suggest you use Step Mode. Other than that, this script should do what you want. You'll need to actually go into a folder with the AVI file, but then it's scripting magic time 
10.1
Code: Select all
Selfilter "magyar", f;
$curitem = "<curitem>";
run """C:\Program Files (x86)\WinRAR\WinRAR.exe"" e -- $curitem",,1;Code: Select all
Selfilter "magyar", f;
moveto ("1");Code: Select all
Selfilter "*.srt", f;
$filelist = getinfo('SelectedItemsPathNames', '|'). '|';
$p = strpos($filelist, '|');
while ($p >= 0)
{
$file = substr($filelist, 0, $p);
$name = regexreplace($file, "^.+\\(.+)$", "$1");
$filelist = substr($filelist, $p + 1);
$p = strpos($filelist, '|');
if (strpos($name, ".ENG") == -1)
{
rename b, $a,,$file;
}
}Code: Select all
Selfilter "*.avi", f;
$avi_basename = <curbase>;
Selfilter "*.srt", f;
copyto ("1");
rename b, $a;
rename b, "*.ENG2";
Selfilter "angol", f;
$curitem = "<curitem>";
run """C:\Program Files (x86)\WinRAR\WinRAR.exe"" e -- $curitem",,1;
Selfilter "angol", f;
moveto ("1");
Selfilter "720p", f;
$count = getinfo("CountSelected");
if $count == 1 {
moveto ("1");
}
Selfilter "*.srt", f;
$countLeft = getinfo("CountSelected");
if $countLeft == 2 {
Selfilter "com.srt", f;
rename b, $a;
rename b, "*.ENG";
}
elseif $countLeft > 2 {
new "2", dir;
Selfilter "*.srt", f;
moveto ("2");
}
Selfilter "magyar", f;
$curitem = "<curitem>";
run """C:\Program Files (x86)\WinRAR\WinRAR.exe"" e -- $curitem",,1;
Selfilter "magyar", f;
moveto ("1");
Selfilter "*.srt", f;
$filelist = getinfo('SelectedItemsPathNames', '|'). '|';
$p = strpos($filelist, '|');
while ($p >= 0) {
$file = substr($filelist, 0, $p);
$name = regexreplace($file, "^.+\\(.+)$", "$1");
$filelist = substr($filelist, $p + 1);
$p = strpos($filelist, '|');
if (strpos($name, ".ENG") == -1)
{
rename b, $a,,$file;
}
}
Last edited by zer0 on 05 Nov 2010 22:15, edited 2 times in total.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
xyka
- Posts: 22
- Joined: 21 Oct 2010 22:17
Re: I need script that mass renames SRTs using AVI file basename
the put-together script does not work at all
first look I've found some errors
$avi_basename = <curbase>;
maybe
$a
Does <curbase> command exist in XYplorer?
What kind of command can we use between '>' and '<'
is there a list anywhere?
copyto copies files to main D:\1\ directory and not to the folder 1 of the current directory
WinRAR not starting although I've changed the directory to where my WinRAR.exe is located
Question: what does the character '|' mean?
anyway, thanks for your tips
If I have more time, I'm going to learn this script thing.
first look I've found some errors
$avi_basename = <curbase>;
maybe
$a
Does <curbase> command exist in XYplorer?
What kind of command can we use between '>' and '<'
is there a list anywhere?
copyto copies files to main D:\1\ directory and not to the folder 1 of the current directory
WinRAR not starting although I've changed the directory to where my WinRAR.exe is located
Question: what does the character '|' mean?
anyway, thanks for your tips
If I have more time, I'm going to learn this script thing.
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: I need script that mass renames SRTs using AVI file basename
Ok, I didn't actually test the put-together script as I have that environment to work with, but let's address your issues...
Should be no problem here as having an underscore (or multiples thereof) is allowed.xyka wrote:$avi_basename = <curbase>;
maybe
$a
It's not a command, it's a native variable that represents a base-name of the current list item.xyka wrote:Does <curbase> command exist in XYplorer?
No kind of command and, thus, no list. Native variables are represented that way.xyka wrote:What kind of command can we use between '>' and '<'
is there a list anywhere?
Yep, my bad here. Just remove the slash and it will work. I'll edit the script extracts to reflect this.xyka wrote:copyto copies files to main D:\1\ directory and not to the folder 1 of the current directory
What's the error message when you try the script in step mode? If your path to the executable has no spaces then you don't need to use double quotes twice.xyka wrote:WinRAR not starting although I've changed the directory to where my WinRAR.exe is located
It's what commonly referred to as "pipe" and acts as a separator.xyka wrote:Question: what does the character '|' mean?
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
xyka
- Posts: 22
- Joined: 21 Oct 2010 22:17
Re: I need script that mass renames SRTs using AVI file basename
Is it possible to search only for a word or phrase on a page of XYplorer.chm?
(I mean, not to search inside the whole XYplorer.chm.)
For example:
after I click XYplorer.chm -> Advanced Topics -> User-Defined Commands
I would like to search for <curbase> only on page User-Defined Commands.
@Native Variables
XYplorer.chm -> Advanced Topics -> User-Defined Commands
Here I can find the list of XYplorer Native Variables
but not under XYplorer.chm -> Advanced Topics -> Scripting Commands
Now this is clear. Native Variables != commands.
My WinRAR's path:
C:\Program Files\WinRAR\WinRAR.exe
$avi_basename = <curbase>
needs to be replaced with
$a = <curbase>
I use "<curbase>" but <curbase> is good too.
START FOLDER:
1
Stargate Universe - 02x06 - Trial and Error.FQM.En.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi
SCRIPT:
Selfilter "*.avi", f;
$a = "<curbase>";
Selfilter "*.srt", f;
copyto ("1");
rename b, $a;
rename b, *.ENG2; <- ; was missing from your script
RESULTS:
1
stargate.universe.s02e06.hdtv.xvid-fqmENG2.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi
a dot is missing
stargate.universe.s02e06.hdtv.xvid-fqm.ENG2.srt
need to be solved!!!
it may be a regexp thing
-
(I mean, not to search inside the whole XYplorer.chm.)
For example:
after I click XYplorer.chm -> Advanced Topics -> User-Defined Commands
I would like to search for <curbase> only on page User-Defined Commands.
@Native Variables
XYplorer.chm -> Advanced Topics -> User-Defined Commands
Here I can find the list of XYplorer Native Variables
but not under XYplorer.chm -> Advanced Topics -> Scripting Commands
Now this is clear. Native Variables != commands.
My WinRAR's path:
C:\Program Files\WinRAR\WinRAR.exe
$avi_basename = <curbase>
needs to be replaced with
$a = <curbase>
I use "<curbase>" but <curbase> is good too.
START FOLDER:
1
Stargate Universe - 02x06 - Trial and Error.FQM.En.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi
SCRIPT:
Selfilter "*.avi", f;
$a = "<curbase>";
Selfilter "*.srt", f;
copyto ("1");
rename b, $a;
rename b, *.ENG2; <- ; was missing from your script
RESULTS:
1
stargate.universe.s02e06.hdtv.xvid-fqmENG2.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi
a dot is missing
stargate.universe.s02e06.hdtv.xvid-fqm.ENG2.srt
need to be solved!!!
it may be a regexp thing
-
-
zer0
- Posts: 2676
- Joined: 19 Jan 2009 20:11
Re: I need script that mass renames SRTs using AVI file basename
No, I don't think so.xyka wrote:Is it possible to search only for a word or phrase on a page of XYplorer.chm?
So it has a space, two lots of double quotes are correct then. What's the error message in step mode?xyka wrote:My WinRAR's path:
C:\Program Files\WinRAR\WinRAR.exe
If you wish. For the purposes of parsing the script, both are equally good.xyka wrote:$avi_basename = <curbase>
needs to be replaced with
$a = <curbase>
No, it's because I forgot to quote like this "*.ENG2". Encasing it with double quotes should get the job donexyka wrote:a dot is missing
Stargate.universe.s02e06.hdtv.xvid-fqm.ENG2.srt
need to be solved!!!
it may be a regexp thing
-
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
-
xyka
- Posts: 22
- Joined: 21 Oct 2010 22:17
Re: I need script that mass renames SRTs using AVI file basename
START FOLDER:
1
Stargate Universe - 02x06 - Trial and Error.FQM.En.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi <- If I select this and I start the script ---> OK
SCRIPT:
RESULTS:
1
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi
stargate.universe.s02e06.hdtv.xvid-fqm.ENG2.srt
-----------
BUT
START FOLDER:
1
Stargate Universe - 02x06 - Trial and Error.FQM.En.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip <- If I select this or other or nothing and I start the script ---> NOT OK
stargate.universe.s02e06.hdtv.xvid-fqm.avi
SCRIPT:
PICTURE
$a doesn't get current base name
RESULTS:
1
Stargate Universe - 02x06 - Trial and Error.FQM.En.ENG2.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi
What can we do?
.
1
Stargate Universe - 02x06 - Trial and Error.FQM.En.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi <- If I select this and I start the script ---> OK
SCRIPT:
Code: Select all
Selfilter "*.avi", f;
$a = "<curbase>";
Selfilter "*.srt", f;
copyto ("1");
rename b, $a;
rename b, "*.ENG2";
RESULTS:
1
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi
stargate.universe.s02e06.hdtv.xvid-fqm.ENG2.srt
-----------
BUT
START FOLDER:
1
Stargate Universe - 02x06 - Trial and Error.FQM.En.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip <- If I select this or other or nothing and I start the script ---> NOT OK
stargate.universe.s02e06.hdtv.xvid-fqm.avi
SCRIPT:
Code: Select all
Selfilter "*.avi", f;
$a = "<curbase>";
Selfilter "*.srt", f;
copyto ("1");
rename b, $a;
rename b, "*.ENG2";
$a doesn't get current base name
RESULTS:
1
Stargate Universe - 02x06 - Trial and Error.FQM.En.ENG2.srt
Stargate Universe s02e06 (hdtv-fqm) magyar.zip
Stargate Universe s02e06 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e06.hdtv.xvid-fqm.avi
What can we do?
.
Last edited by xyka on 05 Nov 2010 23:17, edited 2 times in total.
XYplorer Beta Club