PDA

View Full Version : Error in using 'Installer' object



Peter Bi
04-12-2002, 12:54 PM
Hi,

In one of our systems, I can't install the package (IS Developer702, basic) because error happened in one of the CAs, which were implemented with InstallShield script.

Here is the code fragment:
----------------------------------------------------
OBJECT installer, prods;
STRING list, svRet, szProd, sProds;
NUMBER x, nProds, i, nResult;

GetPropValue(hMSI, "ProductName", szProd); //this wrapper called MsiGetProperty()

nProds = 0;
set installer = CreateObject("WindowsInstaller.Installer");
set prods = installer.Products;
nProds=prods.Count;

x=0;
for i=0 to nProds-1
//the following line cause install failed - install interrupted
if (installer.ProductInfo(prods.Item(i), "InstalledProductName")= szProd) then
x=x+1;
endif;
endfor;
...
----------------------------------
It has been checked that the 'installer' object is created and nProds is a meaningful number. The most weried thing is that the package works fine on all other systems, but only this one (so far) has problem.

Anybody can see a problem in the code or guess what could be wrong on the system?

Thanks,
Peter

Joshua
04-12-2002, 02:23 PM
Peter,

As the problem only occurs on one machine out of all the ones you've tested, I wouldn't be extremely concerned. I would recommend debugging down into the script to find exactly which function is failing, and with what return code. This should give us a better idea of the specifics.

Peter Bi
04-12-2002, 05:06 PM
Joshua,

Thanks for your reply.

I did more work on the problem, and find there is one product installed that I couldn't call it's 'InstalledProductName' and 'ProductID' (the two I tried, for other properties, I don't know), and it turned out the item is ISScript!

The story is that, when we first install our package, we saw setup error saying that '1 The InstallScript engine is missing from this machine. If available, please run ISScript.msi, or contact your support personnel for assistance.', so we run ISScript.msi, and the product (ISScript) appear in Add/Remove, and when we install our package now, the code (see my first post) failed to get the product name of the third item (Item(2)), I also tried to get ProductID, and also failed (the execute broken, and install is 'interrupted') at the third item. But when I call 'PackageName', it worked, and the third item's packagename is 'ISScript.msi'.

I checked our other systems and found they succeed because we installed IPWI2.03 package, if I installed a Dev7.02 pkg the '..enging missing .. install ISScript.msi ...' error also show up. Dev703 beta won't fix the problem (the 703 beta pkg also show 'interrupted' install).

So far, I only can see one problem - when using installer.Products collection, the ISScript is in the colleciton (since the ISScript.msi is retrieved using 'PackageName' property), but it's 'InstalledProductName' and 'ProductID' can't be retrieved. You can easily test it by running ISScript.msi (see ISScript appear on Add/Remove), and then create installer object and try to retrieve the properties of each item form products collection (refer to my previous post).

Maybe there are other problems I didn't see through here, if you can point out, I will be really appreciated.

Thanks,
Peter