vbscript in a custom action
first the disclaimer: I'm new to installshield, and vbscript, not new to scripting (go autoit!)...
I've got a feeling this is a real newb type question, and that I maybe should be posting in the Package Development forum (feel free to slap me if that's the case)
I've got a vbscript, that on it's own works, just copying a file before the install, I've pasted it into a custom action and it doesn't work. I get the 1720 error. when I look at the application eventlog, it tells me the problem's at line 20, that's where I'm instantiating the "scripting.filesystemobject" object. Can I not use the FSO from within a custom action?
the error from eventlog:
the script:
If the FSO just won't work, what's the best alternate route? Learn InstallScript?
Thank you in advanced for any help,
Emmanuel
I've got a feeling this is a real newb type question, and that I maybe should be posting in the Package Development forum (feel free to slap me if that's the case)
I've got a vbscript, that on it's own works, just copying a file before the install, I've pasted it into a custom action and it doesn't work. I get the 1720 error. when I look at the application eventlog, it tells me the problem's at line 20, that's where I'm instantiating the "scripting.filesystemobject" object. Can I not use the FSO from within a custom action?
the error from eventlog:
Product: Petty Cash.TEST -- Error 1720.There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action PSE_BACKUP_PETTYCASH script error -2146827788, Microsoft VBScript runtime error: Variable is undefined: 'WScript' Line 22, Column 1,
the script:
'==========================================================================
'
' VBScript Source File
'
' NAME: backup_petty_cash.vbs
'
' AUTHOR: Emmanuel Pleshe , Puget Sound Energy
' DATE : 4/5/2005
'
' COMMENT:
'
'==========================================================================
Option Explicit
Dim objFSO, sSource, sDest, iDateTime
iDateTime = (Hour(Now)) & ":" & (Minute(Now)) & " " & (Day(Now)) & "-" & (Month(Now)) & "-" & (Year(Now))
sSource = "C:\program files\SAP Tools\pettycash.xls"
sDest = "C:\program files\SAP Tools\PettyCash Backup " & iDateTime & ".xls"
'WScript.Echo sDest
Set objFSO = WScript.CreateObject("scripting.filesystemobject")
If (objFSO.FileExists(sSource)) Then
objFSO.CopyFile sSource, sDest, 1
End If
If the FSO just won't work, what's the best alternate route? Learn InstallScript?
Thank you in advanced for any help,
Emmanuel
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
Robo Scripter
19 years ago
Try this:
***************************************************************************
Option Explicit
Dim objFSO, sSource, sDest, iDateTime
iDateTime = (Hour(Now)) & ":" & (Minute(Now)) & " " & (Day(Now)) & "-" & (Month(Now)) & "-" & (Year(Now))
sSource = "C:\program files\SAP Tools\pettycash.xls"
sDest = "C:\program files\SAP Tools\PettyCash Backup " & iDateTime & ".xls"
'WScript.Echo sDest
Set objFSO = CreateObject("scripting.filesystemobject")
If (objFSO.FileExists(sSource)) Then
objFSO.CopyFile sSource, sDest, 1
End If
***************************************************************************
***************************************************************************
Option Explicit
Dim objFSO, sSource, sDest, iDateTime
iDateTime = (Hour(Now)) & ":" & (Minute(Now)) & " " & (Day(Now)) & "-" & (Month(Now)) & "-" & (Year(Now))
sSource = "C:\program files\SAP Tools\pettycash.xls"
sDest = "C:\program files\SAP Tools\PettyCash Backup " & iDateTime & ".xls"
'WScript.Echo sDest
Set objFSO = CreateObject("scripting.filesystemobject")
If (objFSO.FileExists(sSource)) Then
objFSO.CopyFile sSource, sDest, 1
End If
***************************************************************************
Posted by:
Emmanuel Pleshe
19 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.