Forum > General

Need C&C on my new console

(1/2) > >>

captian jaster:

--- Code: --- BEGIN
  TextBackground(LightGreen);
  ClrScr;
  writeln('Please wait...');
  Delay(1000);
  RootDir := Fsearch('C:\Xhydriks\Console\', GetEnv(''));
  if RootDir = '' then
  begin
    writeln('An installation is required!');
    writeln('Would you like to install?');
    writeln('Type "install" and press Enter if so');
    writeln('Type in "Close" and press enter to close');
    readln(Command);
    if Command = 'Close' then Halt;
    if Command = 'Install' then
    begin//INSTALLER
      writeln('Now Installing...');
      writeln('Building directorys...');
      CreateDir('C:\Xhydriks\');
      writeln('C:\Xhydriks\');
      Delay(1000);
      CreateDir('C:\Xhydriks\Console\');
      writeln('C:\Xhydriks\Console\');
      Delay(1000);
      CreateDir('C:\Xhydriks\Docs\');
      writeln('C:\Xhydriks\Docs\');
      Delay(1000);
      writeln('Writing files...');
      assignfile(file1, 'C:\Xhydriks\Console\records.dat');
      writeln('C:\Xhydriks\Console\records.dat');
      Delay(1000);
      rewrite(file1);
      writeln(file1,'User input history:');
      closefile(file1);
      writeln('Installation complete!');
      writeln('Close the program and restart it to use the console!');
      Readln;
    end;
  end;
END;
--- End code ---
If you have an idea for a code i should add please tell me so.

User137:
What's C&C?  (other than Command & Conquer  ::) )
At least i can't tell from code what you are asking of us, and also, why manually making installer take longer with delays puzzles me.

captian jaster:
C&C stands for comments and criticism.
I remember putting the delays there cuz it just looked smoother.
I wann know what you think i should add to improve it
Feature wise,Graphic wise,Code wise

User137:
I would change the first question in installer to
"Would you like to continue install? [Y/N]"


--- Code: ---if UpperCase(Command) <> 'Y' then Halt
else begin
  // Install
--- End code ---
This would require user to type 'Y' or 'y' to continue and answering anything else would close it.

Another feature could be starting the program after install, i got the idea that it was what user was trying to do. Also you are missing error handling. What if directory can't be written to?

theo:
Why is this interactive at all?
I can choose "Install" or "Close" nothing more, no Paths to enter nothing.
If I call this programm, it could just do it, no?

Imo there is no need for colors and stuff for such an installer.

If you want to do it like this, you should probably lowercase the input.
More so if you write "Type "install" and press Enter if .." and then check for "Install" with a big letter.

Generally I'd use parameters with GetOpts

Navigation

[0] Message Index

[#] Next page

Go to full version