cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Dean_H
Level 7

InstallShield Automation Object error, object does not support property

I have an InstallScript MSI project where I have created the Private Property CDVersion, with the value 1.1.0.280. I want to use a VB Script to increment that number by one each time a build is made. I'm using the program Visual Build Professional by Kinook to automate the build process, and execute this step. I'm not familiar with VB, so I tried to modify the following script that is used to increment the ProductVersion property by substituting CDVersion in place of ProductVersion , but it is not working. I get the error, (VBScript) script code at Line 19, Column 1 (Object doesn't support this property or method: 'objInst.CDVersion'). Can anyone help??

Set objInst = CreateObject("ISWiAuto14.ISWiProject")
' for InstallShield 2008 (use SAAuto14.ISWiProject for standalone)

' open the project file

objInst.OpenProject "C:\My Setups\Trios2_Release\Trios2_Release.ism"

' this code demonstrates incrementing the revision version number

' retrieve and split the ProductVersion

verArr = Split(objInst.ProductVersion, ".")

' increment last field

verArr(UBound(verArr)) = CStr(verArr(UBound(verArr)) + 1)

' update the project

objInst.ProductVersion = Join(verArr, ".")

objInst.SaveProject

objInst.CloseProject
Labels (1)
0 Kudos
(9) Replies
RobertDickau
Flexera Alumni

ProductVersion, ProductCode, and a handful of others are special properties that you can hang directly from the ISWiProject object. To set other properties, including your custom properties, please see the help for the ISWiProperty object.
0 Kudos
Dean_H
Level 7

I have figured out what object needs to be called to get to the Private property I created, however I'm not very familiar with Visual Basic so I need a way to increment the last number of the pProperty.Value +1

Set pProperty = ISWiProject.ISWiProperties.Item("CDVersion"), pProperty.Value = "1.1.0.280"

Can you help with that?
0 Kudos
RobertDickau
Flexera Alumni

The sample code you posted from Split to Join handles that; you'll just need to retrieve your old CDVersion value, split it at the dots, add one to the last field, and rejoin the fields with dots before setting the property...
0 Kudos
Dean_H
Level 7

Robert,

I'm no expert with VisualBasic, but this script continues to fail with the error Line1 Column 3, object does not support this property or method. Here is my script-Any help would be much appreciated. If I created the Property CDVersion in the property manager, is there any reason why this is not working like it works for the ProductVersion Property?

ISWiProject = CreateObject("ISWiAuto14.ISWiProject")
' for InstallShield 2008 (use SAAuto14.ISWiProject for standalone)

' open the project file

ISWIProject.OpenProject("C:\My Setups\Trios2_Release\Trios2_Release.ism")

cdString = ISWiProject.ISWIProperties("CDVersion")

'Get the last value and incrememt it.
value = Val(cdString.Substring(cdString.LastIndexOf(".") + 1)) + 1

'add it back to the string
newString = cdString.Substring(0, cdString.LastIndexOf(".") + 1) + CStr(value)
ISWiProject.ISWIProperties("CDVersion") = newString

ISWiProject.SaveProject()

ISWiProject.CloseProject()
0 Kudos
RobertDickau
Flexera Alumni

If it's complaining about line 1, perhaps start off with "set":

Set ISWiProject = CreateObject("ISWiAuto14.ISWiProject")

(It might also be advisable to use a different variable name from "ISWiProject", to avoid confusion between that and the InstallShield object name...)
0 Kudos
Dean_H
Level 7

Robert,

I saw that I had let off the Set from the 1st line, so I added it, but I'm still getting the error, script code at Line 9, Column 9 (Object doesn't support this property or method: 'valueItem')


Set ISWiProject = CreateObject("ISWiAuto14.ISWiProject")
' for InstallShield 2008 (use SAAuto14.ISWiProject for standalone)

' open the project file

ISWIProject.OpenProject("C:\My Setups\Trios2_Release\Trios2_Release.ism")


valueItem = ISWiProject.ISWIProperties.Item("CDVersion")
cdString=valueItem.Value

'Get the last value and incrememt it.
value = Val(cdString.Substring(cdString.LastIndexOf(".") + 1)) + 1

'add it back to the string
newString = cdString.Substring(0, cdString.LastIndexOf(".") + 1) + CStr(value)
ISWiProject.ISWIProperties.Item("CDVersion") = newString

ISWiProject.SaveProject()

ISWiProject.CloseProject()
0 Kudos
RobertDickau
Flexera Alumni

Please see the "ISWiProperty Object" help topic for some code; I think you'll want "Set" at the beginning of line 9, and to go through the Value property when you're setting the new value to newString...
0 Kudos
RobertDickau
Flexera Alumni

Something like this, perhaps, only with fewer temporary variables:
set oISM = CreateObject("ISWiAuto15.ISWiProject")

oISM.OpenProject "SampleApp3000.ism"

' get the property object
set oMyProp = oISM.ISWiProperties("CDVersion")

' store its old value
oldVersion = oMyProp.Value
WScript.Echo "Old version = " & oldVersion

' break it at dots
verArr = Split(oldVersion, ".")

' increment last field
verArr(UBound(verArr)) = CStr(verArr(UBound(verArr)) + 1)

' put it back together
newVersion = Join(verArr, ".")
WScript.Echo "New version = " & newVersion

' save new value
oMyProp.Value = newVersion

oISM.SaveProject
oISM.CloseProject
set oISM = nothing
0 Kudos
Dean_H
Level 7

Robert,

Thanks from the bottom of my heart. I really appreciate your help on this issue. Thanks again for all of your help!
0 Kudos