Embed VBscript in a Macro
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
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
Answers (5)
Please log in to answer
Posted by:
jmcfadyen
17 years ago
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
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
Posted by:
jmcfadyen
17 years ago
Posted by:
jmcfadyen
17 years ago
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
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
Posted by:
MarkH
17 years ago
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
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
Posted by:
jmcfadyen
17 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.