Automating Wise Update Versioning Information?

This issue has been solved. See solution.
Jacks Bad's picture

I am trying to create a Final Builder script that recompiles my application before calling my Wise installation script to build the installation package for our customer.  The problem I am having is figuring out how to auto increment the WiseUpdate Product Version information each time the script is executed.  Is there a way to auto-increment the WiseUpdate Product Version information or set this to a variable I can then pass into the wise script from Final Builder?

Jack

JohanH's picture

WiseUpdate Product Version is

WiseUpdate Product Version is located in the WiseModuleConfiguration table. You can use a script or program to call the Automation interface to change the value in the table and save the wsi (see WiseAutomation.chm in the Wise Installation directory Help folder).

Jacks Bad's picture

I spent most of yesterday reviewing the manuals...

I spent most of yesterday reviewing the manuals, help files, etc and although I have learned many things, I still do not feel as though I am that much closer to solving my problem.  I am still unsure of how to access the WiseModuleConfiguration table without using the actual Windows Installer Editor GUI, nor am I sure how to even call the Automation Interface.  If you would be so kind as to give me another nudge in the right direction I'd greatly appreciate it!

EdT's picture

Questions for you

Could we ask which version of the Wise product you have, as the detail in the manuals specific to the automation interface was improved considerably with the release of Version 7 of the products.
Could we also enquire about your programming experience, as there is quite a lot of example code in the SampleCode.chm file, and if you are having trouble with understanding that, then we will at least know how to pitch any future advice.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

Jacks Bad's picture

Answers for you

Thanks again for your assistance with this.

I am using Windows Installer v7.0 (Build 7.3.0.250).

I have been programming in Delphi/Pascal for the past 12 years & C# for the past 2.  In college (Dual Degree with a BA in Computer Science & another in Biology, Math & Chemistry minors) I programmed in C++ mostly.  Never messed with VB though as I haven't had much spare time since college,.  I also have about 4 years of T-SQL under my belt as well. 

It comes back to "just because i'm a senior developer at my company doesn't mean I can program your cell phone for you".  This is just new to me and although I have already been able to generate the script to package our product, I haven't been able to make the leap to accessing the tables in order to modify the data I need.  I'll have a look at the SampleCode file shortly to see what I can learn from there.  I might just have the stroke of genius I need to finish this little project I had been given.

Please know that I do appreciate your time and assistance with helping a noobie to Wise Installer.  For whatever reason I have just hit a wall with understanding how to implement this (what I thought would be simple) little change.

Jack

AngelD's picture

I couldn't find the

Solution

I couldn't find the WiseModuleConfiguration table but the below vbscript should give you a starting point.

save it as ex. WiseUpdateProductVersion.vbs


run it as cscript WiseUpdateProductVersion.vbs "C:\path to .wsi"

The code would look something like:
<StartOfCode>
UpdateToProductVersion = "1.1"
PrimaryKey = "ProductVersion"
ColumnNameToUpdate = "Value"

WSIFile = WScript.Arguments(0) '// 1st argument is the path to .wsi
WFWI = CreateObject("WFWI.Document")

WFWI.Open(WSIFile)

Set tbl = WFWI.WTables("WiseModuleConfiguration")
tbl.WRows.Row(PrimaryKey).WColumns(ColumnNameToUpdate).Data = UpdateToProductVersion

WFWI.Save WSIFile

<EndOfCode>

You need to change the PrimaryKey variable value to the entry (primarykey) in the WiseModuleConfiguration table you want to change.
Also the ColumnNameToUpdate for the correct column name that holds the product version value as I couldn't verify the table.


sz's picture

Hi AngelD, I am trying to

Hi AngelD,
I am trying to implement this solution.
First question is how I can force my script to be run in cscript in final builder "Run script " Action?
Thank you in advance
sz

EdT's picture

Isn't this a rather basic question?

The correct syntax to call a script with cscript.exe is:

cscript.exe <path>\yourscript.vbs

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

AngelD's picture

Ed, as usual it's hard to

Ed, as usual it's hard to read the info ;)

In the beginning of the post that was ticked the solution the command line example states:
run it as cscript WiseUpdateProductVersion.vbs "C:\path to .wsi"



Jacks Bad's picture

This makes more sense to me...

Thank You, Thank You, Thank You!!!

Reading your last post really gave me the insight I needed and helped me to understand how scripting to modify the contents of the msi file works.  There are just a few simple syntax items I still have to work through and I believe I will be able to pronounce this project finished!! 

I believe you have to enable the "Include Wise Update Client" option for the WiseModuleConfiguration table to be included.  For reference, here is what the table looks like...
              
"ModuleID_", "Name_", "Value"
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","Silent","Y"
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","LogFileName","WiseUpdate.log"
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","LogFile","Y"
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","IconName",""
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","UserName",""
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","SettingsURL","test1.iwantinsurance.com/ice/iceupgrade.ini"
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","StartUpIcon","0"
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","WebPage","http://support.turborater.com"
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","CheckDays","1"
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","Password",""
"WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A","Version","1.0.36"

Where "ModuleID_" & "Name_" are both key fields.

And here is what I currently have...

