Please help I need a Script !
Please help I need a Script !
Hi
I know almost anything in programming so I hope I will find some help !
I would like copy the name of an .mp3 file, delete it, and create a .txt file with the name of the mp3 file.
So pushing a key will transform "michael jackson - billie jean.mp3" to "michael jackson - billie jean.txt" (with a file size of 0 K)
Thanks for your help !
Ysl
I know almost anything in programming so I hope I will find some help !
I would like copy the name of an .mp3 file, delete it, and create a .txt file with the name of the mp3 file.
So pushing a key will transform "michael jackson - billie jean.mp3" to "michael jackson - billie jean.txt" (with a file size of 0 K)
Thanks for your help !
Ysl
Re: Please help I need a Script !
Give this a try:
Code: Select all
End(GetInfo("CountSelected") < 1, "No item(s) selected.");
Global($files);
$files = Report("{Dir |{FullName};{Ext}<crlf>|}", 1);
Setting("AllowRecursion", 1);
Sub("_newTXT");
RegexReplace($files, $files, "^(.*);.*<crlf>", "$1|");
Delete(1,1,$files);
"_newTXT"
Global($files, $i);
$i = $i Like "" ? 1 : $i;
$token = GetToken($files, $i, "<crlf>");
End($token Like "",, 1);
$file = GetToken($token, 1, ";");
$ext = GetToken($token, 2, ";");
RegexReplace($newFile, $file, "$ext$", "txt");
New($newFile);
$i = $i + 1;
Sub("_newTXT");
Last edited by TheQwerty on 16 Apr 2009 22:52, edited 3 times in total.
Re: Please help I need a Script !
THANKS ! so good so fast !
It works almost perfectly !
I have this error message :
And I have to press continue for each file...
Thanks again !
Ysl
It works almost perfectly !
I have this error message :
And I have to press continue for each file...
Thanks again !
Ysl
-
- XY Blog Master
- Posts: 5824
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
Re: Please help I need a Script !
Yes, TheQwerty is one of great scripters and very helpful as well!Ysl wrote:THANKS ! so good so fast !
See our wiki for this one: http://88.191.26.34/XYwiki/index.php/IN ... hecker_OffI have this error message :
As it notes, one can do same via Setting.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
Re: Please help I need a Script !
Perfect !
Thanks guys for your help and thanks XYplorer for scripting !
Ysl
Thanks guys for your help and thanks XYplorer for scripting !
Ysl
Re: Please help I need a Script !
Doh.. Yep, I indeed forgot to disable the recursion checker in the script. Luckily, j_c_hallgren's always quick with finding the relevant parts of the wiki or forum posts.Ysl wrote:It works almost perfectly !
I have this error message :
In any case, I've updated the script above to temporarily disable the recursion checker.
Glad that works for you!
Re: Please help I need a Script !
One last thing, I don"t know if it is possible but it would save time
Can we pass the delete confirmation panel and delete without asking ?
Thanks
Ysl
Can we pass the delete confirmation panel and delete without asking ?
Thanks
Ysl
Re: Please help I need a Script !
Take a look here: http://88.191.26.34/XYwiki/index.php/Sc ... nd:_deleteYsl wrote:Can we pass the delete confirmation panel and delete without asking ?
Then you can change the Delete command to work however you'd like.
You'll probably want "Delete(1,0,$files);"
Re: Please help I need a Script !
It's even better now !
Merci encore !
Ysl
Merci encore !
Ysl
Re: Please help I need a Script !
May I ask one more refinement ?
I would like to select all the files in a folder (.jpg, mp3, txt) and when I run the script, I would like for only the mp3 to be renamed/deleted.
There should be a "if -then" command somewhere which can do that I hope...
Thanks
I would like to select all the files in a folder (.jpg, mp3, txt) and when I run the script, I would like for only the mp3 to be renamed/deleted.
There should be a "if -then" command somewhere which can do that I hope...
Thanks
Re: Please help I need a Script !
It would probably be smarter to use a selection or visual filter, but I've updated the above code and it should ignore anything that doesn't have the extension mp3.Ysl wrote:I would like to select all the files in a folder (.jpg, mp3, txt) and when I run the script, I would like for only the mp3 to be renamed/deleted.
Unfortunately, XY scripting does not yet have real if-else constructs, so it's not that easy. As I wanted to keep the Delete as a single bulk call it won't be that easy even when he gives them to us.Ysl wrote:There should be a "if -then" command somewhere which can do that I hope...
Re: Please help I need a Script !
Well, Thanks again for your help but unfortunately, the script work as before, the "folder.jpg" was renamed "folder.txt" and deleted...
Ysl
Ysl
Re: Please help I need a Script !
Yeah.. that's not going to work.
Can't you just use a Selection or Visual filter so you're only dealing with MP3s in the first place?
Can't you just use a Selection or Visual filter so you're only dealing with MP3s in the first place?
Re: Please help I need a Script !
I don't really understand those options but will look in the manual !
Re: Please help I need a Script !
Hi
It seem that since 8.50 or 8.60, this script doesn't work anymore !
When running it, all that happen is a new file in the same folder
Name of the new file (which should be the same as the selected one but with the .txt extension) : $newFile
Thanks for your help !
Ysl
It seem that since 8.50 or 8.60, this script doesn't work anymore !
When running it, all that happen is a new file in the same folder
Name of the new file (which should be the same as the selected one but with the .txt extension) : $newFile
Thanks for your help !
Ysl