Hello,
In order to achieve what you want, we can use a
"PowerShellInline" custom action
without sequence. We use it without sequence, so we can trigger it from a dialog control. In order to add a custom action without sequence, simply press the
"Add custom action without sequence" button which is located to the right side of the custom action name. Since the values that are entered are saved as strings, the powershell script needs to take that string value, convert it to an integer and then increment it by 1.
To do this, please proceed as it follows:
Before we begin, a quick note: Since I do not have any further information about your scenario (e.g what dialog you have the control on, etc.) I will further proceed using my example. Just modify it for your needs.
- The first step I took was to add on the "FolderDlg" an edit box where I will introduce the value that I want incremented. The property that stores the value we introduce at the install time is called, in my case, EDIT_1_PROP.
- Now, please go to
"Custom actions" page and add a
"PowerShellScriptInline" custom action without sequence. After doing so, under the "Your code goes here." comment, please add the following code:
Code: Select all
$string = AI_GetMsiProperty EDIT_1_PROP
$integer = [int]$string+1
AI_SetMsiProperty MY_PROP "$integer"
In the code above, the second property is the one that is obtained by incrementing the value of the first one by 1 and I named it "MY_PROP". You can name it however you want.
- After doing so, please go back to
"Dialogs" page, click on
"FolderDlg" --> click on the
"Next" button --> under
"Published Events" tab click on the
"New..." button:
-Event: Execute Custom Action
-Argument: PowerShellScriptInline
-Condition: leave unchanged. The default condition is "1" (or "AI_INSTALL")
Please let me know if this helps!
All the best,
Catalin