I have a set properties custom action that I would like to utilize for two VBScript custom actions. How do I tie the two VBScripts to the set properties custom action? I'm guessing that it is in the Source column of the CustomAction table? Or is this not even possible and instead I have to have two set property custom actions even though the value is the same?
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
Are they embedded scripts running in Deferred Execute? If not, why bother? The hoop-jumping of naming the property with the same name as the CA is only required for that type of script.

I guess that would be better expressed as: What is it you're trying to achieve?
Answered 08/10/2009 by: VBScab
Red Belt

Please log in to comment
0
No, both scripts are in the binary table and run deferred execute(just before InstallFinalize). Is it possible to pass the same value from a set property custom action to two Custom Action VBscripts? My scenario is this: I need a script to run during install and a second script to run during uninstall. Both scripts need to be passed the same value from the set property custom action. So what is the standard method for accomplishing this type of thing?


ORIGINAL: VBScab

Are they embedded scripts running in Deferred Execute? If not, why bother? The hoop-jumping of naming the property with the same name as the CA is only required for that type of script.

I guess that would be better expressed as: What is it you're trying to achieve?

Answered 08/11/2009 by: joedown
Second Degree Brown Belt

Please log in to comment
0
The best approach would be to move the code which does the work and processes the variables into a function. Then, pass the properties to the function in the call.

Assuming:
- your function is called 'Main' and takes two parameters
- the Binary table entry is called MyScript
- you want to pass 2 properties, THISPROPERTY and THATPROPERTY

the Custom Action table would look like:
Action,Type,Source,Target
CA_ED_Whatever,3078,MyScript,Main([THISPROPERTY], [THATPROPERTY])
Answered 08/11/2009 by: VBScab
Red Belt

Please log in to comment
0
Can you explain the moving code into a function? I think I understand what you have stated below except for the function you called Main. Or are you talking about a function in my VBscript called Main? In which case my script is getting the properties from the session.property("CustomActionData") which I'm then splitting out into an array since I'm passing six properties into the script via the CustomActionData property.

ORIGINAL: VBScab

The best approach would be to move the code which does the work and processes the variables into a function. Then, pass the properties to the function in the call.

Assuming:
- your function is called 'Main' and takes two parameters
- the Binary table entry is called MyScript
- you want to pass 2 properties, THISPROPERTY and THATPROPERTY

the Custom Action table would look like:
Action,Type,Source,Target
CA_ED_Whatever,3078,MyScript,Main([THISPROPERTY], [THATPROPERTY])

Answered 08/11/2009 by: joedown
Second Degree Brown Belt

Please log in to comment
0
You may already be in an appropriate state but anyway...

Let's say your code looks like this currently:Dim objFSO
Dim strTargetFolder
Dim objFolder
Dim blnForceDeletion

Set objFSO = CreateObject("Scripting.FileSystemObject")

strTargetFolder = "C:\WINDOWS"
blnForceDeletion = True

With objFSO
If .FolderExists(strTargetFolder) Then
Set objFolder = .GetFolder(strTargetFolder)
objFolder.Delete blnForceDeletion
If .FolderExists(strTargetFolder) Then
WScript.Echo "Delete failed"
End If
End With
Set objFSO = Nothing



We want to turn that into a function which takes 2 parameters. Instead of 'Main' I'll call it DeleteFolder:Dim blnReturn

strTargetFolder = "C:\WINDOWS"
blnForceDeletion = True

blnReturn = DeleteFolder(strTargetFolder, blnForceDeletion)
If Not blnReturn Then
WScript.Echo "Delete failed"
End If

Function DeleteFolder(ByVal strTarget, ByVal blnForce)
Dim objFSO
Dim objFolder

DeleteFolder = False

Set objFSO = CreateObject("Scripting.FileSystemObject")

With objFSO
If .FolderExists(strTarget) Then
Set objFolder = .GetFolder(strTarget)
objFolder.Delete blnForce
If .FolderExists(strTarget) Then
Exit Function
End If
End With

DeleteFolder = True
Set objFSO = Nothing

End Function
Answered 08/11/2009 by: VBScab
Red Belt

Please log in to comment
0
This is the begining code in both my scripts:


propCommaDelim = Session.Property("CustomActionData")'Recieves comma delimitted list of properties that the MSI will pass in
propArray = Split(propCommaDelim,",")
StrRemoteSyncUser = propArray(0)
StrRemoteSyncPass= propArray(1)
StrLocalSQLUser = propArray(2)
StrLocalSqlPass = propArray(3)
StrRmsFarUser = propArray(4)
StrInstallFolder = propArray(5)


I thought the only way to pass properties to a deferred CA was to use a set property CA? Are you saying that I can just pass my property variables in the Target field?
Answered 08/11/2009 by: joedown
Second Degree Brown Belt

Please log in to comment
0
I thought the only way to pass properties to a deferred CA was to use a set property CA? Are you saying that I can just pass my property variables in the Target field?
Answered 08/12/2009 by: joedown
Second Degree Brown Belt

Please log in to comment
0
You're thinking about accessing properties from within the script. if you're passing properties to the script, proceed as directed.
Answered 08/13/2009 by: VBScab
Red Belt

Please log in to comment
0
Ok, that makes sense. Is there a way to specify a parameter to the main function in my script in addition to the properties?

Such as in the Target field we have Function"some parameter"([Property], [Property], etc)?
Answered 08/13/2009 by: joedown
Second Degree Brown Belt

Please log in to comment
0
Yup. Almost exactly like you have it there, except without the keyword 'Function'.

I didn't twig until now that you're passing the same property twice. I'm curious to know why you need to. Once it's passed to the function, you can manipulate its corresponding variable: there's no need to repeat it.
Answered 08/13/2009 by: VBScab
Red Belt

Please log in to comment
0
My script doesn't appear to be receiving the property values. I just want to make sure I'm doing this right. Going by the function example you have above my Target field would look like the following:

DeleteFolder([TargetFolder], [ForceDeletion])

My Target field:

Install([SYNCUSER], [SYNCPASS], [SQLUSER], [SQLPASS], [FARUSER], [TARGETDIR])

My function:

Public Sub Install(ByVal SYNCUSER, ByVal SYNCPASS, ByVal SQLUSER, ByVal SQLPASS, ByVal FARUSER, ByVal TARGETDIR)

StrRemoteSyncUser = SYNCUSER
StrRemoteSyncPass= SYNCPASS
StrLocalSQLUser = SQLUSER
StrLocalSqlPass = SQLPASS
StrRmsFarUser = FARUSER
StrInstallFolder = TARGETDIR
Answered 08/13/2009 by: joedown
Second Degree Brown Belt

Please log in to comment
0
AFAIK, you can't use Sub: it has to be a Function. Also, there's no need to duplicate things by assigning new variables to those which already exist. No need for the 'Public' keyword, either. TryFunction Install(ByVal strRemoteSyncUser, ByVal strRemoteSyncPass, ByVal strLocalSQLUser, ByVal strLocalSqlPass, ByVal strRmsFarUser, ByVal strInstallFolder)Then, in your function, just use the relevant variables as they are.
Answered 08/13/2009 by: VBScab
Red Belt

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