SRL Archive - Extensions

msi.sex


Timer

2010-08-25 19:32:50

Updates to latest MSI version. What more to it?

Don't think I like Simba, I honestly don't. 3Garrett3 asked me to make this.

MylesMadness

2010-08-25 19:57:35

I trust wizzup way more then you, just saying

Timer

2010-08-25 20:11:12

Okay. If he wishes to upload to his server, he may.

MylesMadness

2010-08-25 21:46:38

Be said he was going to, but he never did

Coh3n

2010-08-26 00:32:33

From: MylesMadness
Be said he was going to, but he never did

Doesn't it just have to be written similar to reflection and srl.sex? There shouldn't be much else to it.

Sex

2010-08-26 00:38:11

Yeah but the snapshots and such are stored on Timer's server and not wizzup.org.

Naum

2010-08-26 05:17:02

Good Job :)

Wizzup?

2010-08-26 08:19:01

From: MylesMadness
Be said he was going to, but he never did


Well, I was just waiting on some code from you. I can add it right now if you want.

From: Coh3n
Doesn't it just have to be written similar to reflection and srl.sex? There shouldn't be much else to it.


We actually wanted to combine some (I think RM suggested this), but I guess this works too. ;)

MylesMadness

2010-08-26 14:54:04

Oh, I never did finish that combind .sex thingy. I'll do that today

Wizzup?

2010-08-26 15:03:44

From: MylesMadness
Oh, I never did finish that combind .sex thingy. I'll do that today


Cool. I think it's still a good idea to keep msi.sex separate (We'll ship it with the Simba install though)
Combining srl.sex and reflection.sex seems fine. :)

Wizzup?

2010-08-26 15:22:10

Also, I guess you need all the files from the repos?

Timer

2010-08-26 15:26:24

Wizzup?, I believe you upload them every commit, no?
I thought you wouldn't wanna do that.

Wizzup?

2010-08-26 15:44:54

From: Timer
Wizzup?, I believe you upload them every commit, no?
I thought you wouldn't wanna do that.


I don't follow. I update all the .tbz's every 15 minutes to reflect the latest changes. Upon update, all the files will be downloaded and overwritten.

Timer

2010-08-26 16:08:43

yeah, I just make my site check the SVN every 15 minutes and update if a new rev is out.

Coh3n

2010-08-27 16:15:43

From: Wizzup?
Also, I guess you need all the files from the repos?

Yeah, we'll need all the files/folders. :)

Wizzup?

2010-08-29 11:07:39

Added to http://wizzup.org/static/srl/

Also fixed a bug with the reflection-tar. :)

Coh3n

2010-08-29 14:24:54

From: Wizzup?
Added to http://wizzup.org/static/srl/

Also fixed a bug with the reflection-tar. :)

Sorry, but I don't really know what that means. :o Can it be downloaded with Simba now? Or is that just where we can download the extension itself.

Wizzup?

2010-08-29 14:29:18

From: Coh3n
Sorry, but I don't really know what that means. :o Can it be downloaded with Simba now? Or is that just where we can download the extension itself.


I uploaded the files the extension will need to actually install reflection. :)
(So that is not the extension, just a snapshot of the MSI repos)

Coh3n

2010-08-29 14:32:34

From: Wizzup?
I uploaded the files the extension will need to actually install reflection. :)
(So that is not the extension, just a snapshot of the MSI repos)

Oh, okay. I think I understand. :p

Thanks.

MylesMadness

2010-08-29 15:43:49

program MSIUpdater;

var
MainMenuItem, MenuCheck, MenuUpdate, AutoUpdate: TMenuItem;
started: Boolean;
Timer: TTimer;
Updating: boolean;
LocalR, OnlineR: Integer;
F: TForm;
Memo: TMemo;
but: TButton;

function GetNumbers(const str: string): string;
var
i: integer;
begin;
for i := 1 to Length(str) do
case str[i] of
'0'..'9': Result := Result + str[i];
end;
end;

procedure GetOnlineVersion(out MSIVersion: Integer);
begin
MSIVersion := StrToIntDef(GetNumbers(GetPage('http://wizzup.org/static/srl/msi_version')), -1);
end;

procedure GetLocalVersion(out MSIVersion: Integer);
begin
MSIVersion := StrToIntDef(Settings.GetKeyValueDef('MSIVersion', '-1'), -1);
end;


function UpdateMSI: Boolean;
var
Contents, DeContents: string;
Failed: Boolean;
begin
Memo.Lines.Add('Downloading MSI...');
Contents := GetPage('http://wizzup.org/static/srl/msi.tar.bz2');
Failed := True;
Memo.Lines.Add('Uncompressing MSI...');
if (DecompressBZip2(Contents, DeContents, 4096)) then
if(UnTarEx(DeContents, IncludePath + 'SRL/SRL/', True)) then
Failed := False;
if (not Failed) then
Settings.SetKeyValue('MSIVersion', IntToStr(OnlineR));
if (Result) then
Result := Failed;
if (not Failed) then
begin
Memo.Lines.Add('Succesfully updated MSI!');
Writeln('Succesfully updated MSI!');
end;
end;

procedure DoUpdate(Sender: TObject);
begin
if (LocalR < OnlineR) then
begin
Memo.Lines.Add('MSI has been updated! Your version: ' + IntToStr(LocalR) +
' New version: ' + IntToStr(OnlineR));
UpdateMSI;
end;
F.ModalResult := mrOk;
end;


function Update: Boolean;
var
OpenForm: Boolean;
begin
Result := False;
if (Updating) then
Exit;
Updating := True;

if (LocalR < OnlineR) then
begin
case MessageDlg('MSI Updater', 'Updates are available! '+
'Do you wish to open the Updater now?',
mtConfirmation, [mbNo,mbYes],0) of
mrYes : OpenForm := True;
else
OpenForm := False;
end;
if (not OpenForm) then
begin
Updating := False;
Exit;
end;
Result := True;
f.ShowModal;
end else
begin
WriteLn('No MSI update was detected!');
end;
Updating := False;
end;

procedure OnMSICheckClick(Sender: TObject);
begin
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
if (LocalR < OnlineR) then
begin
Writeln('A new MSI version is available');
Update;
end;
end;

procedure SetAutoUpdate(Sender: TObject);
begin
AutoUpdate.Checked := not AutoUpdate.Checked;
Timer.Enabled := AutoUpdate.Checked;
if (LowerCase(Settings.GetKeyValueDef('AutoUpdate', 'True')) = 'true') then
Settings.SetKeyValue('AutoUpdate', 'False')
else
Settings.SetKeyValue('AutoUpdate', 'True');
end;

procedure OnMSIUpdateClick(Sender: TObject);
begin
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);

if (OnlineR <= LocalR) then
MessageDlg('MSI Updater', 'No MSI update was detected!' ,mtConfirmation, [mbYes],0)
else
Update;
end;

procedure OnUpdateTimer(Sender: TObject);
begin;
Timer.Interval := 30 * 60 * 1000;
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
Update;
end;

procedure Init;
begin;
MainMenuItem := TMenuItem.Create(Simba_MainMenu);
MainMenuItem.Caption := 'MSI';
Simba_MainMenu.Items.Add(MainMenuItem);

