EvilZone
Programming and Scripting => Other => : Kulverstukas September 08, 2011, 01:04:32 PM
-
Oh fuck am I bored during programming classes... have to code such useless stuff to keep me awake and amused :D
This program will create 100 folders on your desktop with random name of 10 chars.
You can easily change numbers yourself, I commented where what could be changed...
Compiled Exe: http://newage.ql.lt/projects/delphi/Foldurs/Foldurs.exe (http://newage.ql.lt/projects/delphi/Foldurs/Foldurs.exe)
Project: http://newage.ql.lt/projects/delphi/Foldurs/Foldurs.zip (http://newage.ql.lt/projects/delphi/Foldurs/Foldurs.zip)
Code for an oversight, and I think you can compile that with FreePascal compiler:
(*
Author: Kulverstukas
Written on: 2011-09-08
http://newage.ql.lt/
------
Program to create lots
of folders on your Desktop.
*)
program Foldurs;
{$APPTYPE CONSOLE}
{$R *.dres}
uses
SysUtils;
const DefaultFolders = 100; // If nothing is given in an argument, this value is used
var Desktop : String;
FolderCount, Folders : integer;
//==========================================
(* Generate a random name in given length of given chars *)
function RandomName : String;
const abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789abcdefghijklmnopqestuvwxyz';
Name = 10; // this number states how long will the folder name be
var Count : integer;
NameStr : String;
begin
for Count := 1 to Name do
begin
NameStr := NameStr + abc[System.Random(51)];
end;
Result := Trim(NameStr);
NameStr := '';
end;
//==========================================
(* Strip crap from the string and leave only numbers *)
function PickNumbers(Line : String) : Integer;
var Ch : String;
ChCount : integer;
begin
for ChCount := 1 to length(Line) do
begin
if (Line[ChCount] in ['0'..'9']) then
Ch := Ch + Line[ChCount];
end;
if (Ch = '') then Result := DefaultFolders
else Result := StrToInt(Ch);
end;
//==========================================
begin
if (ParamCount > 0) then
Folders := PickNumbers(ParamStr(1))
else Folders := DefaultFolders;
Desktop := SysUtils.GetEnvironmentVariable('userprofile');
Desktop := Desktop + '\Desktop';
for FolderCount := 1 to Folders do
begin
SysUtils.CreateDir(Desktop+'\'+RandomName);
end;
end.
-
normally I wouldn't run something like this, but I'm about to install linux on this laptop and might as well trash windows before I do so. Will also run much more malicious code.
Also I thought you were learning java? Your teacher wouldn't be happy about this. >:(
-
bla bla bla >:(
Yeah I am learning it but classes now are more centered about general rules of programming, like algorithms and I already know that stuff and in a day on my own I learn as much as they teach us in a week :P so I am way ahead of my class...
-
pfft your exe quit after 5, wasn't too thrilling
-
pfft your exe quit after 5, wasn't too thrilling
Oh... probably the old exe - I set it to 5 for testing. Compile it yourself with new values :D
-
I figured that, but too late though . computer no long runs windows... It doesn't run linux either.. My netinstall failed, so no more fucking around downloading 4.5GB of DVD! They coulda told me they couldn't find their files before formatting... Assholes. Anywayz for the the moment I get:
"Missing operating system"
I don't think your program will run on this computer.
-
Kulver, you really need to stop hard coding your program values. :P
-
Kulver, you really need to stop hard coding your program values. :P
OKAY! fine... I fixed it. Now it accepts a number to make folders. If none is given then program is run with default values - 100. You can combine letters/symbols and numbers, program will strip that shit leaving only numbers.
Foldurs.exe 9999999