rrajasankar
Posts: 29
Joined: Wed Aug 01, 2012 4:05 pm

Property values pass through VB Script

Hi,

I need to perform the file copy operation based on Property Validation in VB Script. How to perform the validation operation using property value in VB Script by AI.

For Example,

IF(PROPERTY1 = 0)

Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
sysFolder = objShell.ExpandEnvironmentStrings("%systemroot%")

sysFolder = sysFolder & "\System32\"

sourceFile = sysFolder & "verify.exe"
destFile = sysFolder & "validate.exe"

On Error Resume Next
fso.CopyFile sourceFile,destFile,true
Set fso = Nothing

End If
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Property values pass through VB Script

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

If you need to get or set a property value from a VB Script custom action, then you can use Session.Property property. Please keep in mind that only immediate custom actions have direct access to public properties. The "Deferred", "Rollback" or "Commit" custom actions will not have access to installer properties (the properties will be empty when the custom action runs). If you want to use properties in a "Deferred" custom action you need to use the Action Data field.

Also, in order to achieve what you want you can use a file copy/move operation from "Files and Folders" view.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rrajasankar
Posts: 29
Joined: Wed Aug 01, 2012 4:05 pm

Re: Property values pass through VB Script

Hi Daniel,

Thanks for your reply.

Could you please provide a sample VB script based on properties validation.

Our requirement is if the particular property(search property) is available, copy the particular file to the target machine.

Awaiting for your reply

Thanks,
Raja
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Property values pass through VB Script

Hello Raja,

Here's a list with some samples containing VB Script files:
- Write text to a file
- Remove a file or a folder during installation
- Refreshing a dialog after setting a property
- Refresh dialog box controls

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rrajasankar
Posts: 29
Joined: Wed Aug 01, 2012 4:05 pm

Re: Property values pass through VB Script

Thanks for your reply..

We have one important query.

1. We created an application for mixed client environment successfully as per your guidance. Both fresh & upgrade functionality works fine.

For example, latest version 3.5.0.0 files installed in the target machine successfully, then when we try to install the same version 3.5.0.0 again in that machine, we got the following maintenance dialog.



Our requirement is, if we try to install the same version 3.5.0.0 again in that machine, maintenance mode won't display. We need to show our customized dialog " Client file already installed in this machine"

How do we configure this settings?

Awaiting for your reply.
Thanks,
Raja
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Property values pass through VB Script

Hello Raja,

In order to achieve what you want you can proceed like this:
- Go to "Dialogs" page and from "Maintenance" tree delete "MaintenanceWelcomeDlg", "CustomizeDlg" and "VerifyReadyDlg" dialogs using "Delete" context menu option.
- Select "MaintenanceTypeDlg" and from context its menu choose "New Dialog in Sequence" option.
- Select the new added dialog and customize it as you want.
- Select [<Back] button and from "Properties" right pane customize it like this:
  • Visible: False
    Enabled: False
- Select [Cancel] button and from "Properties" right pane customize it like this:
  • Visible: False
    Enabled: False
- Select [Next>] button and from "Properties" right pane customize it like this:
  • Text: OK
- Go to "Custom Actions" page and using context menu "Show Standard Action" option show the following standard actions: "PrepareDlg", "MaintenanceTypeDlg", "ProgressDlg" and "ExecuteAction".
- Select "PrepareDlg" standard action and from "Standard Action Properties" right pane set the "Execution Condition" field like this:
  • (NOT AI_MAINT)
- Select "MaintenanceTypeDlg" standard action and from "Standard Action Properties" right pane set the "Execution Condition" field like this:
  • (NOT AI_MAINT)
- Select "ProgressDlg" standard action and from "Standard Action Properties" right pane set the "Execution Condition" field like this:
  • (NOT AI_MAINT)
- Select "ExecuteAction" standard action and from "Standard Action Properties" right pane set the "Execution Condition" field like this:
  • (NOT AI_MAINT)
- Add a "Set installer property" custom action with sequence, scheduled after "Finish Dialogs Stage", like this:
  • Property: AI_INSTALL
    Formatted: 1
    Condition: AI_MAINT
- Add a "Set installer property" custom action with sequence, scheduled after "Finish Dialogs Stage", like this:
  • Property: AiSkipExitDlg
    Formatted: 1
    Condition: AI_MAINT
- Build and run your project.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rrajasankar
Posts: 29
Joined: Wed Aug 01, 2012 4:05 pm

Re: Property values pass through VB Script

Thanks for your reply. W done the configurations as per your recommendation.

Now, we have another query. We need to show the "Client Input Dialog" during fresh install only. If, we upgrade from old version to latest version, no need to display this "Client Input Dialog" . We tried the "Show Only IF" condition for that window, but "Show only if" option was in disabled mode..

How to configure this settings..?
rrajasankar
Posts: 29
Joined: Wed Aug 01, 2012 4:05 pm

Re: Property values pass through VB Script

Thanks for your reply. W done the configurations as per your recommendation.

Now, we have another query. We need to show the "Client Input Dialog" during fresh install only. If, we upgrade from old version to latest version, no need to display this "Client Input Dialog" . We tried the "Show Only IF" condition for that window, but "Show only if" option was in disabled mode..

How to configure this settings..?
Attachments
&quot;Show only if&quot; option was in disabled mode
"Show only if" option was in disabled mode
Dialog1.jpg (16.58 KiB) Viewed 17716 times
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Property values pass through VB Script

Hi,

I'm not sure why the option is disabled. Can you please send us the .AIP (project) file you are using to support at advancedinstaller dot com so we can take a look?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”