MenuCheck := TMenuItem.Create(MainMenuItem);
MenuCheck.Caption := 'Check for new MSI Version';
MenuCheck.OnClick := @OnMSICheckClick;
MainMenuItem.Add(MenuCheck);

MenuUpdate := TMenuItem.Create(MainMenuItem);
MenuUpdate.Caption := 'Update MSI';
MenuUpdate.OnClick := @OnMSIUpdateClick;
MainMenuItem.Add(MenuUpdate);

AutoUpdate := TMenuItem.Create(MainMenuItem);
AutoUpdate.Caption := 'Automatically update?';
AutoUpdate.OnClick := @SetAutoUpdate;
AutoUpdate.Checked := LowerCase(Settings.GetKeyValueDef('AutoUpdate','True')) = 'true';
MainMenuItem.Add(AutoUpdate);

Timer := TTimer.Create(Simba);
Timer.Interval := 5000;
Timer.OnTimer := @OnUpdateTimer;
Timer.Enabled := AutoUpdate.Checked;

F := TForm.Create(nil);
With F Do
begin
Visible := False;
Width := 300;
Height := 300;
BorderStyle := bsSingle;
Caption := 'MSI Updater - Updates Available!';
end;

but := TButton.Create(F);

with but do
begin
Parent := F;
Left := 10;
Top := 10;
Caption := 'Update';
Width := 280;

OnClick := @DoUpdate;
end;

Memo := TMemo.Create(F);

with Memo do
begin
Parent := F;
Left := 10;
Top := 40;
Width := 280;
Height := 250;
end;

started := True;
end;

procedure Free;
begin
if (started) then
Timer.Enabled := False;//Freeing the components is not needed, as they will be freed upon the freeing of Simba.
{ if F <> nil then
F.Free; }
end;

procedure Attach;
begin;
Writeln('From now on you will be alerted when your MSI version is out of date! - Timer!');
MainMenuItem.Visible := True;
Timer.Enabled := AutoUpdate.Checked;
end;

Procedure Detach;
begin
Timer.Enabled := False;
MainMenuItem.Visible := False;
end;

function GetName: string;
begin;
result := 'MSI Updater';
end;

function GetVersion: string;
begin;
result := '0.1';
end;
begin
end.

Wizzup?

2010-08-29 16:38:53


Writeln('From now on you will be alerted when your MSI version is out of date! - Timer!');

Blargh. (Not at you, Myles)

I'd like a few people to test the extension above?

holic

2010-08-29 17:29:29

From: Wizzup?

Writeln('From now on you will be alerted when your MSI version is out of date! - Timer!');

Blargh. (Not at you, Myles)

I'd like a few people to test the extension above?


Worked for me, now on rev 240

Home

2010-08-30 04:56:52

From: holic
Worked for me, now on rev 240


Yep, Works. : )

~Home

Coh3n

2010-08-30 14:52:34

Can someone test this one? I just changed the path to /Includes/. I've been meaning to change the MSI path location for a while now. The script won't run because I have to change all the include paths in Setup.simba. Just test to see if everything get's downloaded properly.

program MSIUpdater;

var
MainMenuItem, MenuCheck, MenuUpdate, AutoUpdate: TMenuItem;
started: Boolean;
Timer: TTimer;
Updating: boolean;
LocalR, OnlineR: Integer;
F: TForm;
Memo: TMemo;
but: TButton;

function GetNumbers(const str: string): string;
var
i: integer;
begin;
for i := 1 to Length(str) do
case str[i] of
'0'..'9': Result := Result + str[i];
end;
end;

procedure GetOnlineVersion(out MSIVersion: Integer);
begin
MSIVersion := StrToIntDef(GetNumbers(GetPage('http://wizzup.org/static/srl/msi_version')), -1);
end;

procedure GetLocalVersion(out MSIVersion: Integer);
begin
MSIVersion := StrToIntDef(Settings.GetKeyValueDef('MSIVersion', '-1'), -1);
end;


function UpdateMSI: Boolean;
var
Contents, DeContents: string;
Failed: Boolean;
begin
Memo.Lines.Add('Downloading MSI...');
Contents := GetPage('http://wizzup.org/static/srl/msi.tar.bz2');
Failed := True;
Memo.Lines.Add('Uncompressing MSI...');
if (DecompressBZip2(Contents, DeContents, 4096)) then
if(UnTarEx(DeContents, IncludePath, True)) then
Failed := False;
if (not Failed) then
Settings.SetKeyValue('MSIVersion', IntToStr(OnlineR));
if (Result) then
Result := Failed;
if (not Failed) then
begin
Memo.Lines.Add('Succesfully updated MSI!');
Writeln('Succesfully updated MSI!');
end;
end;

procedure DoUpdate(Sender: TObject);
begin
if (LocalR < OnlineR) then
begin
Memo.Lines.Add('MSI has been updated! Your version: ' + IntToStr(LocalR) +
' New version: ' + IntToStr(OnlineR));
UpdateMSI;
end;
F.ModalResult := mrOk;
end;


function Update: Boolean;
var
OpenForm: Boolean;
begin
Result := False;
if (Updating) then
Exit;
Updating := True;

if (LocalR < OnlineR) then
begin
case MessageDlg('MSI Updater', 'Updates are available! '+
'Do you wish to open the Updater now?',
mtConfirmation, [mbNo,mbYes],0) of
mrYes : OpenForm := True;
else
OpenForm := False;
end;
if (not OpenForm) then
begin
Updating := False;
Exit;
end;
Result := True;
f.ShowModal;
end else
begin
WriteLn('No MSI update was detected!');
end;
Updating := False;
end;

procedure OnMSICheckClick(Sender: TObject);
begin
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
if (LocalR < OnlineR) then
begin
Writeln('A new MSI version is available');
Update;
end;
end;

procedure SetAutoUpdate(Sender: TObject);
begin
AutoUpdate.Checked := not AutoUpdate.Checked;
Timer.Enabled := AutoUpdate.Checked;
if (LowerCase(Settings.GetKeyValueDef('AutoUpdate', 'True')) = 'true') then
Settings.SetKeyValue('AutoUpdate', 'False')
else
Settings.SetKeyValue('AutoUpdate', 'True');
end;

procedure OnMSIUpdateClick(Sender: TObject);
begin
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);

if (OnlineR <= LocalR) then
MessageDlg('MSI Updater', 'No MSI update was detected!' ,mtConfirmation, [mbYes],0)
else
Update;
end;

procedure OnUpdateTimer(Sender: TObject);
begin;
Timer.Interval := 30 * 60 * 1000;
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
Update;
end;

procedure Init;
begin;
MainMenuItem := TMenuItem.Create(Simba_MainMenu);
MainMenuItem.Caption := 'MSI';
Simba_MainMenu.Items.Add(MainMenuItem);

MenuCheck := TMenuItem.Create(MainMenuItem);
MenuCheck.Caption := 'Check for new MSI Version';
MenuCheck.OnClick := @OnMSICheckClick;
MainMenuItem.Add(MenuCheck);

MenuUpdate := TMenuItem.Create(MainMenuItem);
MenuUpdate.Caption := 'Update MSI';
MenuUpdate.OnClick := @OnMSIUpdateClick;
MainMenuItem.Add(MenuUpdate);

