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:
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

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
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


***************************************************************************
Answered 04/06/2005 by: Robo Scripter
Orange Senior Belt

Please log in to comment
0
coolness, that works!

So, no need for the wscript. from within packages, that's the key, huh?
Answered 04/06/2005 by: Emmanuel Pleshe
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share