notta Posted March 17, 2008 Posted March 17, 2008 (edited) I'm creating a package that uses Msiexec to launch a MSI installer, but the problem is the first MSI launches about 5 other MSI installers during the install process and the RunWait continues prematurely. I have to copy some files after the install is complete into the directory where the application is installed, but it tries to copy too soon. I am sure you guys know what I mean. I don't really want to use sleep because the install process takes a variable amount of time depending on processor speed. I also don't want to use the WinActive because the user may go back to work while the install is running. Any ideas how I can handle this situation? Thanks. Edited March 17, 2008 by notta
LarryDalooza Posted March 17, 2008 Posted March 17, 2008 (edited) If you know the "ProductCode" of the MSI... I have a function that could return to you the ProductState ... you can poll until the "ProductState" = 5 ... or some other derivative of checking "ProductState"s in some timely manner. Get Product GUID using ORCA or some other means... here is the API for product state... $ret = DLLCall("msi.dll","int","MsiQueryProductState","str",$data) edit: $data would be the product {GUID} Edited March 17, 2008 by LarryDalooza AutoIt has helped make me wealthy
notta Posted March 18, 2008 Author Posted March 18, 2008 Thanks for the reply Larry. Could you supply me with product state function? I have used Orca before, but the problem is there are 8 MSI's and I don't know in what order any of them are called. This problem has been a real show-stopper. Thanks.
LarryDalooza Posted March 18, 2008 Posted March 18, 2008 The API I posted is all you need. You need to get the ProductCode {GUID} for every .msi ... then create a While loop that doesn't exit until all MsiQueryProductState s return 5 or whatever state you determine. Have some sort of timeout in your loop so it doesn't loop forever. reset the timeout every time a new msi state changes. This should be enough to start with... try some stuff... post some code... go from there. Lar. AutoIt has helped make me wealthy
wandelch302 Posted March 21, 2008 Posted March 21, 2008 I tried using this method but the installer crashed...i believe when it queried the installer...any recomendations?
Micha1405 Posted April 8, 2008 Posted April 8, 2008 If you know the "ProductCode" of the MSI... I have a function that could return to you the ProductState ... you can poll until the "ProductState" = 5 ... or some other derivative of checking "ProductState"s in some timely manner. Get Product GUID using ORCA or some other means... here is the API for product state... $ret = DLLCall("msi.dll","int","MsiQueryProductState","str",$data) edit: $data would be the product {GUID} is it possible to read the MSI Productcode with dllcall from MSI File ?? My TrayToolBar
LarryDalooza Posted April 8, 2008 Posted April 8, 2008 maybe here...http://msdn2.microsoft.com/en-us/library/a...133(VS.85).aspxLar AutoIt has helped make me wealthy
Micha1405 Posted April 8, 2008 Posted April 8, 2008 maybe here...http://msdn2.microsoft.com/en-us/library/a...133(VS.85).aspxLarThanks Larry, can you help with the DLLCall ? My TrayToolBar
LarryDalooza Posted April 8, 2008 Posted April 8, 2008 Here is one way... to get from .msi file ... it pops up a little msi dialog briefly... there is probably a way to do it otherwise... but that s for you to determine. #cs UINT MsiOpenPackage( __in LPCTSTR szPackagePath, __out MSIHANDLE* hProduct ); #ce $a = DllCall("msi.dll","uint","MsiOpenPackage","str",@ScriptDir & "\MediaPlayer.msi","int*",0) #cs UINT MsiGetProductProperty( __in MSIHANDLE hProduct, __in LPCTSTR szProperty, __out LPTSTR lpValueBuf, __inout DWORD* pcchValueBuf ); #ce $b = DllCall("msi.dll","uint","MsiGetProductProperty","int",$a[2],"str","ProductCode","str","","dword*",126) #cs UINT MsiCloseHandle( __in MSIHANDLE hAny ); #ce DllCall("msi.dll","uint","MsiCloseHandle","int",$a[2]) MsgBox(4096,"",$b[3]) Lar AutoIt has helped make me wealthy
ptrex Posted April 8, 2008 Posted April 8, 2008 @allMaybe this can helpMSI EditorIt shows how to read data from an MSI file.regards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
rudi Posted April 8, 2008 Posted April 8, 2008 Hi, what about waiting for MSIEXEC.EXE to terminate? while ProcessExists("msiexec.exe") sleep(100) WEnd Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Micha1405 Posted April 22, 2008 Posted April 22, 2008 Here is one way... to get from .msi file ... it pops up a little msi dialog briefly... there is probably a way to do it otherwise... but that s for you to determine. #cs UINT MsiOpenPackage( __in LPCTSTR szPackagePath, __out MSIHANDLE* hProduct ); #ce $a = DllCall("msi.dll","uint","MsiOpenPackage","str",@ScriptDir & "\MediaPlayer.msi","int*",0) #cs UINT MsiGetProductProperty( __in MSIHANDLE hProduct, __in LPCTSTR szProperty, __out LPTSTR lpValueBuf, __inout DWORD* pcchValueBuf ); #ce $b = DllCall("msi.dll","uint","MsiGetProductProperty","int",$a[2],"str","ProductCode","str","","dword*",126) #cs UINT MsiCloseHandle( __in MSIHANDLE hAny ); #ce DllCall("msi.dll","uint","MsiCloseHandle","int",$a[2]) MsgBox(4096,"",$b[3]) Lar @Lar Thanks a lot !!! You are great in DLL Calls My TrayToolBar
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now