AutoUpdate := TMenuItem.Create(MainMenuItem);
AutoUpdate.Caption := 'Automatically update?';
AutoUpdate.OnClick := @SetAutoUpdate;
AutoUpdate.Checked := LowerCase(Settings.GetKeyValueDef('AutoUpdate','True')) = 'true';
MainMenuItem.Add(AutoUpdate);

Timer := TTimer.Create(Simba);
Timer.Interval := 5000;
Timer.OnTimer := @OnUpdateTimer;
Timer.Enabled := AutoUpdate.Checked;

F := TForm.Create(nil);
With F Do
begin
Visible := False;
Width := 300;
Height := 300;
BorderStyle := bsSingle;
Caption := 'MSI Updater - Updates Available!';
end;

but := TButton.Create(F);

with but do
begin
Parent := F;
Left := 10;
Top := 10;
Caption := 'Update';
Width := 280;

OnClick := @DoUpdate;
end;

Memo := TMemo.Create(F);

with Memo do
begin
Parent := F;
Left := 10;
Top := 40;
Width := 280;
Height := 250;
end;

started := True;
end;

procedure Free;
begin
if (started) then
Timer.Enabled := False;//Freeing the components is not needed, as they will be freed upon the freeing of Simba.
{ if F <> nil then
F.Free; }
end;

procedure Attach;
begin;
Writeln('From now on you will be alerted when your MSI version is out of date!');
MainMenuItem.Visible := True;
Timer.Enabled := AutoUpdate.Checked;
end;

Procedure Detach;
begin
Timer.Enabled := False;
MainMenuItem.Visible := False;
end;

function GetName: string;
begin;
result := 'MSI Updater';
end;

function GetVersion: string;
begin;
result := '0.1';
end;
begin
end.

Coh3n

2010-09-16 23:46:57

I was just testing this, and if I disable the extension and delete my MSI folder, when I reenable it, the files don't redownload and it says there's no update available.

E: Also, since there's already a menu called MSI (for the player remote), it just duplicates and creates another menu called MSI. Wouldn't it make more sense to merge them into one?

Wizzup?

2010-09-21 09:43:12

It probably says that because the version in the settings is the same as the online version. You could delete that version key?

Coh3n

2010-09-22 01:17:16

From: Wizzup?
It probably says that because the version in the settings is the same as the online version. You could delete that version key?

Sorry, what's the version key and how do I delete it? :o

Wizzup?

2010-09-22 05:09:19

From: Coh3n
Sorry, what's the version key and how do I delete it? :o


Tools -> Settings. Extensions -> ExtensionsN -> Delete the one with the path that looks like the MSI one. ;)

Coh3n

2010-09-22 13:24:20

From: Wizzup?
Tools -> Settings. Extensions -> ExtensionsN -> Delete the one with the path that looks like the MSI one. ;)

Alright well there was no msi.sex one, but I ran the extension again and it worked. So I don't know. BUT, when I enabled the extension it completely deleted the Player Remote menu option. Is there a way I can do a check like this in both extension files?

if (MenuExists('MSI')) then
Add('Player Remote')
else begin
CreateMenu('MSI');
Add('Player Remote');
end;

Coh3n

2010-10-25 12:32:43

^ Is it possible? I'd like to get this added to the setup guide as soon as possible. :)

Nava2

2010-10-25 14:10:49

From: Coh3n
^ Is it possible? I'd like to get this added to the setup guide as soon as possible. :)


Yes. Just loop through the menu items checking for their text. If its not there, you can add it. :)

Coh3n

2010-10-25 17:14:40

From: Nava2
Yes. Just loop through the menu items checking for their text. If its not there, you can add it. :)

Yeah but how do you loop through the items? Are they stored in some sort of array I don't know about? The extensions just add to Simba_MainMenu.

Gu3st...

2010-11-06 17:59:09

So I'm using this atm, and it is working (afaik) good enough
program MSIUpdater;

var
MainMenuItem, MenuCheck, MenuUpdate, AutoUpdate: TMenuItem;
started: Boolean;
Timer: TTimer;
Updating: boolean;
LocalR, OnlineR: Integer;
F: TForm;
Memo: TMemo;
but: TButton;

function GetNumbers(const str: string): string;
var
i: integer;
begin;
for i := 1 to Length(str) do
case str[i] of
'0'..'9': Result := Result + str[i];
end;
end;

procedure GetOnlineVersion(out MSIVersion: Integer);
begin
MSIVersion := StrToIntDef(GetNumbers(GetPage('http://wizzup.org/static/srl/msi_version')), -1);
end;

procedure GetLocalVersion(out MSIVersion: Integer);
begin
MSIVersion := StrToIntDef(Settings.GetKeyValueDef('MSIVersion', '-1'), -1);
end;


function UpdateMSI: Boolean;
var
Contents, DeContents: string;
Failed: Boolean;
begin
Memo.Lines.Add('Downloading MSI...');
Contents := GetPage('http://wizzup.org/static/srl/msi.tar.bz2');
Failed := True;
Memo.Lines.Add('Uncompressing MSI...');
if (DecompressBZip2(Contents, DeContents, 4096)) then
if(UnTarEx(DeContents, IncludePath, True)) then
Failed := False;
if (not Failed) then
Settings.SetKeyValue('MSIVersion', IntToStr(OnlineR));
if (Result) then
Result := Failed;
if (not Failed) then
begin
Memo.Lines.Add('Succesfully updated MSI!');
Writeln('Succesfully updated MSI!');
end;
end;

procedure DoUpdate(Sender: TObject);
begin
if (LocalR < OnlineR) then
begin
Memo.Lines.Add('MSI has been updated! Your version: ' + IntToStr(LocalR) +
' New version: ' + IntToStr(OnlineR));
UpdateMSI;
end;
F.ModalResult := mrOk;
end;


function Update: Boolean;
var
OpenForm: Boolean;
begin
Result := False;
if (Updating) then
Exit;
Updating := True;

if (LocalR < OnlineR) then
begin
case MessageDlg('MSI Updater', 'Updates are available! '+
'Do you wish to open the Updater now?',
mtConfirmation, [mbNo,mbYes],0) of
mrYes : OpenForm := True;
else
OpenForm := False;
end;
if (not OpenForm) then
begin
Updating := False;
Exit;
end;
Result := True;
f.ShowModal;
end else
begin
WriteLn('No MSI update was detected!');
end;
Updating := False;
end;

procedure OnMSICheckClick(Sender: TObject);
begin
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
if (LocalR < OnlineR) then
begin
Writeln('A new MSI version is available');
Update;
end;
end;

procedure SetAutoUpdate(Sender: TObject);
begin
AutoUpdate.Checked := not AutoUpdate.Checked;
Timer.Enabled := AutoUpdate.Checked;
if (LowerCase(Settings.GetKeyValueDef('AutoUpdate', 'True')) = 'true') then
Settings.SetKeyValue('AutoUpdate', 'False')
else
Settings.SetKeyValue('AutoUpdate', 'True');
end;

procedure OnMSIUpdateClick(Sender: TObject);
begin
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);

if (OnlineR <= LocalR) then
MessageDlg('MSI Updater', 'No MSI update was detected!' ,mtConfirmation, [mbYes],0)
else
Update;
end;

procedure OnUpdateTimer(Sender: TObject);
begin;
Timer.Interval := 30 * 60 * 1000;
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
Update;
end;

procedure Init;
begin;
MainMenuItem := TMenuItem.Create(Simba_MainMenu);
MainMenuItem.Caption := 'MSI';
Simba_MainMenu.Items.Add(MainMenuItem);

MenuCheck := TMenuItem.Create(MainMenuItem);
MenuCheck.Caption := 'Check for new MSI Version';
MenuCheck.OnClick := @OnMSICheckClick;
MainMenuItem.Add(MenuCheck);

MenuUpdate := TMenuItem.Create(MainMenuItem);
MenuUpdate.Caption := 'Update MSI';
MenuUpdate.OnClick := @OnMSIUpdateClick;
MainMenuItem.Add(MenuUpdate);

AutoUpdate := TMenuItem.Create(MainMenuItem);
AutoUpdate.Caption := 'Automatically update?';
AutoUpdate.OnClick := @SetAutoUpdate;
AutoUpdate.Checked := LowerCase(Settings.GetKeyValueDef('AutoUpdate','True')) = 'true';
MainMenuItem.Add(AutoUpdate);

Timer := TTimer.Create(Simba);
Timer.Interval := 5000;
Timer.OnTimer := @OnUpdateTimer;
Timer.Enabled := AutoUpdate.Checked;

F := TForm.Create(nil);
With F Do
begin
Visible := False;
Width := 300;
Height := 300;
BorderStyle := bsSingle;
Caption := 'MSI Updater - Updates Available!';
end;

but := TButton.Create(F);

with but do
begin
Parent := F;
Left := 10;
Top := 10;
Caption := 'Update';
Width := 280;

OnClick := @DoUpdate;
end;

Memo := TMemo.Create(F);

with Memo do
begin
Parent := F;
Left := 10;
Top := 40;
Width := 280;
Height := 250;
end;

started := True;
end;

procedure Free;
begin
if (started) then
Timer.Enabled := False;//Freeing the components is not needed, as they will be freed upon the freeing of Simba.
{ if F <> nil then
F.Free; }
end;

procedure Attach;
begin;
Writeln('From now on you will be alerted when your MSI version is out of date!');
MainMenuItem.Visible := True;
Timer.Enabled := AutoUpdate.Checked;
end;

Procedure Detach;
begin
Timer.Enabled := False;
MainMenuItem.Visible := False;
end;

function GetName: string;
begin;
result := 'MSI Updater';
end;

function GetVersion: string;
begin;
result := '0.1';
end;

begin
end.

Coh3n

2010-11-07 17:08:11

Yeah the reason I haven't added this to the MSI setup guide is because if you're using both this and the player remote, one will override the other on the menu bar. Either that or there will be two "MSI" menus, not sure which it was. I've been meaning to see if I can fix it, but I don't have a lot of time anymore.

i luffs yeww

2010-11-07 17:12:46

It overrides it, iirc.

Wizzup?

2010-11-07 17:19:52

Give the menu bar a different name? ;)

Coh3n

2010-11-07 17:19:57

From: i luffs yeww
It overrides it, iirc.

Okay, which is the worst of the two. :p

What is should do, it just add to the menu, which I'm sure isn't hard at all. I just need to look into it more. :) Oh, and have more time, that would help.

Coh3n

2010-11-07 17:21:01

From: Wizzup?
Give the menu bar a different name? ;)

Yeah, but they're both for MSI. I guess that would work temporarily, but that would really, really annoy me. >.<

i luffs yeww

2010-11-07 17:21:49

So do you want to append some menu items under the MSI.sex extension using a different extension?

Coh3n

2010-11-07 17:23:18

From: i luffs yeww
So do you want to append some menu items under the MSI.sex extension using a different extension?

If someone already has the player_remote.sex enabled, it will add msi.sex's menu items and vise versa.

i luffs yeww

2010-11-07 17:23:47

Would they need to have both enabled? Or why not just make one? :x

Wizzup?

2010-11-07 17:24:02

From: Coh3n
Yeah, but they're both for MSI. I guess that would work temporarily, but that would really, really annoy me. >.<


Combine them?

Coh3n

2010-11-07 17:25:53

Haha cause that would be the smart thing to do. :duh:

That would be the easiest for users also. Good call guys. :p

i luffs yeww

2010-11-07 17:28:08

:) Oh, Coh3n. ^^ Always being so silly.

Gu3st...

2010-11-07 17:57:34

Sorry for spammy post, but:
Lol Coh3n :p

Coh3n

2010-11-07 18:10:02

Yeah yeah laugh all you want guys. :p

Wizzup?

2010-11-07 18:39:18

From: Coh3n
Yeah yeah laugh all you want guys. :p


I didn't think of it before I posted either. It was just a - *snap* oh! that should work - moment :)

Coh3n

2010-11-07 19:31:20

From: Wizzup?
I didn't think of it before I posted either. It was just a - *snap* oh! that should work - moment :)

I just tried to do it, and I don't think it will.

The player remote includes files from MSI, and if there is no MSI, the extension won't compile, and AFAIK I can't do

if (FileExists()) then
{$i MSI/Globals.simba}
:(

i luffs yeww

2010-11-07 19:50:10

Use IFDEFs?

Coh3n

2010-11-07 23:11:50

From: i luffs yeww
Use IFDEFs?

I'm not sure if you can. I would need to download MSI first, then use a define, then recompile so the remote would work.

I think I figured out how to loop through the menu items, though. :)

Coh3n

2010-11-07 23:50:01

Hopefully someone can help me out here. I keep getting "Period Expected".

for i := 0 to High(Simba_MainMenu.Items) do
begin
if (Simba_MainMenu.Items[i].Caption = 'MSI') then // Error here
begin
Writeln('MSI menu item already exists!');
Break;
end;

if (i = High(Simba_MainMenu.Items)) then
begin
MainMenuItem := TMenuItem.Create(Simba_MainMenu);
MainMenuItem.Caption := 'MSI';
Simba_MainMenu.Items.Add(MainMenuItem);
end;
end;
E: Actually that way wouldn't work because MainMenuItem may not be declared, in which case the rest of the menu items wouldn't be added. :(

E2: I'd like to find a way to do this. I would like to have the option to add more MSI menu items without having to create an entire new menu. I have this idea where there would be an option to run MSI (MSI > Run) and BAM, the form would pop up. All you'd have to do is open Simba and choose the option from the menu. Simple as that.

E3: I've managed to get them to add to the same menu, but whichever extension I enable last, will result in a "Can't call proc" error, even though it still works? There are still a few things I want to change, but I think I'll be able to get it working soon. Also, anyone know how to show a "break" in the menu? Like in under tools, there's a "break" in between Update and Settings, and DTM Editor and Associate File Extensions.

Thanks. :)

Wizzup?

2010-11-08 10:47:03

If you have both the extensions I can investigate the Could not call proc error. And a break in there… It has a name, probably seperator. Not sure how you'd create it. We'll get to that.

Coh3n

2010-11-08 12:19:25

From: Wizzup?
If you have both the extensions I can investigate the Could not call proc error. And a break in there… It has a name, probably seperator. Not sure how you'd create it. We'll get to that.

