Clear unnecessary lyrics

Source: Internet
Author: User

When you listen to a song, you will often delete some songs that you no longer listen to. This operation is generally completed in the player. After a long time, you will leave many lyrics that you no longer need. Although the lyrics do not occupy space, they are always uncomfortable and want to clear them. Do it.

Script File (clearlrc. JS)

Function
Handlefile
(Filename
)
{

Basename
=
FSO
.
Getbasename
(Filename
); // File name

Extname
=
FSO
.
Getextensionname
(Filename
); // Extension

If
(Extname
.
Tolowercase
()! =
"LRC"
) // Not a lyrics File

{

Return
;
}

// Find the corresponding MP3 file

Songfilename
=
Basename
+
". MP3"
;
Hasfile
=
FSO
.
Fileexists
(Dir
+
"//"
+
Songfilename
);
If
(!
Hasfile
) // No mp3 file, search for WMA

{

Songfilename
=
Basename
+
". Wma"
;
Hasfile
=
FSO
.
Fileexists
(Dir
+
"//"
+
Songfilename
);
If
(!
Hasfile
) // No WMA, delete the lyrics, and record logs

{

FSO
.
Deletefile
(Dir
+
"//"
+
Filename
);
Filedelnum
++;

Filedel
+ =
Filename
+
"/R/N"
;
}

}

}

Try

{

Dir
=
Wscript
.
Arguments
(0
);
}

Catch
(E
)
{

Dir
=
"."
;
}

DT
=
New
Date
();
Log
=
""
;
Filedelnum
=
0
;
Filedel
=
""
;
FSO
=
New
Activexobject
("Scripting. FileSystemObject"
);
Fld1
=
FSO
.
Getfolder
(Dir
);
FC
=
New
Enumerator
(Fld1
.
Files
);
For
(;!
FC
.
Atend
(); FC
.
Movenext
())
{

Handlefile
(FC
.
Item
().
Name
)
}

Log
=
"-----"
+
DT
.
Tolocalestring
() +
"Deleting files"
+
Filedelnum
+
"Items"
+
"-----/R/N"
;
Log
+ =
Filedel
;
Log
+ =
"/R/N"
;
// Record logs to files

Logfile
=
FSO
.
Opentextfile
(Dir
+
"//"
+
"Clearlrc. log"
,
8
,
True
);
Logfile
.
Write
(Log
);
Logfile
.
Close
();
Wscript
.
Echo
(Log
);

 

Now this file can clear the lyrics in its own directory. But it is not convenient enough. Add it to the right-click menu.

Create the following values in the registry:

Hkey_classes_root/directory/background/Shell/clearlrc default: Clear the lyrics (& B)

Hkey_classes_root/directory/background/Shell/clearlrc/command

Default Value: wscript E:/self-sufficiency/practical script/clearlrc. js

 

Hkey_classes_root/directory/Shell/clearlrc default: Clear the lyrics (& B)

Hkey_classes_root/directory/Shell/clearlrc/command

Default Value: wscript E:/self-sufficiency/practical script/clearlrc. js

 

OK.

 

PS: I am not responsible for the consequences of this script without strict testing.

PS again: win7 is really useful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.