Hi
I want to add one VB script as a CA in my package, The application I have created in Wise package studio v5.1, The CA has to check like some registries, Computer name, domain name etc.., If these things are valid then Application has to get installed,
If the condition is not valid the application installation has to FAIL,

Can anyone help me out plz,
Thanks in advance,
Sus
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
It's a lot simpler than using script: read up on using AppSearch and LaunchCondition actions. Simply out, AppSearch searches for file/folder or registry entry presence and sets a property. You can then LaunchCondition check that property's content, presenting a suitable message and taking appropriate action.

Note that by default WPS has the LaunchCondition action before the AppSearch action, so it would be an idea to alter your 'Windows Application' template. Remember to make a back-up.
Answered 06/19/2008 by: VBScab
Red Belt

Please log in to comment
0
You don't necessarily need to write your own CA script to do this.

Some of the checks you describe, such as environment variable settings, could be set up as Launch Conditions (in WPS, these can be added through the Launch Conditions option on the Product tab in Setup Editor).

If you need to validate additional registy entries then you could one or more System Searches (in WPS these can be configured by selecting System Search in the "Target System" section in Installation Expert).

Each search typically writes the value of the registry (if found) to a property of your own naming. A null value for the property implies the value was not found.

To terminate your installation if any of your criteria are not met, then add a Type 19 Custom action (shows as "Terminate Installation" in Setup Editor in WPS) with conditions based on the properties found in the System Search

Regards,

Spartacus
Answered 06/19/2008 by: spartacus
Black Belt

Please log in to comment
0
Thanks for response,
As per the requirement I have to add CA (Script), it has to validate against all mentioned above (Registries...etc) if it is satisfied then only application should install,
Can we use "IF Then Else Statement" , if yes means please guide me, Where I have to keep the CA, what is the commanline. plz,
Thanks
Sus
Answered 06/19/2008 by: Sus_pack
Senior Yellow Belt

Please log in to comment
0
Unfortunately for you it's not as easy as a simple command line.

In order for you to set conditions as you want to you will need to pass information (via properties) to and from your VBScript in order to use them as your conditions.

If you can't achieve what you need using the appsearch functionality detailled above then you'll need to do some research on using properties with VBScript custom actions. There is loads of info on these message boards alone about how to do this.

Probably not what you wanted to hear but if this packaging lark was that easy - everyone would be doing it...

Regards,
Rob.
Answered 06/19/2008 by: MSIPackager
Third Degree Black Belt

Please log in to comment
0
Hi ,
I am having VB script to check my requirement , If the requirement is not satisfied Script will prompt Failure message.
"So if the Failure message comes the Application should fail to install"
How can i achieve,
please give detail,

Thanks,
Sus
Answered 06/20/2008 by: Sus_pack
Senior Yellow Belt

Please log in to comment
0
As you seem determined to use a VB Script Custom Action, then you could include the following line in your VB script if the requirement is not satisfied.

session.property("CONDITIONSNOTMET") = "TRUE"

Then create a "Terminate Installation" Custom Action scheduled to run immediately after your VB Script Custom Action with the condition CONDITIONSNOTMET = "TRUE" - it might also be an idea to add the condition "Not Installed" both this and your own custom actions - you wouldn't really want these custom actions to run on repair or uninstall, would you :-)

So if you named your own VBScript Custom Action "CheckRequirements" and the Terminate Installation you named "TerminateIfReqsNotMet", then in WPS your MSI Script view would show something along the lines of


If NOT Installed then
Call VBScript From Embedded Code (CheckRequirements)
If CONDITIONSNOTMET <> "TRUE" then
Cancel Installation teminated, requirements not met (TerminateIfReqsNotMet)
End
End


(Apologies in advance to the WPS folks if this is less than optimal - too many years spent using InstallShield :-) )

Regards,
Spartacus
Answered 06/20/2008 by: spartacus
Black Belt

Please log in to comment
0
I presume you have a long list of items you need to check and, if one or more do not meet requirements, then the install is to fail? You *still* don't need script. Use AppSearch to test each requirement and set appropriate properties. Then, in your package, add a 'Terminate Installation' Custom Action with all the conditions requitred.

For example, let's say you want to check the existence of 2 registry entries and a file. You would
- create 3 properties e.g. Reg1Present, Reg2Present and FilePresent
- assign the value '0' to each
- add an AppSearch for all 3 items. At install time, the Windows Installer engine will populate those proprties with the registry values' contents or filename
- condition your Terminate Installation CA appropriately. If all 3 items need to be present, then your condition would look something like:
. If Reg1Present <> "0" AND Reg2Present <> "0" AND FilePresent <> "0"

If you insist script is the way you want to go, as Rob told you, you need to do some research.
Answered 06/20/2008 by: VBScab
Red Belt

Please log in to comment
0
Thanks for your inputs,
I have tried the Appsearch & launch condition as you all sugested, For registry search its not working as per requirement:
Requirement: Application should check for specific registry if it is there then it should install If not It should fail,
The registry Value name is JING (DWORD) value Data is 1
I have tried : Created one Property in Setup Editor SHARK value is 1,
In System search : Property :SHARK
Operation:Read Raw Value from registry
Root :HKLM
Key:Software\My package\Shark
Value name:JING
In Launch Condition :
Condition:SHARK = 1
Message text :Not a Member.

Please give some more detail about how to use "Terminate Custom action"
Thanks,
Sus
Answered 06/25/2008 by: Sus_pack
Senior Yellow Belt

Please log in to comment
0
ORIGINAL: Sus_pack

I have tried : Created one Property in Setup Editor SHARK value is 1,
THAT'S the problem. You're setting the property to be the same as the registry data.