Attached both. Now that I figured out how to use the menu items, I can loop through them (in case MSI isn't the 6th item), so I'll have to do that later.

Thanks, Wizz. :)

E: Uploaded new ones. I tried debugging msi.sex to see what may be causing the error, but it's successfully going through the whole Init procedure, so I'm not sure. Thanks again.

Dgby714

2010-12-19 02:35:05

The ones I've attached have been cleaned up by me, They work together.

Tho I cant test Player Remote as I have never used MSI….

New FindMSIMenu:
procedure FindMSIMenu;
var
I: integer;
begin
for I := 0 to Simba_MainMenu.Items.Count - 1 do
if (Simba_MainMenu.Items.Items[i].Caption = 'MSI') then
begin
MSIMenu := Simba_MainMenu.Items.Items[i];
Exit;
end;

MSIMenu := TMenuItem.Create(Simba_MainMenu);
MSIMenu.Caption := 'MSI';
MSIMenu.Visible := False;
Simba_MainMenu.Items.Add(MSIMenu);
end;

Alt:
function FindMSIMenu: TMenuItem;
var
I: integer;
begin
for I := 0 to Simba_MainMenu.Items.Count - 1 do
if (Simba_MainMenu.Items.Items[i].Caption = 'MSI') then
begin
Result := Simba_MainMenu.Items.Items[i];
Exit;
end;

Result := TMenuItem.Create(Simba_MainMenu);
Result.Caption := 'MSI';
Result.Visible := False;
Simba_MainMenu.Items.Add(Result);
end;

procedure Init;
begin
MSIMenu := FindMSIMenu;

How to create a Separator:
program Separator;
var
Separator: TMenuItem;

begin
Separator := TMenuItem.Create(nil);
Separator.Caption := '-';
end.

Coh3n

2010-12-21 01:35:29

That's awesome I'm glad you got them to work without error; however, the player remote doesn't show any of the components, it's just a plain white window. Also, when I enabled the remote, the MSI menu only showed "Player Remote". It no longer had "Automatically Update", "Update" and "Check for Updates". I don't really know what you changed as I didn't actually write the remote, but I'm sure it was a small technical error.

Thanks again I appreciate it. With these working properly, and the form to be done soon, setting up MSI will be the easiest script to setup. :)

Dgby714

2010-12-21 01:40:14

From: Coh3n
That's awesome I'm glad you got them to work without error; however, the player remote doesn't show any of the components, it's just a plain white window. Also, when I enabled the remote, the MSI menu only showed "Player Remote". It no longer had "Automatically Update", "Update" and "Check for Updates". I don't really know what you changed as I didn't actually write the remote, but I'm sure it was a small technical error.

Thanks again I appreciate it. With these working properly, and the form to be done soon, setting up MSI will be the easiest script to setup. :)


Thats weird… When I enable the remote it just appends Player Remote to the end of the menu =/
I can't test to see if the remote works though….

Edit: http://temp.ionoone.com/msi.png

Did you update both msi.sex and the player remote from my attachments?
Then test disabling and enabling them in different combos.

Coh3n

2010-12-21 01:51:15

From: Dgby714
Thats weird… When I enable the remote it just appends Player Remote to the end of the menu =/
I can't test to see if the remote works though….

Edit: http://temp.ionoone.com/msi.png

Did you update both msi.sex and the player remote from my attachments?
Then test disabling and enabling them in different combos.

Sorry, my mistake. Msi.sex got disabled somehow. It's fine now. Also for the player remote, if you extract the attached folder in your Simba/Includes folder, you can click MSI > Player Remote and it should pop up. :)

Oh and I just noticed that this comes up in the debug when I enable msi.sex.

Extension Enabled
A new MSI version is available!

What should happen after that is a pop up appear asking if you want to update MSI now. No such box appears anymore. I don't know if you changed something, or I'm just remembering it wrong, but either way, I think that pop up should show. :p

Dgby714

2010-12-21 01:57:53

From: Coh3n
Sorry, my mistake. Msi.sex got disabled somehow. It's fine now. Also for the player remote, if you extract the attached folder in your Simba/Includes folder, you can click MSI > Player Remote and it should pop up. :)

Oh and I just noticed that this comes up in the debug when I enable msi.sex.

What should happen after that is a pop up appear asking if you want to update MSI now. No such box appears anymore. I don't know if you changed something, or I'm just remembering it wrong, but either way, I think that pop up should show. :p


Ah it was annoying me so temp disabled it and forgot to reenable =/ I also though of something to change a few mins ago so ill be attaching a new msi.sex and maybe a new remote as if what your saying it true it doesnt work =/

Coh3n

2010-12-21 02:09:54

From: Dgby714
Ah it was annoying me so temp disabled it and forgot to reenable =/ I also though of something to change a few mins ago so ill be attaching a new msi.sex and maybe a new remote as if what your saying it true it doesnt work =/

Okay thanks a lot and like I said, I don't even know everything you changed in the remote since I didn't know what it looked like beforehand, so I'm kind of useless. :p

Dgby714

2010-12-21 02:19:50

From: Coh3n
Okay thanks a lot and like I said, I don't even know everything you changed in the remote since I didn't know what it looked like beforehand, so I'm kind of useless. :p


Ok Done!

Coh3n

2010-12-23 01:40:23

From: Dgby714
Ok Done!

Awesome! I don't have time to test it now but I trust you.. :) The holidays are busy so I'll be sure to "officially" release these when I get back to BC and have more time. I really appreciate it. :)

Dgby714

2010-12-23 03:12:00

Ive been working on a file you can {.include} into a Extension to easily make a updater.

Here's what msi.sex would look like with it
Note: This currently wont work as OpenScriptEx is not in the public Simba.
program MSIUpdater;

{.INCLUDE ..\Extensions\Updater.sei}

var
MSI: integer;

procedure InstallMSI(Sender: TObject); forward;

procedure OpenMSI(Sender: TObject);
begin
if (not (FileExists(IncludePath + 'msi\RunMe.simba'))) then
begin
WriteLn('MSI: Couldn''t find MSI!');
TMenuItem(Sender).Caption := 'Install';
TMenuItem(Sender).OnClick := @InstallMSI;
Exit;
end;

WriteLn('Opening MSI...');
OpenScriptEx(IncludePath + 'msi\RunMe.simba');
end;

procedure InstallMSI(Sender: TObject);
begin
Tick(UpdaterArr[MSI].CheckMenuItem);
if (FileExists(IncludePath + 'msi\RunMe.simba')) then
begin
TMenuItem(Sender).Caption := 'Open';
TMenuItem(Sender).OnClick := @OpenMSI;
end;
end;

function MoveMenuItem(Menu: TMenuItem; FromIndex, ToIndex: integer): TMenuItem;
var
TempMenuItem: TMenuItem;
begin
if (InRange(FromIndex, 0, Menu.Count - 1) and InRange(ToIndex, 0, Menu.Count - 1)) then
begin
TempMenuItem := Menu.Items[FromIndex];
Menu.Delete(FromIndex);
Menu.Insert(ToIndex, TempMenuItem);
Result := Menu.Items[ToIndex];
end;
end;

