This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- can we run vbs using installscript?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 24, 2007
01:23 PM
vbscript combo box
I am trying to find a way to list all local installed IIS websites to a combobox on a custom dialog using a vbscript. I think I have the script correct but I am not for sure on how to setup and populate the combobox with vbscript information and when and how to call the script.
(13) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 24, 2007
02:24 PM
You'll want to call the script as a custom action, obviously. You should sequence it anywhere before the dialog in which you want the combo box to display. Since you've already managed to enumerate the sites, the piece you'll need to know is this. To get it to display, you'll need to something like this:
Dim MsiDb
Dim MsiInstall
Dim MsiRecord
Dim MsiView
Set MsiDb = Session.Database
Set MsiInstall = Session.Installer
Set MsiView = MsiDb.OpenView("SELECT * FROM ComboBox")
Set MsiRecord = MsiInstall.CreateRecord(4)
MsiRecord.StringData(1) =
MsiRecord.IntegerData(2) =
MsiRecord.StringData(3) =
MsiRecord.StringData(4) =
Call MsiView.Execute(MsiRecord)
Call MsiView.Modify (7, MsiRecord)
Call MsiView.Close
And you'll want to iterate through the steps to populate the table once for each website your script finds, so you'll probably need to make use of a Count property or something similar on the IIS object, and use UBound on that value.
Dim MsiDb
Dim MsiInstall
Dim MsiRecord
Dim MsiView
Set MsiDb = Session.Database
Set MsiInstall = Session.Installer
Set MsiView = MsiDb.OpenView("SELECT * FROM ComboBox")
Set MsiRecord = MsiInstall.CreateRecord(4)
MsiRecord.StringData(1) =
MsiRecord.IntegerData(2) =
MsiRecord.StringData(3) =
MsiRecord.StringData(4) =
Call MsiView.Execute(MsiRecord)
Call MsiView.Modify (7, MsiRecord)
Call MsiView.Close
And you'll want to iterate through the steps to populate the table once for each website your script finds, so you'll probably need to make use of a Count property or something similar on the IIS object, and use UBound on that value.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 24, 2007
03:04 PM
thank you this worked great, Here is the code I used to get the list.
Now My next major thought I would like to display the selected sites information underneath the list. so on site select information populates text areas under the drop down displaying site information.
Dim objView
Dim objDB
Dim objInstaller
Dim objRecord
Dim objW3SVC, objIisWebSite
Dim lngOrder
Set objDB = Session.Database
Set objInstaller = Session.Installer
Set objView = objDB.OpenView("select * from ComboBox")
' enumerate webservers on localhost and populate ComboBox table
Set objW3SVC = GetObject("IIS://localhost/W3SVC")
lngOrder = 1
For Each objIisWebSite In objW3SVC
If objIisWebSite.Class = "IIsWebServer" Then
If LCase(objIisWebSite.ServerComment) <> "administration web site" Then
' add site name to ComboBox table (which is used by our dialog ComboBox)
Set objRecord = objInstaller.CreateRecord(4)
objRecord.StringData(1) = "SITELIST" ' property name
objRecord.IntegerData(2) = lngOrder ' order
objRecord.StringData(3) = objIisWebSite.Name ' value
objRecord.StringData(4) = objIisWebSite.ServerComment ' text
' now add the record to the table
Call objView.Execute(objRecord)
Call objView.Modify(7, objRecord) ' (7 = msiViewModifyInsertTemporary)
lngOrder = lngOrder + 1
End If
End If
Next
Call objView.Close
Now My next major thought I would like to display the selected sites information underneath the list. so on site select information populates text areas under the drop down displaying site information.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 24, 2007
03:14 PM
This is a good deal trickier. It's easy to obtain the info you want, and of course you can concatenate these values into strings all you want. The trick is that the dialog itself gets its display values on loading. There is supposed to be a way to display this information dynamically, but I've never gotten it to work. What I find easiest is to create two identical dialogs, except for the controls on the object you want to control the "dynamic information" with. Then you associate a property change with that control, as well as a NewDialog control to open the identical dialog. Only now, since you've populated a dialog in between, the second dialog opens displaying the correct information.
Of course it's a hack, but I've had the best results with this.
Of course it's a hack, but I've had the best results with this.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 24, 2007
03:50 PM
ok, I am learning as I go here so forgive all the questions. Could you please eliberate more on the property change and how I would do it.
Is this sort of what you mentioning to do. write a script of function in setup.rul and get the selected site then set all the properties using a doaction and have it run another custom action on the next button. If so could you provide a simple sample function.
I was also wondering about how I could add the more site information like the site port,ip,sitenumber and url
all of your help is greatly appreaciated.
Is this sort of what you mentioning to do. write a script of function in setup.rul and get the selected site then set all the properties using a doaction and have it run another custom action on the next button. If so could you provide a simple sample function.
I was also wondering about how I could add the more site information like the site port,ip,sitenumber and url
all of your help is greatly appreaciated.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 24, 2007
04:02 PM
Now I am confused. Why do you have a setup.rul file? That would indicate InstallScript. InstallScript, however, wouldn't make use of MSI tables, so the previous code sample I gave you wouldn't work. Unless you're trying an InstallScript custom action, which is most likely a bad idea. Unless there's a specific reason you need to do your CA in InstallScript, 9 times out of 10 you're better off doing them in VBScript, C++, or the like.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 24, 2007
04:09 PM
Sorry, no there is now reason to use install script for this. I was going to create a custom action using one if that was possible to handle this scenerio but thank you for the warning I will not I will stick with vbscript then. Could you please point me in the right direction to accomplishimg the task of populating some text field properties on a cloned dialog of the IIS listing dialog so it will display site information.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 25, 2007
07:21 AM
On second thought... it would be a lot easier for you to not display this in a text box. Unless there's a reason you wouldn't want to do this, there's a much easier way. You'll note that one of the columns in the combo box table is called Text. This is the text that is displayed in the combo box. In the script where you enumerate sites, you could simply grab the info you want from the IIS properties, and place it all in a string that you then place in the text column. The information displayed to the user would be the useful human-readable information you want them to be able to see, but on the back end, you can fill the property they select with whatever data you need for your actions to work.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 25, 2007
08:38 AM
That sounds good, i will do that, I can do the doaction on the next button and have it run a new script that would load the properties I need.
? not for sure how to get the property of the selected item in the combo box and then parse it out though or is there another way to do this.?
? not for sure how to get the property of the selected item in the combo box and then parse it out though or is there another way to do this.?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 25, 2007
08:41 AM
It's automatic. That's how the combo box works. You specify what property it sets, and each entry has a value associated with it. Whatever the user selects, that is value your property will hold.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 25, 2007
09:12 AM
Nice, I like that I was thinking I would have to parse out the index or something.
Thank you for your help. 🙂
Thank you for your help. 🙂
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 25, 2007
10:32 AM
ok, I wrote the other script and I am trying to get the data from the property, but now I can not tell if it is my script or the way I setup the custom action or the way the dialog calls the script.
I created a custom action and set it to always execute. abscent from sequence. I then went to the dialog that displays the combo box and went to the execution of the next button and said do action "MyScript" condition 1
then newdialog the next dialog and condition 1 when testing it just sits there and does nothing any ideas on what i did wrong
I created a custom action and set it to always execute. abscent from sequence. I then went to the dialog that displays the combo box and went to the execution of the next button and said do action "MyScript" condition 1
then newdialog the next dialog and condition 1 when testing it just sits there and does nothing any ideas on what i did wrong
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 25, 2007
03:37 PM
Ok, I am using my script from above and trying to use ojbIisWebSite.ServerBindings and it errors ever time. Could someone assist in helping me modify the script from above to parse out the portnumber, host, and ip address.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 05, 2015
11:11 AM
can we run vbs using installscript?
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)