O.P. RE: Script working on WinXP 32 bit but not working on Win 7 64bit
The script I posted has too many smileys. I am sending it again
<html>
<head>
<title>FTP NAP zip</title>
<HTA:APPLICATION
APPLICATIONNAME="FTP NAP zip"
ID="FTPNAPzip"
SINGLEINSTANCE="yes"/>
</head>
<script language="VBScript">
Const strLocalFolder = "C:\Temp"
Dim NAPPrefix
Dim FolderName
Dim NAPSystem
Dim NAPNetwork
Dim NAPUtility
Dim strTarget
Dim strSource
Dim dtmStartTime
Dim WZPasswd
Dim NAPSoftware
Sub ClearTimer ()
window.clearTimeout(idTimer)
End Sub
Sub WaitTimer ()
dtmStartTime = Now
idTimer = window.setTimeout("ClearTimer", 3000, "VBScript")
End Sub
Sub GeneratePassword()
Randomize
Const PassLen = 8
Const sChar = "abcdefghijklmnopqrstuvwxyz"
Dim strS
For intI = 1 To PassLen
strS = strS + Mid(sChar, Int(Rnd() * Len(sChar))+1, 1)
Next
WZPasswd=strS
End Sub
Sub WinZipSub()
Const ZIP_EXE = "WZZIP.EXE"
Dim objWZShell
Set objWZShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strWinzipScriptFileName = "c:\Temp\Winzipscr.cmd"
Set objZipFile = objFSO.CreateTextFile(strWinzipScriptFileName, True)
objZipFile.WriteLine ("cd\ " )
objZipFile.WriteLine ("cd C:\Program " & "Files\Winzip\")
GeneratePassword()
strSysSource = strLocalFolder & "\" & NAPLevel.Value & "\" & NAPSystem
strSysTarget = strSysSource &".zip"
zipSyscommand = ZIP_EXE & " -s" & WZPasswd & " " & strSysTarget & " " & strSysSource
objZipFile.WriteLine (zipSyscommand)
GeneratePassword()
strNetSource = strLocalFolder & "\" & NAPLevel.Value & "\" & NAPNetwork
strNetTarget = strNetSource &".zip"
zipNetcommand = ZIP_EXE & " -s" & WZPasswd & " " & strNetTarget & " " & strNetSource
objZipFile.WriteLine (zipNetcommand)
GeneratePassword()
strUtilSource = strLocalFolder & "\" & NAPLevel.Value & "\" & NAPUtility
strUtilTarget = strUtilSource &".zip"
zipUtilcommand = ZIP_EXE & " -s" & WZPasswd & " " & strUtilTarget & " " & strUtilSource
objZipFile.WriteLine (zipUtilcommand)
objZipFile.Close
objWZShell.Run strWinzipScriptFileName,10,true
End Sub
Sub FTPFromTRPROGD
Const strHostname = "TRPROGD"
Const strPort = 21
Const strUsername = "SYSGENNAP"
Dim strPasswd
Dim oExec
strPasswd = Password.Value
strFTPScriptFileName = strLocalFolder & "\FTPConnectionInfo.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objMyFile = objFSO.CreateTextFile(strFTPScriptFileName, True)
objMyFile.WriteLine ("open " & strHostname)
objMyFile.WriteLine (strUsername)
objMyFile.WriteLine (strPasswd)
objMyFile.WriteLine ("bin")
objMyFile.WriteLine ("lcd " & strLocalFolder & "\" & NAPLevel.Value)
objMyFile.WriteLine ("get " & NAPSystem)
ObjMyFile.WriteLine ("get " & NAPNetwork)
ObjMyFile.WriteLine ("get " & NAPUtility)
objMyFile.WriteLine ("bye")
objMyFile.Close
'The following code executes the FTP script. It creates a Shell
'object and runs FTP program on top of it.
Dim objShell
Set objShell = CreateObject("WScript.Shell")
Set oExec = objShell.Exec ("ftp -s:" & strFTPScriptFileName & " >>" & strLocalFolder & "\" & NAPLevel.Value &"\FTPLog.txt")
Do While oExec.Status = 0
WaitTimer
Loop
MsgBox "Download complete"
WinZipSub ()
End Sub
Sub CreateLocalDir ()
Dim oFSO
FolderName = "C:\\Temp\\" & NAPLevel.Value
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FolderExists(FolderName) Then
MsgBox " Folder Not created. Already exists."
Else
oFSO.CreateFolder(FolderName)
End If
FTPFromTRPROGD()
End Sub
Sub BuildNAPFiles()
NAPSystem = NAPPrefix & "NAPSYSTM"
NAPNetwork = NAPPrefix & "NAPNETWK"
NAPUtility = NAPPrefix & "NAPUTIL"
CreateLocalDir()
End Sub
Sub OnClickButtondisplay()
For i=0 to myradio.length-1
If myradio(i).Checked Then
NAPPrefix = myradio(i).Value
BuildNAPFiles()
Exit For
End If
Next
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#AAAAAA', EndColorStr='#737373')">
<!--Add your controls here-->
<input type="radio" name="myradio" CHECKED value="221">NAP221<BR>
<input type="radio" name="myradio" value="231">NAP231<BR>
<input type="radio" name="myradio" value="241">NAP241<BR>
Enter the Nap Release ID without the decimal (.).
e.g. For 24.113 enter 24113
<input type="text" name="NAPLevel" maxlength = "5" size = "10" id="NAPLevel"><BR>
<BR><BR>
Hostname : TRPROGD <BR>
Password (Case Sensitive):
<input type="password" name="Password" id="Password"><BR><BR>
<input type="button" name="Start" id="Start" value="Start " onclick="OnClickButtondisplay">
<BR><BR><BR><BR>
**************************************************************HELP********************************* <BR>
The program connects to TRPROGD using SYSGENNAP usercode and download <BR>
the NAPSystem, NAPNetwork and NAPUtil files under C:\Temp\"Release ID" folder. <BR><BR><BR><BR>
1. Select the level of NAP that you want to download. <BR>
2. Enter the Nap Release ID without the decimal (.). <BR>
e.g. For 24.113 enter 24113 <BR>
3. Enter the password of SYSGENNAP usercode <BR>
<BR>
***********************************************************<BR>
<!--{{InsertControlsHere}}-Do not remove this line-->
</body>
</html>
|