function GetIndex(Menu, MenuItem: TMenuItem): integer;
begin
for Result := 0 to Menu.Count - 1 do
if (Menu.Items[Result] = MenuItem) then
Exit;
Result := -1;
end;

function RunMenuMSI(const Blank: string; const ID: integer): boolean;
var
RunMenuItem: TMenuItem;
begin
RunMenuItem := MoveMenuItem(UpdaterArr[ID].MainMenu, GetIndex(UpdaterArr[ID].MainMenu, GetMenuByName('Open', UpdaterArr[ID].MainMenu)), 0);
RunMenuItem.OnClick := @OpenMSI;
if (not (FileExists(IncludePath + 'msi\RunMe.simba'))) then
begin
RunMenuItem.Caption := 'Install';
RunMenuItem.OnClick := @InstallMSI;
end;
RunMenuItem.Visible := True;
end;

procedure Init;
begin
if (AddUpdater('MSI', 'http://wizzup.org/static/srl/msi.tar.bz2', 'http://wizzup.org/static/srl/msi_version', IncludePath, True, True, MSI)) then
begin
UpdaterArr[MSI].Hooks[ATTACH_HOOK] := @RunMenuMSI;
end;
end;

function GetName: string;
begin
Result := 'MSI Updater';
end;

function GetVersion: string;
begin
Result := '0.1';
end;

begin
end.

This creates a menu like
MSI
- Open/Install (Depends on FileExists(RunMe.simba))
- Update
- Check for Update
- Automaticaly ...
-- [&#8730;] Update
-- [&#8730;] Check for Updates
- Settings
-- Timer Interval: 10000 (Click to change)

Gu3st...

2010-12-23 06:10:09

Woah, that's awesome Dgby714! Thanks for contributing :)

E: 714 :o

Dgby714

2010-12-23 09:18:22

From: Zyt3x
Woah, that's awesome Dgby714! Thanks for contributing :)


lol, I have commited OpenScriptEx to Simba so it should be in the next release.

If you'd like to test it I've attached a msi.sex with Updater.sei in it and a few things commented so you dont need OpenScriptEx

Gu3st...

2010-12-23 10:58:05

From: Dgby714
lol, I have commited OpenScriptEx to Simba so it should be in the next release.

If you'd like to test it I've attached a msi.sex with Updater.sei in it and a few things commented so you dont need OpenScriptEx
Oh wow! :o
I have no idea why I wrote 127 instead of 714…. Is there anyone on the forum that ends with 127? :p

I'm sorry I can't test.. Lot's of stuff happening now around Christmas you know

Dgby714

2010-12-23 13:51:55

From: Zyt3x
Oh wow! :o
I have no idea why I wrote 127 instead of 714…. Is there anyone on the forum that ends with 127? :p

I'm sorry I can't test.. Lot's of stuff happening now around Christmas you know


O.o omg I didn't notice we were that close to Christmas…. >..<

Coh3n

2010-12-25 00:52:36

Dgby,

Awesome! With OpenScriptEx, is it possible to add RunScript? So instead of opening the file, it actually runs the script? I suggested that a while ago and Wizzup said it was possible. :)

My idea for that would be for the MSI Form to pop up once you hit MSI > Run.

Dgby714

2010-12-25 03:40:11

From: Coh3n
Dgby,

Awesome! With OpenScriptEx, is it possible to add RunScript? So instead of opening the file, it actually runs the script? I suggested that a while ago and Wizzup said it was possible. :)

My idea for that would be for the MSI Form to pop up once you hit MSI > Run.


Yes, ill write up RunScript and RunScriptEx, in a min. They will function just as OpenScript and OpenScriptEx do but running the script after opening its tab.

Coh3n

2010-12-25 09:31:47

From: Dgby714
Yes, ill write up RunScript and RunScriptEx, in a min. They will function just as OpenScript and OpenScriptEx do but running the script after opening its tab.

<3

Thank you very very much! :)

Dgby714

2010-12-25 09:48:15

From: Coh3n
<3

Thank you very very much! :)


I changed my mind and I've sent a pull request for -
procedure OpenScript(Name, Data: string; Run: boolean);
procedure OpenScriptEx(Filename: string; Run: boolean);

Coh3n

2010-12-25 09:49:27

From: Dgby714
I changed my mind and I've sent a pull request for -
procedure OpenScript(Name, Data: string; Run: boolean);
procedure OpenScriptEx(Filename: string; Run: boolean);

That works too. :)

Gu3st...

2010-12-25 17:54:32

Awesome! :D
Now we can get a MSI -> Run

Coh3n

2010-12-25 17:58:58

Yeah I'll be pushing to get that, the extensions and the form done after the holidays.

Coh3n

2010-12-28 03:50:01

Okay, finally back from holidays. :)

Dgby, I've attached the two versions of the extensions that are working for me (the most recent msi.sex you've uploaded, and the player_remote.sex you updated at the top of the page). I have a few comments. :)
  1. What's Timer Interval? :o The time it waits before checking for an update? If so, is

  2. No MSI update available.
    supposed to show up in the debug every 10 seconds? Because it doesn't. :p
  3. I'd rather the "Install" menu item you have be kind of split into two. "Open" and "Run" where "Open" will open RunMe.simba, and "Run" will actually run it. :)
  4. If it's not too much to ask, maybe msi.sex can be setup so that as soon as the next version of Simba is released (with OpenScriptEx/OpenScript), all I have to do it uncomment a couple lines and it'll work. That will save me from bugging you later. :)

Thanks again,
Cohen

Dgby714

2010-12-28 03:55:12

It will only say "No MSI update available" when you check it from the menu.

We can have both a Open and Run if you'd like.

The only line that wont work atm is OpenScriptEx.

Coh3n

2010-12-28 03:57:07

From: Dgby714
It will only say "No MSI update available" when you check it from the menu.

Okay great. :)

From: Dgby714

We can have both a Open and Run if you'd like.

That would be perfect. I know they'll both be useful.

From: Dgby714

The only line that wont work atm is OpenScriptEx.

So basically, once that line is uncommented, it'll open an run it? :)

I love how simple it is. :D

Coh3n

2010-12-29 14:30:00

Okay, so I'm not sure what I did, but I tried to add what you did here -> http://paste.villavu.com/show/217/. It enables the extensions, but the "Update is available" windows doesn't pop up again. :o


program MSIUpdater;

//Start of Updater.sei
const
ATTACH_HOOK = 0;
CHECK_FOR_UPDATE = 1;
BEFORE_UPDATE = 2;
SUCCESS_UPDATE = 3;
AFTER_UPDATE = 4;

type
THookFunc = function(Param1: string; Param2: integer): boolean;
THookArr = array[ATTACH_HOOK..AFTER_UPDATE] of THookFunc;
TUpdater = record
Name, URL, VersionURL, Folder: string;
CreateMenu, NoMenuTimer: boolean;
Hooks: THookArr;
MainMenu, UpdateMenuItem, CheckMenuItem: TMenuItem;
AutoMenu, AUpdateMenuItem, ACheckMenuItem: TMenuItem;
SettingsMenu, TimerMenuItem: TMenuItem;
Timer: TTimer;
end;
TUpdaterArr = array of TUpdater;

