|
|
|||||||
I love Orca, it's THE most useful tool when editing MSI packages. However opening an MSI package with Orca has one problem, it edits it by default somehow when it opens the package. So seeying no way to prevent this I thought I'd write my own Orca. Currently the only thing it does is READ every table and information of the msi file but next versions will "probably contain edit functions and/or add transforms. Anyway don't hold your breath for it Those familiar with Orca will feel right at home since it looks more or less the same. Without further ado: Code: $=SetOption('Explicit','On') Global $System, $Form1, $MainMenu, $MenuItem1, $MenuItem2, $MenuItem3 Global $Listbox1, $ListView1, $StatusBar1, $OpenFileDialog1, $dlgOpen $System = CreateObject("Kixforms.System") If Not $System $=MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16) Quit() EndIf $=$System.Application.EnableVisualStyles $Form1 = $System.Form() $Form1.Left = 0 $Form1.StartPosition = 0 ;FormStartPosition_Manual $Form1.Size = $System.Size(603,495) ;(Width,Height) $Form1.Text = "Orca .Net" $Form1.Top = 0 $MainMenu = $System.MainMenu() $MenuItem1 = $MainMenu.MenuItems.Add($System.MenuItem("File")) $MenuItem2 = $MenuItem1.MenuItems.Add($System.MenuItem("Open")) $MenuItem2.Click = "$$=OpenMSI" $MenuItem3 = $MenuItem1.MenuItems.Add($System.MenuItem("Exit")) $MenuItem3.Click = "Quit" $Form1.Menu = $MainMenu $ListBox1 = $System.ListBox() $ListBox1.Anchor = 7 ;Top,Bottom,Left $ListBox1.Height = 440 $ListBox1.Left = 0 $ListBox1.Top = 0 $ListBox1.Width = 250 $ListBox1.Sorted = -1 $ListBox1.Click = "$$=ListInfo($$dlgOpen)" $=$Form1.Controls.Add($ListBox1) $ListView1 = $System.ListView() $ListView1.Anchor = 15 ;Top,Left,Bottom,Right $ListView1.Height = 440 $ListView1.Left = 250 $ListView1.Top = 0 $ListView1.Width = 345 $ListView1.View = $System.View_Details $=$Form1.Controls.Add($ListView1) $StatusBar1 = $System.StatusBar() $StatusBar1.Text = "" $=$Form1.Controls.Add($StatusBar1) $OpenFileDialog1 = $System.OpenFileDialog() $OpenFileDialog1.InitialDirectory = "@SCRIPTDIR" $OpenFileDialog1.Filter = "Windows Installer (*.msi)|*.msi" $OpenFileDialog1.FilterIndex = 1 $OpenFileDialog1.RestoreDirectory = 1 ;True $Form1.Center $Form1.Show ;Displays the Form While $Form1.Visible $=Execute($Form1.DoEvents()) Loop Exit 0 Function ListInfo($strMsiFile) Dim $objMSI, $objMSIdb, $objMSIview, $strMSIRecords, $i, $a, $e If NOT $ListBox1.Text = "" $objMSI = CreateObject("WindowsInstaller.Installer") $objMSIdb = $objMSI.OpenDataBase($strMsiFile,0) $objMSIview = $objMSIdb.OpenView("SELECT `Name` FROM `_Columns` WHERE `Table` = "+"'"+$ListBox1.Text+"'") $objMSIview.Execute() $strMSIrecords = $objMSIview.Fetch $=$ListView1.Columns.Clear $Form1.UseWaitCursor = 1 $ListView1.BeginUpdate $i=0 While NOT $strMSIRecords = "" $i=$i+1 $=$ListView1.Columns.Add($System.ColumnHeader($strMSIRecords.StringData(1),150,$System.HorizontalAlignment_Left)) $strMSIrecords = $objMSIview.Fetch Loop $objMSIview = $objMSIdb.OpenView("SELECT * FROM "+"`"+$ListBox1.Text+"`") $objMSIview.Execute() $strMSIrecords = $objMSIview.Fetch $=$ListView1.Items.Clear While NOT $strMSIRecords = "" $a=$ListView1.Items.Add($strMsiRecords.StringData(1)) For $e=1 To $i $=$a.SubItems.Add($System.ListViewSubItem($strMsiRecords.StringData($e+1))) Next $strMSIrecords = $objMSIview.Fetch Loop $ListView1.EndUpdate $Form1.UseWaitCursor = 0 EndIf EndFunction Function ListTables($strMsiFile) Dim $objMSI, $objDB, $objView, $objRS, $intA $=$ListBox1.Items.Clear $ListBox1.BeginUpdate $Form1.UseWaitCursor = 1 $objMSI = CreateObject("WindowsInstaller.Installer") $objDB = $objMSI.OpenDatabase($strMsiFile,0) $=Split($strMsiFile,"\") $Form1.Text = $[Ubound($)] +" - Orca .Net" $objView = $objDB.OpenView("SELECT * FROM _Tables") $objView.Execute() $objRS = $objView.Fetch $intA = 0 While Not $objRS = "" $intA=$intA+1 $=$ListBox1.Items.Add($objRS.StringData(1)) $objRS = $objView.Fetch Loop $ListBox1.EndUpdate $Form1.UseWaitCursor = 0 $StatusBar1.Text = "Tables: "+CStr($intA) EndFunction Function OpenMsi() $=$ListView1.Columns.Clear $=$ListView1.Items.Clear $=$ListBox1.Items.Clear If $OpenFileDialog1.ShowDialog() = 1 $dlgOpen = $OpenFileDialog1.Filename If NOT $dlgOpen = "" $=ListTables($dlgOpen) EndIf EndIf EndFunction |
||||||||
|
|
|||||||
Updated the code, fixed some errors: 1. Error when cancelling to select an MSI file. 2. Error when clicking in an empty listbox. 3. Silenced all console output. 4. Made the whole script Option Explicit compliant. |
||||||||
|
|
|||||||
5. Refreshing fixed, no more flickering (thx again Shawn!) |
||||||||
|
|
|||||||
eh, what i do ? |
||||||||
|
|
|||||||
Showing me in the previous ScriptOMatic how to prevent the flickering when updating listview and listbox items. |