diff --git a/all/GenerateWryeBashTags.pas b/all/GenerateWryeBashTags.pas index 0c0f6f3..2006362 100644 --- a/all/GenerateWryeBashTags.pas +++ b/all/GenerateWryeBashTags.pas @@ -28,6 +28,8 @@ optionAddTags : Integer; optionOutputLog : Integer; bQuickExit : Boolean; + bFirstProcess : Boolean; + sGuiPlugin : String; function wbIsOblivion: Boolean; @@ -107,19 +109,15 @@ procedure LogError(s: String); function Initialize: Integer; -var - kDescription : IInterface; - kHeader : IInterface; - sBashTags : String; - sDescription : String; - sMasterName : String; - r : IwbMainRecord; - i : Integer; begin sScriptName := 'GenerateWryeBashTags'; // working name sScriptVersion := '1.6.3.0'; sScriptAuthor := 'fireundubh'; sScriptEmail := 'fireundubh@gmail.com'; + bFirstProcess := true; + sGuiPlugin := ''; + + Result := 0; // clear ClearMessages(); @@ -128,6 +126,28 @@ function Initialize: Integer; AddMessage(#10); LogInfo(sScriptName + ' v' + sScriptVersion + ' by ' + sScriptAuthor + ' <' + sScriptEmail + '>'); AddMessage(#10); +end; + +function Process(e: IInterface): integer; +begin + if bFirstProcess then + begin + bFirstProcess := false; + sGuiPlugin := GetFileName(e); + Result := Work(); + end +end; + +function Work: Integer; +var + kDescription : IInterface; + kHeader : IInterface; + sBashTags : String; + sDescription : String; + sMasterName : String; + r : IwbMainRecord; + i : Integer; +begin optionAddTags := mrNo; optionOutputLog := mrYes; @@ -1976,9 +1996,14 @@ function Configure(asCaption: String): IwbFile; btnCancel : TButton; btnOk : TButton; i : Integer; + iGuiPlugin : Integer; kFile : IwbFile; + + sName : String; + begin + Result := nil; frm := TForm.Create(TForm(frmMain)); @@ -2033,14 +2058,25 @@ function Configure(asCaption: String): IwbFile; cbbPlugins.DoubleBuffered := True; cbbPlugins.TabOrder := 2; + iGuiPlugin := -1; for i := 0 to Pred(FileCount) do begin kFile := FileByIndex(i); if IsEditable(kFile) then - cbbPlugins.Items.Add(GetFileName(kFile)); + begin + sName := GetFileName(kFile); + cbbPlugins.Items.Add(sName); + if CompareText(sName, sGuiPlugin) = 0 then + iGuiPlugin := Pred(cbbPlugins.Items.Count); + end; end; - cbbPlugins.ItemIndex := Pred(cbbPlugins.Items.Count); + if iGuiPlugin = -1 then + begin + cbbPlugins.ItemIndex := Pred(cbbPlugins.Items.Count); + end else begin + cbbPlugins.ItemIndex := iGuiPlugin; + end btnOk := TButton.Create(frm); btnOk.Parent := frm;