pcolelanelr
Posts: 8
Joined: Mon Jul 22, 2013 5:36 pm

write listbox items to a text file

how can I take the items in a listbox and write them to a text file? The user will put items into a listbox that is used later in the install. I need those items to be available during maintenance so the user can select them for removal. So I also need some guidance in adding the items from the text file back into a listbox during maintenance mode. Is there another way to make them persistent? I could use a registry key I guess?

thanks,
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: write listbox items to a text file

Hello,

Please take a look on our "Working with Windows Installer ComboBox and ListBox controls" tutorial which should be useful for you. Also, in order to achieve what you want you can add the property associated with your list box control in "Install Parameters" page and enable the "Set persistent property" option for it.

Let us know if this helped, otherwise please give us more details (maybe exemplify) about your specific scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
pcolelanelr
Posts: 8
Joined: Mon Jul 22, 2013 5:36 pm

Re: write listbox items to a text file

thanks for the reply Daniel. Let me see if I can explain a little better. I have an install that I'm trying to migrate from InstallShield and its not your ordinary printer install. The install allows the customer to install multiple print-to-fax printers. Each printer has a unique name and other unique fax information. I envision the initial install installing all the files necessary and then the customer going back into maintenance mode and add the printers needed. I've added a dialog box in maintenance after the CustomizeDlg. It has edit fields on the left with a "Install Button" below these fields and a Listbox to the right of the edit fields. After the user enters the printer information they press the Install Button which runs a custom action to do the install and another custom action to update the Listbox. If the user wants to delete a printer they go back into maintenance to a dialog that has a Listbox populated with those printers. I guess it could be the same dialog they would just chose to "Add" or "Delete". They select a printer and press a button to delete that specific printer. All this is pretty easy with the scripting of IS. I know it can be done it AI but I'm not experienced enough at this time to figure it out.
I could send you my install if that would help.
pcolelanelr
Posts: 8
Joined: Mon Jul 22, 2013 5:36 pm

Re: write listbox items to a text file

Using the example Combo / listbox project was a tremendous help. I've got everything working except making the items in the listbox persistent. I need those items if the user runs the install in maintenance mode so I thought I'd just write the listbox items to a text file and then populate the listbox from the text file when needed in maintenance mode. I'm just not sure where to accomplish those two steps.

thanks,
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: write listbox items to a text file

Hello,

In order to achieve what you want you can create your own custom actions which will write and extract listbox items in/from a text file. Please take a look on the following threads which should be useful for you:
- How to read the selected ComboBox "Text" and "value"
- Dynamically Populate ComboBox via VBS

Let us know if this helps.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”