Timer
2010-08-25 19:32:50
Don't think I like Simba, I honestly don't. 3Garrett3 asked me to make this.
2010-08-25 19:32:50
2010-08-25 19:57:35
2010-08-25 20:11:12
2010-08-25 21:46:38
2010-08-26 00:32:33
From: MylesMadness
Be said he was going to, but he never did
2010-08-26 00:38:11
2010-08-26 05:17:02
2010-08-26 08:19:01
From: MylesMadness
Be said he was going to, but he never did
From: Coh3n
Doesn't it just have to be written similar to reflection and srl.sex? There shouldn't be much else to it.
2010-08-26 14:54:04
2010-08-26 15:03:44
From: MylesMadness
Oh, I never did finish that combind .sex thingy. I'll do that today
2010-08-26 15:22:10
2010-08-26 15:26:24
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.
2010-08-26 16:08:43
2010-08-27 16:15:43
From: Wizzup?
Also, I guess you need all the files from the repos?
2010-08-29 11:07:39
2010-08-29 14:24:54
From: Wizzup?
Added to http://wizzup.org/static/srl/
Also fixed a bug with the reflection-tar. :)
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.
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)
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.
2010-08-29 16:38:53
Writeln('From now on you will be alerted when your MSI version is out of date! - Timer!');
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?
2010-08-30 04:56:52
From: holic
Worked for me, now on rev 240
2010-08-30 14:52:34
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.
2010-09-16 23:46:57
2010-09-21 09:43:12
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?
2010-09-22 05:09:19
From: Coh3n
Sorry, what's the version key and how do I delete it? :o
2010-09-22 13:24:20
From: Wizzup?
Tools -> Settings. Extensions -> ExtensionsN -> Delete the one with the path that looks like the MSI one. ;)
if (MenuExists('MSI')) then
Add('Player Remote')
else begin
CreateMenu('MSI');
Add('Player Remote');
end;
2010-10-25 12:32:43
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. :)
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. :)
2010-11-06 17:59:09
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.
2010-11-07 17:08:11
2010-11-07 17:12:46
2010-11-07 17:19:52
2010-11-07 17:19:57
From: i luffs yeww
It overrides it, iirc.
2010-11-07 17:21:01
From: Wizzup?
Give the menu bar a different name? ;)
2010-11-07 17:21:49
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?
2010-11-07 17:23:47
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. >.<
2010-11-07 17:25:53
2010-11-07 17:28:08
2010-11-07 17:57:34
2010-11-07 18:10:02
2010-11-07 18:39:18
From: Coh3n
Yeah yeah laugh all you want guys. :p
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 :)
if (FileExists()) then
{$i MSI/Globals.simba}
:(
2010-11-07 19:50:10
2010-11-07 23:11:50
From: i luffs yeww
Use IFDEFs?
2010-11-07 23:50:01
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. :(2010-11-08 10:47:03
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.
2010-12-19 02:35:05
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;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;program Separator;
var
Separator: TMenuItem;
begin
Separator := TMenuItem.Create(nil);
Separator.Caption := '-';
end.
2010-12-21 01:35:29
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. :)
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.
Extension Enabled
A new MSI version is available!
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
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 =/
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
2010-12-23 01:40:23
From: Dgby714
Ok Done!
2010-12-23 03:12:00
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.MSI
- Open/Install (Depends on FileExists(RunMe.simba))
- Update
- Check for Update
- Automaticaly ...
-- [√] Update
-- [√] Check for Updates
- Settings
-- Timer Interval: 10000 (Click to change)
2010-12-23 06:10:09
2010-12-23 09:18:22
From: Zyt3x
Woah, that's awesome Dgby714! Thanks for contributing :)
2010-12-23 10:58:05
From: Dgby714Oh wow! :o
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
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
2010-12-25 00:52:36
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.
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.
2010-12-25 09:48:15
From: Coh3n
<3
Thank you very very much! :)
procedure OpenScript(Name, Data: string; Run: boolean);
procedure OpenScriptEx(Filename: string; Run: boolean);
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);
2010-12-25 17:54:32
2010-12-25 17:58:58
2010-12-28 03:50:01
No MSI update available.
supposed to show up in the debug every 10 seconds? Because it doesn't. :p
2010-12-28 03:55:12
2010-12-28 03:57:07
From: Dgby714
It will only say "No MSI update available" when you check it from the menu.
From: Dgby714
We can have both a Open and Run if you'd like.
From: Dgby714
The only line that wont work atm is OpenScriptEx.
2010-12-29 14:30:00
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.
2010-12-29 18:36:41
2010-12-29 18:40:38
From: Zyt3x
Tried uncommenting the line in Init; ?
2010-12-29 18:45:54
From: Dgby714Try it out :)
The only line that wont work atm is OpenScriptEx.
2010-12-30 14:38:50
From: Zyt3x
Try it out :)
2011-01-01 07:25:46
2011-01-01 10:02:04
2011-01-01 13:31:02
2011-01-29 18:27:45