Hi

This has been driving me crazy

Trying to setup a Macro for a Custom Action

rem SETPERMS
If RowExists(tblCustomAction, SETPERMS)Then
Else
Set rowNew = tblCustomAction.NewWRow(True)
rowNew("Action") = "SETPERMS"
rowNew("Type") = 3174
rowNew("Source") = ""
rowNew("Target") = ""
End If

How do I insert a vbscript in

rowNew("Target") = ""

If I cut and paste the script the CRLF 's cause the macro editor to think it's a new line of macro code and not my embedded vbscript
if I remove all the CRLF's from the vbscript then all the text between the " " stays pink but the code wont work :-(

Help Appreciated

Mark
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
CreateCustomAction(strAction,strType,strSource,strTarget)
Dim rowNew
Dim tblCustomAction

Set tblCustomAction = WTables("CustomAction")
If Not RowExists("CustomAction", strAction)Then
Set rowNew = tblCustomAction.NewWRow(True)
rowNew("Action") = strAction
rowNew("Type") = strType
rowNew("Source") = strSource
rowNew("Target") = strTarget
Else
End If
Set RowNew = Nothing
Set tblCustomAction = Nothing
End Sub
Answered 08/19/2007 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
by the way this method works on all tables.

If you want to get serious you can make a single input parameter as an array. Then you can have a single sub / function which can handle all tables
Answered 08/19/2007 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
sorry Mark,

I was daydreaming I just clicked as to your original question.

try this one it uploads a script into the binary table. Then can use the other script above to add what you like.


CreateBinaryRow(strBinaryFile,strBinaryName)

Dim tblBinary,rowBinary
Set tblBinary = WTables("Binary" )

If Not RowExists("Binary", strBinaryName)Then
Set rowBinary = tblBinary.NewWRow
rowBinary("Name" ) = strBinaryName
rowBinary.AccessBinaryData "Data" , 0, strBinaryFile
End If

' rowBinary("Name" ) = " Callmf2"
' rowBinary.AccessBinaryData " Data" , 0, " C:\mf2.vbs"

End Sub
Answered 08/19/2007 by: jmcfadyen
Fifth Degree Black Belt

Please log in to comment
0
Thanks Jim,

I managed to cobble it together as rowNew("Target") = "Option Explicit" & vbCrlf &"Const HIDE_WINDOW = 0" ...

and end up with some horrible string

I like you would have put the script in the binaries table and called that. However where I'm at at the moment seem loathed to change they cut and paste the script in with every new msi or mst. Wise 7 seems to store the script in the CA table even though the field is only supposed to be 255 characters.

I've used the declarations.zip file you posted some time back to automate loads its just this was doing my head in
Answered 08/24/2007 by: MarkH
Yellow Belt

Please log in to comment
0
you need to be careful with going over the 255 char limit. In some cases / environments it will honour the limit and cause the script to fail.

EdT from Wise forums has in depth explanation on how this happens and why. I would suggest chatting to him or searching his posts.
Answered 08/26/2007 by: jmcfadyen
Fifth Degree Black Belt

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