zer0's Scripts Library
Posted: 24 May 2009 01:04
In this thread I will aim to build a collection of scripts that may be of use to other users of XY. The almighty jacky already has a library of scripts here: http://88.191.26.34/XYscripts/, so I felt that the more I dive into scripting the more scripts I should share. Additionally, quite often I need a small script that would automate a job for me, something I can do with one click of a button instead of two. My scripts won't necessarily be complicated, though they may become more complex as my knowledge of scripting expands. Without further ado...
Remove Extension from file(s)
The purpose of this script is to remove a file's (or files') extension. Sometimes, when you download a file, it looks like xxxx.rar.html or similar. Obviously, you can't extract it until you've removed its extension. With lots of files, this process can be tedious, so here's a quick script that would do the job in an instant.
Select all files of a particular type in the current folder
By default, XY includes a column that's called "Ext", which allows you to sort all your files by their extensions. For people who have alternative sorting arrangements and those who don't have that column because they don't want to have it or they need more list pane space this script will select all the files that have the extension specified in the script.for more flexibility, it may be desired to have a pop-up window, in which a user would specify the extension. Script for that is below
Rename all files as current folder and move up a tree level
On occasions, the files I extracted were put into folders. What I needed to do is to rename files in those folders as those folders and then move them into the directory where those folders are. This script does exactly that.
Save ASCII art files in XYplorer
If you come across some ASCII art on the web then it's possible that it will be shown like this http://pastebin.com/f5e867b85, but with the help of my script and a little more work you'll be able to save them as shown here: http://i40.tinypic.com/v6127p.png. You also need to download the ASCII.zip attachment and install the Terminal font that is in the archive, it's a much better version than the one that Windows has by default. Then, go to XY's configuration, in the Fonts section for Edit Text part change the font to the one you've just installed and choose the appropriate size, I have it set to 10. Run the script, paste your code into it and have it saved as great-looking ASCII art.
Renaming a file from clipboard
Quite often, I download an installer for a program that is just called as the name of the program. For me, that's not good enough. Quite often the developer includes the full release name on their web page (you'll need to copy this release name to clipboard), so with this script you can rename your current file(s) as per what is stored in clipboard.
Remove Extension from file(s)
The purpose of this script is to remove a file's (or files') extension. Sometimes, when you download a file, it looks like xxxx.rar.html or similar. Obviously, you can't extract it until you've removed its extension. With lots of files, this process can be tedious, so here's a quick script that would do the job in an instant.
Code: Select all
"Remove Extension" rename e;By default, XY includes a column that's called "Ext", which allows you to sort all your files by their extensions. For people who have alternative sorting arrangements and those who don't have that column because they don't want to have it or they need more list pane space this script will select all the files that have the extension specified in the script.
Code: Select all
"Select All [insert type of file here] files"
Selfilter *.[insert extension here], f;
focus l;Code: Select all
"Select All files of the entered type"
$a = input("Please type extension");
Selfilter *.$a, f;
focus l;On occasions, the files I extracted were put into folders. What I needed to do is to rename files in those folders as those folders and then move them into the directory where those folders are. This script does exactly that.
Code: Select all
Set($cf,<curfolder>);
Sel(f);
Rename(b,$cf);
Focus(L);
MoveTo("..");
#523;
SelFilter($cf, d, Name);
Focus(L);
#169;If you come across some ASCII art on the web then it's possible that it will be shown like this http://pastebin.com/f5e867b85, but with the help of my script and a little more work you'll be able to save them as shown here: http://i40.tinypic.com/v6127p.png. You also need to download the ASCII.zip attachment and install the Terminal font that is in the archive, it's a much better version than the one that Windows has by default. Then, go to XY's configuration, in the Fonts section for Edit Text part change the font to the one you've just installed and choose the appropriate size, I have it set to 10. Run the script, paste your code into it and have it saved as great-looking ASCII art.
Code: Select all
"Save ASCII art" $a = input("Enter ASCII art",,, "m",,690,850);
$b = input("Enter Name");
writefile("<curpath>\$b.nfo", $a);Quite often, I download an installer for a program that is just called as the name of the program. For me, that's not good enough. Quite often the developer includes the full release name on their web page (you'll need to copy this release name to clipboard), so with this script you can rename your current file(s) as per what is stored in clipboard.
Code: Select all
$a = <clipboard>;
rename b, $a;