var
UpdaterArr: TUpdaterArr;
Locked: boolean;

function GetOVersion(Updater: TUpdater): integer;
begin
Result := StrToIntDef(ExtractFromStr(GetPage(Updater. VersionURL), Numbers), -1);
end;

function GetLVersion(Updater: TUpdater): integer;
begin
Result := StrToIntDef(ExtractFromStr(Settings.GetKeyValueDef(Updater.Name + '_Version', '-1'), Numbers), -1);
end;

procedure Update(const Sender: TObject; const I: integer);
var
Cont, ExCont: string;
Version: integer;
begin
with UpdaterArr[I] do
begin
if (Locked) then
Exit;

if (Hooks[BEFORE_UPDATE] <> nil) then
if (not (Hooks[BEFORE_UPDATE]('', I))) then
Exit;

Locked := True;

if (not (Sender = UpdateMenuItem)) then
if (not (MessageDlg(Name + ' Updater', 'Updates are available! Do you wish to Update now?', mtConfirmation, [mbNo, mbYes], 0) = mrYes)) then
Exit;

WriteLn(Name + ' Updater: Local Version - "' + IntToStr(GetLVersion(UpdaterArr[I])) + '" | Remote Version = "' + IntToStr(GetOVersion(UpdaterArr[I])) + '"');
WriteLn(Name + ' Updater: Update File - "' + URL + '"');
WriteLn(Name + ' Updater: Downloading...');
Cont := GetPage(URL);
if (Cont <> '') then
begin
WriteLn(Name + ' Updater: Decompressing...');
if (DecompressBZip2(Cont, ExCont, 4096)) then
begin
WriteLn(Name + ' Updater: Extracting...');
if (UnTarEx(ExCont, Folder, True)) then
begin
if (Hooks[SUCCESS_UPDATE] <> nil) then
if (not (Hooks[SUCCESS_UPDATE](ExCont, I))) then
begin
WriteLn(Name + ' Update ERROR: Kill recieved from Updater.');
Exit;
end;
Version := GetOVersion(UpdaterArr[I]);
Settings.SetKeyValue(Name + '_Version', IntToStr(Version));
WriteLn(Name + ' Update Successful! (' + IntToStr(Version) + ')');
if (CreateMenu) then
UpdateMenuItem.Enabled := False;
end else
WriteLn(Name + ' Update ERROR: Couldn''t extract the tar archive.');
end else
WriteLn(Name + ' Update ERROR: Couldn''t decompress the bzip archive.');
end else
WriteLn(Name + ' Update ERROR: Didn''t recieve any data from Update URL.');

Locked := False;
if (Hooks[AFTER_UPDATE] <> nil) then
if (not (Hooks[AFTER_UPDATE]('', I))) then
Exit;
end;
end;

procedure Tick(const Sender: TObject);
var
I: integer;
Name: string;
begin
if (Locked) then
Exit;

for I := 0 to High(UpdaterArr) + 1 do
if (I = High(UpdaterArr) + 1) then
Exit
else
case Sender of
UpdaterArr[I].Timer: begin
Name := 'Timer';
Break;
end;
UpdaterArr[I].CheckMenuItem: begin
Name := 'Check';
Break;
end;
end;

if (UpdaterArr[I].Hooks[CHECK_FOR_UPDATE] <> nil) then
if (not (UpdaterArr[I].Hooks[CHECK_FOR_UPDATE](Name, I))) then
Exit;

if (GetLVersion(UpdaterArr[I]) < GetOVersion(UpdaterArr[I])) then
begin
WriteLn('You have a new update available for ' + UpdaterArr[I].Name + '!');

if (UpdaterArr[I].CreateMenu) then
UpdaterArr[I].UpdateMenuItem.Enabled := True;

if (not (UpdaterArr[I].CreateMenu)) then
Update(UpdaterArr[I].Timer, I)
else
if (UpdaterArr[I].AUpdateMenuItem.Checked) then
Update(UpdaterArr[I].Timer, I)
end else
if (Sender = UpdaterArr[I].CheckMenuItem) then
WriteLn('No ' + UpdaterArr[I].Name + ' update available.');
end;

procedure Click(Sender: TObject);
var
I: integer;
Value: string;
begin
for I := 0 to High(UpdaterArr) do
case Sender of
UpdaterArr[I].UpdateMenuItem: Update(Sender, I);
UpdaterArr[I].CheckMenuItem: Tick(Sender);
UpdaterArr[I].AUpdateMenuItem, UpdaterArr[I].ACheckMenuItem: begin
TMenuItem(Sender).Checked := (not (TMenuItem(Sender).Checked));
UpdaterArr[I].Timer.Enabled := UpdaterArr[I].ACheckMenuItem.Checked;
Settings.SetKeyValue(UpdaterArr[I].Name + '_' + ExtractFromStr(TMenuItem(Sender).Caption, Letters), BoolToStr(TMenuItem(Sender).Checked));
end;
UpdaterArr[I].TimerMenuItem: begin
if (InputQuery(UpdaterArr[I].Name + ' Updater', 'What would you like the Timer Interval to be? (1000 - 25000)', Value)) then
begin
Value := ExtractFromStr(Value, Numbers);
if ((IntToStr(StrToIntDef(Value, -1)) = Value) and InRange(StrToIntDef(Value, -1), 1000, 25000)) then
begin
UpdaterArr[I].Timer.Interval := StrToIntDef(Value, UpdaterArr[I].Timer.Interval);
UpdaterArr[I].TimerMenuItem.Caption := 'Timer Interval: ' + IntToStr(UpdaterArr[I].Timer.Interval);
Settings.SetKeyValue(UpdaterArr[I].Name + '_TimerInterval', IntToStr(UpdaterArr[I].Timer.Interval));
end;
end;
end;
end;
end;

function GetMenuByName(const Name: string; Menu: TMenuItem): TMenuItem;
var
I: integer;
begin
for I := 0 to Menu.Count - 1 do
if (Lowercase(Menu.Items[i].Caption) = Lowercase(Name)) then
begin
Result := Menu.Items[i];
Exit;
end;

Result := TMenuItem.Create(Menu);
Result.Caption := Name;
Result.Visible := False;
Menu.Add(Result);
end;

function IsUpdateMenu(const Menu: TMenuItem): boolean;
var
I: integer;
begin
for I := 0 to Menu.Count - 1 do
if (Menu.Items[I].Caption = 'Update') then
Result := True;
end;

function AddUpdater(const IncludeName, UpdateURL, VerURL, ExFolder: string; const ShowMenu, TimerIfNoMenu: boolean; var ID: integer): boolean;
begin
ID := Length(UpdaterArr);
SetLength(UpdaterArr, ID + 1);
with UpdaterArr[ID] do
begin
Name := IncludeName;
URL := UpdateURL;
VersionURL := VerURL;
Folder := ExFolder;
CreateMenu := ShowMenu;
NoMenuTimer := TimerIfNoMenu

if (CreateMenu) then
begin
MainMenu := GetMenuByName(Name, Simba_MainMenu.Items);
if (IsUpdateMenu(MainMenu)) then
Exit;

UpdateMenuItem := TMenuItem.Create(MainMenu);
UpdateMenuItem.Caption := 'Update';
UpdateMenuItem.OnClick := @Click;
UpdateMenuItem.Enabled := False;
MainMenu.Add(UpdateMenuItem);

