/build/static/layout/Breadcrumb_cap_w.png

How can I use variable inside brackets?

I am trying to automate msi checks. Below is my code,

Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase(Appid2,msiOpenDatabaseModeReadOnly)

Appid2 will be a variable value, but it is not getting resolved. Can anyone guide me?

0 Comments   [ + ] Show comments

Answers (5)

Posted by: anonymous_9363 11 years ago
Red Belt
0
If the code you show is an exact representation of what you're trying to run, I think the problem may be the 2 spaces you have between the function call (OpenDatabase) and the parameter list. Close that gap completely - that is, have no spaces - and re-try.
Posted by: markus trescothick 11 years ago
Yellow Belt
0
I tried that, but same result.
Posted by: anonymous_9363 11 years ago
Red Belt
0
I have to ask...you have assigned values to 'Appid2' and 'msiOpenDatabaseModeReadOnly' and, for the former, I presume the value is the full path to the MSI?
Posted by: Jsaylor 11 years ago
Second Degree Blue Belt
0
I think maybe supplying the entire code set you're trying to use would be more helpful. Without knowing what the actual variables are that you're using, and maybe even a specific error code that the script is spitting out during object creation (it is the database object creation that's failing, right?) We can't really provide meaningful help beyond some common 'gotcha' things that could happen to any piece of code.
Posted by: markus trescothick 11 years ago
Yellow Belt
0
Hi,
I think I got answer.
in my code I was using,
Appid2 = chr(34) & "c:\" + Appid1 & chr(34)
it was getting resolved as "c:\A_B_1.0.msi".
Strange thing is in brackets if I put hard coded value,

Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase("c:\A_B_1.0.msi",msiOpenDatabaseModeReadOnly)
it does not give any error.

I removed chr(34), and it started working.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