Set the property's default value to something which it will never likely to be, e.g. "NODATA". Then, if AppSearch finds the registry data, it will populate that property with its content, in this case '1'. If it's not found, the property's value wil remain as 'NODATA'. Your condition should then check for that property NOT being 'NODATA', or '1', whichever route you prefer.
Answered 06/25/2008 by: VBScab
Red Belt

Please log in to comment
0
Thanks for the reply,
"Set the property's default value to something which it will never likely to be, e.g. "NODATA". Then, if AppSearch finds the registry data, it will populate that property with its content, in this case '1'. If it's not found, the property's value wil remain as 'NODATA'. Your condition should then check for that property NOT being 'NODATA', or '1', whichever route you prefer."

Can you explain some what more clearly plz
Thanks in advance
Sus
Answered 06/25/2008 by: Sus_pack
Senior Yellow Belt

Please log in to comment
0
Dear God...

In the 'Property' table, change the value of your SHARK property from '1' to 'NODATA'
Answered 06/25/2008 by: VBScab
Red Belt

Please log in to comment
0
I guess that another way around this would to be to use a VBScript CA as you originally planned and if the VBScript doesn't find the info you require to proceed then you could use the wscript.quit(1) command to quit out and make sure that the CA processing is set to Synchronous (not Synchronous, Ignore exit code)

That way if your CA fails then the install would rollback.

Not pretty in my opinion but should work in theory - if you are still struggling with the other recommended methods.

Hope it helps,
Rob.
Answered 06/25/2008 by: MSIPackager
Third Degree Black Belt

Please log in to comment
0
Hi,

I would explain from step 1 as to what I tried!

1.) Define a new property as SHARK = NODATA
2.) Define a system search in Installation expert for the registry value
3.) Create a Launch Condition as SHARK <> 1 then message text as "need a simple application"
4.) move the Appsearch sequence before Launch Condition in User Interface and Execute Immediate.

Please kindly let me know if any of the steps are case senstive.Defining a property should be in Uppercase (Public Property)

What else should be done!I am not able to terminate the installation if launch condition fails!
Answered 06/25/2008 by: Sus_pack
Senior Yellow Belt

Please log in to comment
0
Change the Launch condition as SHARK = "NODATA".

If the installer finds a different value other than "NO DATA", then the corresponding message will be shown and the installation will abort.
Answered 06/25/2008 by: getIT
Orange Senior Belt

Please log in to comment
0
I guess the above post may solve your problem
Answered 06/25/2008 by: prashanth
Orange Belt

Please log in to comment
0
Example registry tree :

HKLM\Software\MyPackage\Shark\ jing(value name) as 1 ( dword value)or 0 (dword value).

the problem is when the registry tree exists with either correct value or not,installation happens.

the installation aborts only when the Shark\Jing is not present in the end machine.It is not checking for the raw registry value for 0 or 1 and valuating the installation.
Answered 06/25/2008 by: Sus_pack
Senior Yellow Belt

Please log in to comment
0
ORIGINAL: Sus_pack
the installation aborts only when the Shark\Jing is not present in the end machine.It is not checking for the raw registry value for 0 or 1 and valuating the installation.
It sounds like you need 3 scenarios to be trapped: 1) where no entry exists; 2) where the entry is equal to '1'; 2) where the entry is equal to '0'. So you need to change the condition statement and/or add more LCs.
Answered 06/26/2008 by: VBScab
Red Belt

Please log in to comment
0
ORIGINAL: MSIPackager
then you could use the wscript.quit(1) command to quit out and make sure that the CA


I didn't think you could get away with using wscript.quit in a custom action ... or wscript.<anything> for that matter because the wscript object is provided by Windows Scripting Host, which isn't used by the installer.

Regards,

Spartacus
Answered 06/26/2008 by: spartacus
Black Belt

Please log in to comment
0
Very good point!

Do you know if you can quit out of a vbscript being called as a CA at all?

Off on a tangent here and it's not even being asked by the OP so don't worry too much about it...

Cheers,
Rob.
Answered 06/26/2008 by: MSIPackager
Third Degree Black Belt

Please log in to comment
0
ORIGINAL: MSIPackager
Do you know if you can quit out of a vbscript being called as a CA at all?
No, you can't. That's one reason why the vast majority of my VBS CAs are written as functions. On an error condition, I exit the function with a 'False' return value. That sets an error condition which the engine can act upon.
Answered 06/26/2008 by: VBScab
Red Belt

Please log in to comment
0
Hi,
Thanks so much to all of you,
Now i am able to search the Registry through Appsearch, If it is not there then my application will fail, It is now able to read Dword value.
The way i did : Property table added SHARK property value is NOT ASSIGNED,
In System search: Property: SHARK
Operation: Read raw value from registry
Root: HKLM
Key : Software\My package\Shark
Value Name: Jing

Then in MSI SCRIPT- Execute Immediate: Moved Appsearch to above the LaunchCondition,
Added If Statement below Appsearch like: If SHARK <> "#1" then
Added Terminate Installation CA and wrote the Message to display,
END statement.

New Issue : I have to check two Registry entries Either one is present Application should Install,
How can I give the If statement , Launchcondition, Appsearch , and How i have to provide PROPERTY.

Thanks in Advance,
Sus
Answered 07/02/2008 by: Sus_pack
Senior Yellow Belt

Please log in to comment
0
Do the same thing, except with two properties and two AppSearches and add an 'OR' statemet to the LaunchCondition :

If BLAH="whatever" or FOO="something_else"
Answered 07/02/2008 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity