|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
MIRC Popup File Parser.Need Help.
Hi every one.This is the menu parser for mIRC which parses the mirc Popup.ini file to Menu.
Well if you Had ever used mirc perhaps you edit the popup.ini file to add or remove popup menues. i had enclosed my app which has a little bug in it and i want help to create menu's sub items and subitems of subitems. here is an example of popup.ini file; { Info:/uwho $1 {This will create a menu} - {This will Create a Menu seperator} Control {This Will Again create a menu} .Ignore:/ignore $$1 1 {This will create a sub menu of Control's menu} .Unignore:/ignore -r $$1 1 {This will create a sub menu of the ignore's Sub Menu} ..Op:/mode # +ooo $$1 $2 $3 {and This will create a sub menu of the ignore's,UnIgnore's SubMenu} } a dot(.) creates a sub menu of the menu or sub menu item.Now i can Parse Menus and Sub Menus but not Sub Mnues of the sub menues Correctly. Could you please help me out.Plz plz plz.Or you can change the code which parses the menu correctly.i can't get off this problem. plz help me. Below is the code of how to parse a menu.Please make it working correctly.Thanks in advance. But Before That Just add a bit button and a TPopupMenu Component unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, ActnPopup, StdCtrls, Buttons; type TForm2 = class(TForm) Pop: TPopupActionBar; BitBtn1: TBitBtn; Procedure ParsePopupFile(PopupFile:String); procedure BitBtn1Click(Sender: TObject); procedure FormCreate(Sender: TObject); Function StrLeft(const sData: string; nLength: integer): string; Function StrMid(const sData: string; nStart: integer): string; Function InStr(const sData, sFind: string): integer; procedure OnMenuClick(Sender: TObject); private { Private declarations } public { Public declarations } SubMenu:TPopUpMenu; end; var Form2: TForm2; implementation {$R *.dfm} procedure TForm2.BitBtn1Click(Sender: TObject); Var i:integer; begin ParsePopupFile(ExtractFilePath(ParamStr(0)) + 'Popup.ini'); Self.PopupMenu := SubMenu; for i := 0 to SubMenu.Items.Count - 1 do Begin //SubMenu.Items[i].OnClick := OnClick; End; end; procedure TForm2.OnMenuClick(Sender: TObject); Begin if TMenuItem(Sender).Count > 0 then Exit; SHowMessage(TMenuItem(Sender).hint); End; procedure TForm2.FormCreate(Sender: TObject); begin SubMenu := TPopupMenu.Create(Self); end; Function TForm2.StrLeft(const sData: string; nLength: integer): string; Begin result := Copy(sData, 1, nLength); end; Function TForm2.StrMid(const sData: string; nStart: integer): string; Begin result := Copy(sData, nStart, Length(sData) - (nStart - 1)); end; Function TForm2.InStr(const sData, sFind: string): integer; begin result := Pos(sFind, sData); end; Procedure TForm2.ParsePopupFile(PopupFile:String); Var sCaption, sCommand : String; Header : Boolean; Str:TStringList; X,Y,I:Integer; StrLine:String; A,B:TMenuItem; Begin Str := TStringList.Create; Str.LoadFromFile(PopupFile); for I := 0 to Str.Count - 1 do Begin X := 0; StrLine := Str.Strings[i]; If (Strleft(strLine, 1) <> ';') And (strLine <> '') Then Begin while Strleft(strLine, 1) = '.' do begin X := X+1; StrLine := StrMid(StrLine,2); end; If InStr(strLine, ':') = 0 Then Header := True Else Header := False; If Header = False Then Begin sCaption := Strleft(strLine, InStr(strLine, ':') - 1); sCommand := StrMid(strLine, InStr(strLine, ':') + 1); End Else Begin sCaption := strLine; sCommand := ''; End; If X = 0 Then Begin A := TMenuItem.Create(Self); //it creates a MENU item A.Caption := sCaption; A.Hint := sCommand; A.OnClick := onMenuclick; SubMenu.Items.Add(A); B := A AS TMenuitem; End Else Begin if X = 1 then Begin A := TMenuItem.Create(Self); //it creates a SUBMENU item A.Caption := sCaption; A.Hint := sCommand; A.OnClick := OnMenuClick; SubMenu.Items[SubMenu.Items.Count - 1 - (x-1)].Add(A); B := A As TMenuItem; End Else Begin A := TMenuItem.Create(Self); //it creates a SUBMENU item A.Caption := sCaption; A.Hint := sCommand; A.OnClick := OnMenuClick; B.Add(A); B:=A as TMenuitem; End; End; End; End; End; end. And here is the code for Popup.ini Just Create a text file rename it to popup.ini and put this code in it and saveit, ; You can make how many submenus you want!! ; I hope you enjoy it ; PLEASE VOTE FOR ME IF YOU LIKE IT Info:/uwho $1 Whois:/whois $$1 Query:/query $$1 - Control .Ignore:/ignore $$1 1 .Unignore:/ignore -r $$1 1 ..Op:/mode # +ooo $$1 $2 $3 ..Deop:/mode # -ooo $$1 $2 $3 .Voice:/mode # +vvv $$1 $2 $3 .Devoice:/mode # -vvv $$1 $2 $3 .Kick:/kick # $$1 .Kick (why):/kick # $$1 $$?="Reason:" .Ban:/ban $$1 2 .Ban, Kick:/ban $$1 2 | /timer 1 3 /kick # $$1 .Ban, Kick (why):/ban $$1 2 | /timer 1 3 /kick # $$1 $$?="Reason:" CTCP .Ping:/ctcp $$1 ping .Time:/ctcp $$1 time .Version:/ctcp $$1 version DCC .Send:/dcc send $$1 .Chat:/dcc chat $$1 - |
![]() |
| Viewing: Web Development Archives > Mailing Lists > Delphi > MIRC Popup File Parser.Need Help. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|