CheckMenuItem := TMenuItem.Create(MainMenu);
CheckMenuItem.Caption := 'Check for Update';
CheckMenuItem.OnClick := @Click;
MainMenu.Add(CheckMenuItem);

AutoMenu := TMenuItem.Create(MainMenu);
AutoMenu.Caption := 'Automaticaly ...';
MainMenu.Add(AutoMenu);

AUpdateMenuItem := TMenuItem.Create(AutoMenu);
AUpdateMenuItem.Caption := 'Update';
AUpdateMenuItem.OnClick := @Click;
AUpdateMenuItem.Checked := (LowerCase(Settings.GetKeyValueDef(Name + '_Update', 'true')) = 'true');
AutoMenu.Add(AUpdateMenuItem);

ACheckMenuItem := TMenuItem.Create(AutoMenu);
ACheckMenuItem.Caption := 'Check for Updates';
ACheckMenuItem.OnClick := @Click;
ACheckMenuItem.Checked := (LowerCase(Settings.GetKeyValueDef(Name + '_CheckforUpdates', 'true')) = 'true');
AutoMenu.Add(ACheckMenuItem);

SettingsMenu := TMenuItem.Create(MainMenu);
SettingsMenu.Caption := 'Settings';
MainMenu.Add(SettingsMenu);

TimerMenuItem := TMenuItem.Create(SettingsMenu);
TimerMenuItem.Caption := 'Timer Interval: ' + ExtractFromStr(Settings.GetKeyValueDef(Name + '_TimerInterval', '10000'), Numbers);
TimerMenuItem.OnClick := @Click;
SettingsMenu.Add(TimerMenuItem);
end;

Timer := TTimer.Create(nil);
Timer.Interval := StrToIntDef(ExtractFromStr(Settings.GetKeyValueDef(Name + '_TimerInterval', '10000'), Numbers), 10000);
if (ShowMenu) then
Timer.Enabled := ACheckMenuItem.Checked
else
Timer.Enabled := NoMenuTimer;
Timer.OnTimer := @Tick;
end;

Result := True;
end;

procedure Attach;
var
I: integer;
begin
for I := 0 to High(UpdaterArr) do
begin
if (UpdaterArr[I].Hooks[ATTACH_HOOK] <> nil) then
UpdaterArr[I].Hooks[ATTACH_HOOK]('', I);

if (UpdaterArr[I].CreateMenu) then
begin
UpdaterArr[I].MainMenu.Visible := True;
UpdaterArr[I].Timer.Enabled := UpdaterArr[I].ACheckMenuItem.Checked;
end else
UpdaterArr[I].Timer.Enabled := UpdaterArr[I].NoMenuTimer;
WriteLn(UpdaterArr[I].Name + ' Updater Enabled!');
end;
end;

procedure Detach;
var
I: integer;
begin
for I := High(UpdaterArr) downto 0 do
begin
if (UpdaterArr[I].CreateMenu) then
UpdaterArr[I].MainMenu.Visible := False;
UpdaterArr[I].Timer.Enabled := False;
WriteLn(UpdaterArr[I].Name + ' Updater Disabled.');
end;
end;
//End of Updater.sei

var
MSI: integer;

procedure ClickMSI(Sender: TObject);
begin
if (not (FileExists(IncludePath + 'msi\RunMe.simba'))) then
begin
WriteLn('MSI: Couldn''t find MSI!');
Exit;
end;

if (TMenuItem(Sender).Caption = 'Run') then
WriteLn('Running MSI...')
else
WriteLn('Opening MSI...');
//OpenScriptEx(IncludePath + 'msi\RunMe.simba', (TMenuItem(Sender).Caption = 'Run'));
end;

function MoveMenuItem(Menu: TMenuItem; FromIndex, ToIndex: integer): TMenuItem;
var
TempMenuItem: TMenuItem;
begin
if (InRange(FromIndex, 0, Menu.Count - 1) and InRange(ToIndex, 0, Menu.Count - 1)) then
begin
TempMenuItem := Menu.Items[FromIndex];
Menu.Delete(FromIndex);
Menu.Insert(ToIndex, TempMenuItem);
Result := Menu.Items[ToIndex];
end;
end;

function GetIndex(Menu, MenuItem: TMenuItem): integer;
begin
for Result := 0 to Menu.Count - 1 do
if (Menu.Items[Result] = MenuItem) then
Exit;
Result := -1;
end;

function MenuMSI(const Blank: string; const ID: integer): boolean;
var
MenuItem: array[0..1] of TMenuItem;
Names: array[0..1] of array[0..1] of string;
I: integer;
begin
Names[0] := ['Open', 'Update'];
Names[1] := ['Run', 'Open'];
for I := 0 to 1 do
begin
MenuItem[I] := MoveMenuItem(UpdaterArr[ID].MainMenu, GetIndex(UpdaterArr[ID].MainMenu, GetMenuByName(Names[I][0], UpdaterArr[ID].MainMenu)), GetIndex(UpdaterArr[ID].MainMenu, GetMenuByName(Names[I][1], UpdaterArr[ID].MainMenu)));
MenuItem[I].OnClick := @ClickMSI;
MenuItem[I].Visible := True;
end;
end;

procedure Init;
var
MSI: integer;
begin
if (AddUpdater('MSI', 'http://wizzup.org/static/srl/msi.tar.bz2', 'http://wizzup.org/static/srl/msi_version', IncludePath, True, True, MSI)) then
begin
//UpdaterArr[MSI].Hooks[ATTACH_HOOK] := @MenuMSI;
end;
end;

function GetName: string;
begin
Result := 'MSI Updater';
end;

function GetVersion: string;
begin
Result := '0.1';
end;

begin
end.

E: Dgby, you said something about you changing some things around so that may not even be the version you had.

Gu3st...

2010-12-29 18:36:41

Tried uncommenting the line in Init; ?

Coh3n

2010-12-29 18:40:38

From: Zyt3x
Tried uncommenting the line in Init; ?

He said it was supposed to be commented because it wouldn't work in the current version of Simba. But no, I haven't tried. :p

Gu3st...

2010-12-29 18:45:54

From: Dgby714
The only line that wont work atm is OpenScriptEx.
Try it out :)

Coh3n

2010-12-30 14:38:50

From: Zyt3x
Try it out :)

I'm figuring it out later tonight. I have to go to hockey now.

Okay so it's all done and working great (along with an updated msi_player_remote.sex, which has been committed to the MSI repository).

Wizzup, would you ever consider adding msi.sex to the Simba extensions so users don't have to download it separately?

Wizzup?

2011-01-01 07:25:46

Yes, although I am sure someone was working on an all-in extension. Dgby714?

Gu3st...

2011-01-01 10:02:04

That was Dgby714, yeah..
How's it coming along, Dgby714?

Coh3n

2011-01-01 13:31:02

Yeah he made an Updater.sex (it's actually in msi.sex). The actual msi.sex part it like 20ish lines. So I'd say the actual updater is done, it just needs to be made into all-in-one.

Wizzup?

2011-01-29 18:27:45

This is in Simba 0.96 (RC) :)
So, fixed.