murug86
Posts: 52
Joined: Mon May 21, 2012 10:59 am

User Input Values while installation

While installing your app. In Dialogs page, you can model radio buttons and text boxes to extract info from the user.

I need few such fields, filled in by the user while installing the app, to be saved in a file in the installed location, so that my app can access those values.

How can i achieve this.

Thanks..

ASH
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: User Input Values while installation

Hello,

If you need to save the value of a property, which is assigned to an UI control, in a file, then you can take a look on our "Write text to a file" article.

Let us know if this helps, otherwise please give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
murug86
Posts: 52
Joined: Mon May 21, 2012 10:59 am

Re: User Input Values while installation

Hi Daniel.

I was able to set all the user inputs as registry entries.
[Using the Registry page : New value : Property button -> User Interface.]
Thank you.

But I would like to write these values to a file. I checked out above link you sent, involving custom actions.
I'm working on a JAVA/JSP project. Is there a way to 'Write to a file' with 'Custom Actions' WithOut vbscript ?

Thank you.

ASH
murug86
Posts: 52
Joined: Mon May 21, 2012 10:59 am

Re: User Input Values while installation

Hi..

I was going through the Write-To-File custom action. These are the steps i did:
0. Dialogs : First Time INstal : WelcomeDlg -> Add Dialog -> Project -> NewSeqDialog :
Added an Edit Box
In Properties :
Property -> Property Name : MY_WS_PROP
Property -> Default Value : C:\SmartE\workspace\

1. Files & Folders : Application Folder : Add File = i added a new file : "cvs.txt"
2. Custom Actions : InstallExecuteSequence -> Install : Property set with Formatted :
Property : MY_WS_FILE
Formatted : [APPDIR]cvs.txt
Execute Sequence Condition -> Condition : NOT Installed [Install checkbox checked]

3. I created a txt file, pasted the below vb-script; and renamed it to "WriteToFile.vbs"
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim fso, f
Dim tokens
Dim file

file=Session.Property("CustomActionData")
tokens=Split(file,"|")

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(tokens(0), ForWriting, True)

f.Write tokens(1)
f.Close


4. Custom Actions : InstallExecuteSequence -> Install : New Attached Custom Action
I selected the vbs file i created from desktop
•Source Path: C:\Users\254013\Desktop\WriteToFile.vbs
•Source Type: Visual Basic Script (*.vbs)
•Function Name:
•Action Data: [MY_WS_FILE]|[MY_WS_PROP]
•Execution Properties: Synchronous execution, check return code
•Execution Options: Deferred with no impersonation
•Execute Sequence Condition -> Condition : NOT Installed [Install checkbox checked]

5. Build

On running the EXE/MSI, i get the below error:
MissingScript.png
MissingScript.png (67.9 KiB) Viewed 12407 times
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: User Input Values while installation

Hello,
Is there a way to 'Write to a file' with 'Custom Actions' WithOut vbscript ?

Yes, you can write your own custom action which will do that. In example you can build your own DLL which will write text to a file.

Regarding to the related error, please make sure that the VBS custom action is added under "Install Execution Stage -> Add Resources" standard action. Also, the "Property set with Formatted" custom action should be scheduled under "Install Execution Stage -> Add Resources" and before the VBS custom action which writes into the file. If the behavior still persist can you please attach a sample reproducing the behavior?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
murug86
Posts: 52
Joined: Mon May 21, 2012 10:59 am

Re: User Input Values while installation

In the Custom Action Page; “Install Execution Stage” is not available in my AI 8.9.
Instead I have “Install execute Sequence”\
And don’t have any “Add Resource” option either. This is a view of my options:
CustomAction.png
CustomAction.png (31.29 KiB) Viewed 12403 times


However, I was able to make the EXE work by doin the following :
In my “New attached custom action”, for the ‘Action Data’ property, instead of :
[MY_WS_FILE]|[MY_WS_PROP]

I gave the value of [MY_WS_FILE] directly, as [APPDIR]cvs.txt
So my ‘Action Data’ property read :
[APPDIR]cvs.txt|[MY_WS_PROP]

So, i believe the issue was the PropertySource i was setting : [MY_WS_FILE] ; with the path of the text file was not getting set.
And the EXE installed , and wrote the required edit box value into the cvs.txt file
murug86
Posts: 52
Joined: Mon May 21, 2012 10:59 am

Re: User Input Values while installation

Ok.. My Bad..

As you said, the "Property Set with Formatted" should be placed first. I only got a hang of sequencing now.
Sequencing.png
Sequencing.png (24.74 KiB) Viewed 12403 times

The vbScript is working fine for me.

Return to “Building Installers”