SRL Archive - MSI Suggestions

Adding version to Proggy


Sir R. M8gic1an

2010-07-24 05:16:10


var
MSIVersion: integer;

Procedure MSI_GetVersion;
var
s: string;
begin
s := GetPage('http://villavu.com/repositories/msi/');
MSIVersion := StrToInt( Between('rev="', '"', s) );
end;

begin
MSI_GetVersion;
writeln(MSIVersion);
end.

I'll be adding this in it's due place in a second. ATM MSI doesn't compile, but at least this will already be there.

edit: actually, this doesn't make sense. I'm just grabbing the online version. I wanted it to print which revision the user is using >.>

~RM

Shuttleu

2010-07-24 05:49:29

there isn't one for the revision number

add
  MSI_REV_NUMBER = 182;
to globals.scar
then you can use that

~shut

EDIT: then change line 244 in debug.scar to
    MSI_PrintSave(theFile, '{-------------------------- ' + MSI_VERSION_NUMBER + ' Rev: '+IntToStr(MSI_REV_NUMBER)+'-------------------------}');                          

Sir R. M8gic1an

2010-07-24 05:53:30

From: Shuttleu
there isn't one for the revision number

add
  MSI_REV_NUMBER = 182;
to globals.scar
then you can use that

~shut

EDIT: then change line 244 in debug.scar to
    MSI_PrintSave(theFile, '{-------------------------- ' + MSI_VERSION_NUMBER + ' Rev: '+IntToStr(MSI_REV_NUMBER)+'--------------------------}');                          


Yes, that's the obvious solution, the thing is, I doubt we'll be wanting to update that const on every commit.

~RM

Shuttleu

2010-07-24 05:57:06

is there a way to use the svn files…?

ima check now

~shut

EDIT: how do you read a text file, i have only used ini's

Sir R. M8gic1an

2010-07-24 06:25:33

From: Shuttleu
is there a way to use the svn files…?

ima check now

~shut

EDIT: how do you read a text file, i have only used ini's


What's your idea? - whatever you want to do with a .txt, you can do with a .ini;

And just have a look through the file functions. You basically just have to open it, keep a pointer to it in a var and the manipulate it and close it.

~RM

Shuttleu

2010-07-24 07:08:54

From: Rasta Magician
What's your idea? - whatever you want to do with a .txt, you can do with a .ini;

And just have a look through the file functions. You basically just have to open it, keep a pointer to it in a var and the manipulate it and close it.

~RM


well in the svn folder there is a file called entries
in there at the very top there is this
dir
182
http://villavu.com/repositories/msi
http://villavu.com/repositories/msi

we can then use that.

~shut

EDIT: here

can you try this for me
program new;
var
TheFile: Integer;
TheFileString: string;
begin
TheFile:= OpenFile(ScriptPath+'.svn\entries', True)
writeln(ReadFileString(TheFile, TheFileString, 20));
CloseFile(TheFile);
writeln(TheFileString);
Writeln(Between('dir', 'http', TheFileString));
end.

Sir R. M8gic1an

2010-07-24 07:28:32

Great find! I didn't know about that o.O

[php]
program new;

var
MSIVersion: integer;

Procedure GetLocalVersion;
var
I: integer;
s: string;
begin
I := OpenFile(ScriptPath + '.svn\entries' , true);
ReadFileString(I, s, 11);
s := s + 'end';
S := Trim(Between('dir', 'end', s));
MSIVersion := StrToInt(s);
end;

begin
GetLocalVersion;
writeln(MSIVersion);
end.
[/php]

You'll have to save that inside the msi folder. Name doesn't matter. Should work.

notice: it must be saved.

~RM

Shuttleu

2010-07-24 07:29:17

From: Rasta Magician
Great find! I didn't know about that o.O

[php]
program new;

var
MSIVersion: integer;

Procedure GetLocalVersion;
var
I: integer;
s: string;
begin
I := OpenFile(ScriptPath + '.svn\entries' , true);
ReadFileString(I, s, 11);
s := s + 'end';
S := Trim(Between('dir', 'end', s));
MSIVersion := StrToInt(s);
end;

begin
GetLocalVersion;
writeln(MSIVersion);
end.
[/php]

You'll have to save that inside the msi folder. Name doesn't matter. Should work.

notice: it must be saved.

~RM


i already done one, look at my post above yours

~shut

EDIT: they are both practically the same

program new;

var
MSIRev: string;

procedure SetMsiRev;
var
i: Integer;
s: string;
begin
i:= OpenFile(ScriptPath+'.svn\entries', True)
ReadFileString(i, s, 20);
CloseFile(i);
MSIRev:= Between('dir', 'http', s);
end;

begin
SetMSIRev;
Writeln(MSIRev);
end.

Sir R. M8gic1an

2010-07-24 07:41:41

yours is slightly better. (in an obvious way). I say we use that. I'll commit in a min.

ps: I'm rather enjoying the work you're putting into msi.

~RM

Gu3st...

2010-07-24 07:45:21

If my thinking is correct, if you do Between('dir', 'http', s); you'll get
#10#13 + '182' + #10#13

Sir R. M8gic1an

2010-07-24 08:32:43

From: Zyt3x
If my thinking is correct, if you do Between('dir', 'http', s); you'll get
#10#13 + '182' + #10#13


I trimmed it.

http://villavu.com/repositories/msi/Debug.scar

:)

~RM

Shuttleu

2010-07-24 09:04:25

From: Rasta Magician
I trimmed it.

http://villavu.com/repositories/msi/Debug.scar

:)

~RM

you still need to add it to the header ;)

~shut

EDIT: also would it be better to use Getnumbers instead of Trim?

Sir R. M8gic1an

2010-07-24 09:43:15

From: Shuttleu
you still need to add it to the header ;)

~shut

EDIT: also would it be better to use Getnumbers instead of Trim?


I'll add it to the header later >.< I obviously haven't done this in a long time.

As for GetNumbers: w/e, this works.

~RM