Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script help

Status
Not open for further replies.

Briandr

MIS
Jul 11, 2003
177
US
Hi,

This is a vbscript dealing with zip file. According to this code I found online if the outFolder does not exist, it should be created automatically. Any ideas as to what may be wrong? What I am also not sure about is where the zip file should reside so the script can find it.

Here is the link from the original script I found:


Thanks

Const NOCONFIRMATION = &H10&
Const NOERRORUI = &H400&
Const SIMPLEPROGRESS = &H100&

cFlags = NOCONFIRMATION + NOERRORUI + SIMPLEPROGRESS

strZipFile = "\PrinterInstaller.zip"
outFolder = "C:\Program Files (x86)\Print\Print Utility"

Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.GetFolder(".\C:\Program Files (x86)\Print\Print Utility")

If Not fso.FolderExists(outFolder) Then
fso.CreateFolder(outFolder)
End If

Set objShell = CreateObject("Shell.Application")
Set objSource = objShell.NameSpace(f1+strZipFile).Items()
Set objTarget = objShell.NameSpace(outFolder)
objTarget.CopyHere objSource, cFlags

Set WshShell = WScript.CreateObject("WScript.Shell")
Set oShellLink = WshShell.CreateShortcut(SM & "Printer Installer 1.lnk")
oShellLink.TargetPath = PATH & "Print Utility\Launcher.exe"
oShellLink.WorkingDirectory = PATH & "Print Utility\"
oShellLink.IconLocation = PATH & "Print Utility\printer.ico"
oShellLink.Save

Set WshShell = WScript.CreateObject("WScript.Shell")
Set oShellLink = WshShell.CreateShortcut(SM & "Printer Installer 2.lnk")
oShellLink.TargetPath = PATH & "Print Utility\Launcher.exe"
oShellLink.WorkingDirectory = PATH & "Print Utility\"
oShellLink.IconLocation = PATH & "Print Utility\printer.ico"
oShellLink.Save
 
Assuming the source script is correct, the first thing to change is deleting the [tt].\[/tt] from below:
Code:
Set f1 = fso.GetFolder("[highlight #FCE94F][s].\[/s][/highlight]C:\Program Files (x86)\Print\Print Utility")

>What I am also not sure about is where the zip file should reside so the script can find it.
You have to tell your script where the zip file is. According to your code (the line below) your script expects the zip file in "C:\Program Files (x86)\Print\Print Utility\PrinterInstaller.zip". If this is not correct, you should change your code.

Code:
Set objSource = objShell.NameSpace(f1+strZipFile).Items()

Also, if you get error messages, you should indicate what error you get and what line caused it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top