*************************************************************************************************
WSIFile = WScript.Arguments(0) '// 1st argument is the path to .wsi
UpdateToVersion = WScript.Arguments(1) '// 2nd argument is the version
UpdateToHostURL = WScript.Arguments(2) '// 3rd argument is the host url
Set WFWI = CreateObject("WfWI.Document")
WFWI.Open(WSIFile)

Set tbl1 = WFWI.WTables("WiseModuleConfiguration")
tbl1.WRows.Row("Version").WColumns("Value").Data = UpdateToVersion
tbl1.WRows.Row("SettingsURL").WColumns("Value").Data = UpdateToHostURL

Set tbl2 = WFWI.WTables("Property")
tbl2.WRows.Row("ProductVersion").WColumns("Value").Data = UpdateToVersion

WFWI.Save(WSIFile)
*************************************************************************************************

My code for tbl2 works fine, however my code for tbl1 is bombing with a runtime error:  'Object Required: 'tbl1.WRows.Row(...)'".  I know it's just something to do with the syntax though.

Again, thanks for your time and assistance with solving this little project that fell into my lap.  I don't think I would have made it this far without everyone's assistance!

Jack

AngelD's picture

If there exist more then one

If there exist more then one primarykey to identify a table entry then you need to separate them with a comma.

For the WiseModuleConfiguration table this would be "ModuleID_,Name_" and in your case this would look like:
tbl1.WRows.Row("WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A,Version").WColumns("Value").Data = UpdateToVersion
tbl1.WRows.Row("WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A,SettingsURL").WColumns("Value").Data = UpdateToHostURL

You can also update a property as below:
Call WFWI.SetProperty("ProductVersion", UpdateToVersion)

If you want to compile the project file (.wsi) instead of just saving it you could replace the "WFWI.Save..." line (it will both save and compile):
WFWI.Compile WSIFile

Jacks Bad's picture

That did the trick!

That did the trick!

For reference & posterity I'm posting the finished script, along with the information I found most useful in getting this little project to work.

The finished script:

*************************************************************************************************
ColumnNameToUpdate = "Value"
WSIFile = WScript.Arguments(0) '// 1st argument is the path to .wsi
UpdateToVersion = WScript.Arguments(1) '// 2nd argument is the version
UpdateToHostURL = WScript.Arguments(2) '// 3rd argument is the host url
Set WFWI = CreateObject("WfWI.Document")
WFWI.Open(WSIFile)

Set tbl1 = WFWI.WTables("WiseModuleConfiguration")
tbl1.WRows.Row("WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A,Version").WColumns("Value").Data = UpdateToVersion
tbl1.WRows.Row("WiseUpdate.58949955_0765_4225_AB94_EA84F43B417A,SettingsURL").WColumns("Value").Data = UpdateToHostURL

Set tbl2 = WFWI.WTables("Property")
tbl2.WRows.Row("ProductVersion").WColumns("Value").Data = UpdateToVersion

WFWI.Compile(WSIFile)
*************************************************************************************************

After typing this up in a basic text editor (I used Notepad) I saved it to a file that I named "WiseUpdateProductVersion.vbs".

As this script itself accepts 3 parameters, and executing the script requires we also pass in the location of the script itself, I decided that to save time I should probably just create a shortcut on my desktop I could use to execute this script during development. Here is the target information I used when creating the shortcut:

Target: %windir%\system32\cscript.exe "C:\Program Files\Altiris\Wise\Windows Installer Editor\Projects\WiseUpdateProductVersion.vbs" "C:\Program Files\Altiris\Wise\Windows Installer Editor\Projects\ICeSetup.wsi" "1.0.25" "www.jacksbad.com/mydirectory/fileupdate.ini"

That may look like a lot of confusing information, but it's really rather simple. Here it is one item at a time:

%windir%\system32\cscript.exe - This is the executable that actually "runs" the VB script that I just created and saved.

"C:\Program Files\Altiris\Wise\Windows Installer Editor\Projects\WiseUpdateProductVersion.vbs" - The first parameter is the location and name of the vb script we created and saved. This is how the cscript.exe program knows where the script is located on your computer that you want to execute.

The next 3 parameters are for the VB script to use. The first of these three parameters is the location of the msi file we want to modify. The second of these three parameters contains the versioning information we want to insert into the data tables. The last of these three parameters contains the url that we want to insert into the tables. The url is where WiseUpdate will check if there are any updates available. The reason I am including this as a parameter is because I have both a test and live environment that use different web servers for accessing the files.

Now that we have everything we need to update and compile the Wise msi script that creates our setup files, the only remaining item left is to add a step within the Final Builder script I am using to compile everything fresh! This consisted of adding an "Execute Program" step to my Final Builder project using the same information I used to create the shortcut on my desktop.

Viola, Project complete!

I sure do hope that someone else will find this post useful and easy to follow.

Again, a big "Thank You" to all those who helped me learn enough to be dangerous with Wise Installer! I can't tell you how much I appreciate your help and expert assistance. If you are ever in Dallas give me a shout as I owe each of you lunch!

Jack

AngelD's picture

Great that you got it

Great that you got it working!
Now; please click "Mark As Solution" for the reply you think gave you the answer to your questions so we can "close" this thread. 

Cheers!