Text file update based on checklist - Advanced Installer Community
noisyfreak
Posts: 13
Joined: Mon Oct 28, 2013 3:05 pm

Text file update based on checklist

Hi,
I've problem to update my xml file using the "text file update" feature. I don't know how i can iterate through my checklist values, for example i've to add to file1.xml the following line
<DirectLaunch model = "test" classroom = "COMPUTERNAME"/> for all computers checked in the checklist.
There's a way to do this or i must use VBS to do this ?

Thanks in advance.
Regards.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Text file update based on checklist

Hi,

I'm afraid I don't fully understand what is your scenario. Can you give us more details about your scenario (maybe exemplify)?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
noisyfreak
Posts: 13
Joined: Mon Oct 28, 2013 3:05 pm

Re: Text file update based on checklist

Sorry for my english i'll try to be more accurate !
I've a dialog which allow user to select one or more computer on network,
dialog.png
dialog.png (10.51 KiB) Viewed 6759 times
.
Then, during the install process i've to update a xml file with the values selected in this dialog ; for each value ( computer ) selected, i've to append a line in a xml file like this one :
<DirectLaunch model = "test" classroom = "COMPUTERNAME"/>

To do this i create a new text file update, but i don't know how loop in values selected.
update.png
update.png (35.09 KiB) Viewed 6759 times
If only one checkbox is selected on the dialog, the line is correctly appended to the xml file. But when 2 or more are selected the process failed.

Have you understand what i'm try to explain ?

Regards.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Text file update based on checklist

Hi,

In order to achieve this you can follow the steps below:
- go in the Install Parameters page and create a property for each computer that is available in the check list (i.e. [FRRAMDC01], [FRRAMDC02], etc.)
- create another property which will be used to add a new line in the text file (i.e. [NEWLINE])
- go in the Custom Actions page and create an "Execute Script Inline" custom action after the "Wizard Dialogs Stage -> Searches" action group with the following code:

Code: Select all

Session.Property("NEWLINE") = vbCrLf
- go in the Dialogs page and select the [Next] button of the dialog that contains you "Check List" control
- create two "Set installer property value" published events for each property related to a computer like described below (you can use the "Copy" and "Paste" functions after you create the first pair of events):
  • Property: [FRRAMDC01]
    Argument: {}
    Condition: NOT (CHECKLIST_1_PROP >< "A")
    (where "A" is the value of the "FRRAMDC01" element defined in the "Check List" control and the [CHECKLIST_1_PROP] is the property related to the "Check List" control)

    Property: [FRRAMDC01]
    Argument: <DirectLaunch model = "test" classroom = "FRRAMDC01"/>[NEWLINE]
    Condition: CHECKLIST_1_PROP >< "A"
    (if the "FRRAMDC01" element is checked, the "A" value will be contained by the [CHECKLIST_1_PROP] property)
- go in the Files and Folders page and in the "File Content" of the text file update write on a single line all the properties related to the computers (i.e. [FRRAMDC01][FRRAMDC02])
- build and run the project

I also attached a sample AIP file so you can take a look on it.

Let us know if this helped.

Best regards,
Eusebiu
Attachments
Text File Update.aip
(18.87 KiB) Downloaded 392 times
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
noisyfreak
Posts: 13
Joined: Mon Oct 28, 2013 3:05 pm

Re: Text file update based on checklist

Thanks for answer but computers are found dynamically. Checklist is filled with VBS by using "net view" command.
I don't know the names or computer numbers before starting the install process.

Is it possible to "create a property for each computer" and "create two "Set installer property value" published events for each property related to a computer" dynamically through VBS ?


Regards.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Text file update based on checklist

Hi,
Is it possible to "create a property for each computer" and "create two "Set installer property value" published events for each property related to a computer" dynamically through VBS ?
Yes. To create a property you can simply use the "Session.Property("YOUR_PROP") = Any value" method for each detected computer. You can use this method in the same VBS custom action that populate the check list.

For the "Set installer property value" published events you can use the same method as above with the only difference that the properties are set only if the conditions detailed in my previous post are fulfilled. Also these part should be implemented in a separate VBS custom action which will be executed on the [Next] button of the dialog that contains the "Check List" control.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
noisyfreak
Posts: 13
Joined: Mon Oct 28, 2013 3:05 pm

Re: Text file update based on checklist

It works fine, i can insert the desired content ! But one last question,
cpt.png
cpt.png (30.25 KiB) Viewed 6734 times
, can I directly put my generated content in a specific location into the document ?
The "text file update" append content at the end but i would put it in a specific DOM element.

Currently :
<document>
<specific_tag>....</specific_tag>
<document>
// my content is appended here

Desired :
<document>
<specific_tag>// my content </specific_tag>
<document>
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Text file update based on checklist

Hi,

A solution that you can use to achieve this is to use the "Replace" operation instead of "Append/Create" operation.

For example, you can search for

Code: Select all

<specific_tag>....</specific_tag>
and replace it with

Code: Select all

<specific_tag>// my content </specific_tag>
Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
noisyfreak
Posts: 13
Joined: Mon Oct 28, 2013 3:05 pm

Re: Text file update based on checklist

Indeed it is much more convenient ! Thanks a lot for your help, you've been very efficient.

Regards.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Text file update based on checklist

You're welcome. Glad to help.

Just let us know anytime you need help.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”