Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1276
  • Last Modified:

HTA front end for a Logonscript in VBS

Hello guys,

I have made a VBScript that does some very basic tasks like mapping network drivers and crreating printer connections. I wold like to wrap that script into a HTA and display the progress of the script when a user logs on. I am not really good with HTAs. Any pointers to where I can start would be highly appreciated. Following is the code.
I would like the HTA to display the name of the company on the top and the task currently running with a progress bar and exit when all tasks are done.

Happy to give more information if required.

Thanks,
VM

OPTION EXPLICIT
 
DIM strGroup, strUserPath, strGroupName, strGroupPath, strDomain, strUser, LogonServer, strUNCPrinter
DIM objNetwork, objFso, objShell, objOS, objWMIService, objUser, objGrp, objSysInfo, objSysEnv,  blnShowError
 
CONST ForReading = 1, ForWriting = 2
 
SET objSysInfo = CreateObject("ADSystemInfo")
SET objShell = WScript.CreateObject("WScript.Shell")
SET objFso = CreateObject("Scripting.FileSystemObject")
SET objSysEnv = objShell.Environment("PROCESS")
SET objNetwork = CreateObject("WScript.Network")
strUNCPrinter = "\\Sydprint\Xerox"
 
LogonServer = objShell.ExpandEnvironmentStrings("%LOGONSERVER%")
'Wscript.Echo LogonServer
strDomain = objNetwork.UserDomain
'Wscript.Echo strDomain
strUser = objNetwork.UserName
'Wscript.Echo strUser
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
' SERVER CHECK: This part of the script will check if the current machine is a server or not. If it is a server the script execution will end right here.
			'Connect to WMI and obtain instances of Win32_OperatingSystem
FOR EACH objOS IN GetObject( _  
						   "winmgmts:").InstancesOf ("Win32_OperatingSystem")
	IF NOT objOS.ProductType = 1 THEN
		Wscript.Echo objOS.ProductType
		Wscript.Quit
	END IF
NEXT
 
IF Err <> 0 THEN
	Err.Clear
END IF
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
'USER MEMBERSHIP CHECK: Checks the membership of the user and depending on it maps the corresponding network drives, printers if any
 
'ON ERROR RESUME NEXT 
 
'################################################### KAPSTREAM #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"BUG-BTQ-KAPSTREAM-Admin") THEN 
		MapIt "G:","\\CSSYDA012\Kapstream$"
		AddPrinterConnection strUNCPrinter
		Wscript.Quit
END IF
 
'################################################### GREENCAPE #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-MELC-Green Cape") THEN
		MapIt "G:","\\CSMELC010\Greencape$"
		Wscript.Quit
END IF
 
'################################################### 5 OCEANS# #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-SYDA-5oam") THEN
		MapIt "L:","\\CSSYDA012\CHALLSYD"
		AddPrinterConnection strUNCPrinter
		Wscript.Quit
END IF
 
'######################################################ARDEA ######################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"BUG-BTQ-ARDEA-AllUsers") THEN
		MapIt "Q:","\\CSSYDA012\Ardea$"
		AddPrinterConnection strUNCPrinter
		Wscript.Quit
END IF
 
 
'##################################################### KINETIC #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-MELC-Kinetic") THEN
		MapIt "G:","\\CSMELC010\Kinetic$"
		Wscript.Quit
END IF
 
'################################################################################################################
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
 
'Function that checks the group membership of the user
FUNCTION IsAMemberOf(strDomain,strUser,strGroup)
'ON ERROR RESUME NEXT
SET objUser=GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
SET objGrp=GetObject("WinNT://" & strDomain & "/" & strGroup & ",group")
 
	IF objGrp.IsMember(objUser.ADsPath) THEN
		IsAMemberOf=TRUE
		ELSE
			IsAMemberOf=FALSE
	END IF 
END FUNCTION
 
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
' Function that maps network drives
SUB MapIt(strDrive,strMap)
'ON ERROR RESUME NEXT
	IF objFSO.DriveExists(strDrive) THEN objNetwork.RemoveNetworkDrive(strDrive)
 
		objNetwork.MapNetworkDrive strDrive,strMap
 
			IF Err.Number<>0 AND blnShowError THEN
				strMsg="There was a problem mapping drive " & UCase(strDrive) & " to " &_
				strMap & VbCrLf & strHelpMsg & VbCrLf & "Error#:" & Hex(err.Number) &_
				VbCrLf & Err.Description
				objShell.Popup strMsg,iErrorTimeOut,"Error",vbOKOnly+vbExclamation
				Err.Clear
			END IF
 
END SUB
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
'Function that Maps the default printer. Only Maps \\SYDPRINT\XEROX to Sydney users
SUB AddPrinterConnection(strPrinterUNC)
ON ERROR RESUME NEXT
 
objNetwork.AddWindowsPrinterConnection strPrinterUNC
objNetwork.SetDefaultPrinter strPrinterUNC
 
IF Err.Number<>0 AND blnShowError THEN
	strMsg="There was a problem mapping " & UCase(strPrinterUNC) & ". " &_
	vbcrlf & VbCrLf & strHelpMsg & VbCrLf & "Error#:" & Hex(err.Number) &_
	VbCrLf & Err.Description
	
	objShell.Popup strMsg,iErrorTimeOut,"Error",vbOKOnly+vbExclamation
	Err.Clear
END IF
 
END SUB
 
SUB AddPrinterPortConnection(strPort,strPrinterUNC)
ON ERROR RESUME NEXT
 
objNetwork.AddPrinterConnection strPort,strPrinterUNC
 
IF Err.Number<>0 AND blnShowError THEN
	strMsg="There was a problem mapping " & UCase(strPrinterUNC) & " to " &_
	strPort & vbcrlf & VbCrLf & strHelpMsg & VbCrLf & "Error#:" & Hex(err.Number) &_
	VbCrLf & Err.Description
	
	objShell.Popup strMsg,iErrorTimeOut,"Error",vbOKOnly+vbExclamation
	Err.Clear
END IF
 
END SUB
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************

Open in new window

0
vithal_m
Asked:
vithal_m
4 Solutions
 
dkikalisCommented:
Tips....  
Make sure all of the code is in subrouties and functions.   Put the main login in a subrountine called Windows.onload.  Replace 'Wscript.Echo with oPre.innerText  = oPre.innerText  + "\n" +

Something like this
SUB window.onload

SET objSysInfo = CreateObject("ADSystemInfo")
SET objShell = WScript.CreateObject("WScript.Shell")
SET objFso = CreateObject("Scripting.FileSystemObject")
SET objSysEnv = objShell.Environment("PROCESS")
SET objNetwork = CreateObject("WScript.Network")
strUNCPrinter = "\\Sydprint\Xerox"
 
LogonServer = objShell.ExpandEnvironmentStrings("%LOGONSERVER%")
'Wscript.Echo LogonServer
strDomain = objNetwork.UserDomain
'Wscript.Echo strDomain
strUser = objNetwork.UserName
'Wscript.Echo strUser
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
' SERVER CHECK: This part of the script will check if the current machine is a server or not. If it is a server the script execution will end right here.
                  'Connect to WMI and obtain instances of Win32_OperatingSystem
FOR EACH objOS IN GetObject( _  
                                       "winmgmts:").InstancesOf ("Win32_OperatingSystem")
      IF NOT objOS.ProductType = 1 THEN
            Wscript.Echo objOS.ProductType
            Wscript.Quit
      END IF
NEXT
 
IF Err <> 0 THEN
      Err.Clear
END IF
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
'USER MEMBERSHIP CHECK: Checks the membership of the user and depending on it maps the corresponding network drives, printers if any
 
'ON ERROR RESUME NEXT
 
'################################################### KAPSTREAM #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"BUG-BTQ-KAPSTREAM-Admin") THEN
            MapIt "G:","\\CSSYDA012\Kapstream$"
            AddPrinterConnection strUNCPrinter
            Wscript.Quit
END IF
 
'################################################### GREENCAPE #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-MELC-Green Cape") THEN
            MapIt "G:","\\CSMELC010\Greencape$"
            Wscript.Quit
END IF
 
'################################################### 5 OCEANS# #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-SYDA-5oam") THEN
            MapIt "L:","\\CSSYDA012\CHALLSYD"
            AddPrinterConnection strUNCPrinter
            Wscript.Quit
END IF
 
'######################################################ARDEA ######################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"BUG-BTQ-ARDEA-AllUsers") THEN
            MapIt "Q:","\\CSSYDA012\Ardea$"
            AddPrinterConnection strUNCPrinter
            Wscript.Quit
END IF
 
 
'##################################################### KINETIC #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-MELC-Kinetic") THEN
            MapIt "G:","\\CSMELC010\Kinetic$"
            Wscript.Quit
END IF
 
END SUB



This Goes at the Top of the file
<html>
<head>
<title>Login Script</title>

<HTA:APPLICATION
     ID="objHTAHelpomatic"
     APPLICATIONNAME="Login Script"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
>


<SCRIPT Language="VBScript">
----Your stuff goes here

</SCRIPT>



This is a little demo from  the MS web site that is a good starting place.

<HTML>
<HEAD>
  <TITLE>HTA Demo</TITLE>
    <HTA:APPLICATION ID="oHTA"
     APPLICATIONNAME="myApp"
     BORDER="thin"
     BORDERSTYLE="normal"
     CAPTION="yes"
     ICON=""
     MAXIMIZEBUTTON="yes"
     MINIMIZEBUTTON="yes"
     SHOWINTASKBAR="no"
     SINGLEINSTANCE="no"
     SYSMENU="yes"
     VERSION="1.0"
     WINDOWSTATE="maximize"/>

  <SCRIPT>

  /* This function also retrieves the value of the commandLine property,
     which cannot be set as an attribute.  */
   
  function window.onload()
  {
     sTempStr = "applicationName  = " + oHTA.applicationName + "\n" +
                "border           = " + oHTA.border          + "\n" +
                "borderStyle      = " + oHTA.borderStyle     + "\n" +
                "caption          = " + oHTA.caption         + "\n" +
                "commandLine      = " + oHTA.commandLine     + "\n" +
                "icon             = " + oHTA.icon            + "\n" +
                "maximizeButton   = " + oHTA.maximizeButton  + "\n" +
                "minimizeButton   = " + oHTA.minimizeButton  + "\n" +
                "showInTaskBar    = " + oHTA.showInTaskbar   + "\n" +
                "singleInstance   = " + oHTA.singleInstance  + "\n" +  
                "sysMenu          = " + oHTA.sysMenu         + "\n" +
                "version          = " + oHTA.version         + "\n" +
                "windowState      = " + oHTA.windowState     + "\n" ;
             
     oPre.innerText = sTempStr;              
  }
  </SCRIPT>
</HEAD>
<BODY SCROLL="yes">
  <PRE ID=oPre>  </PRE>
</BODY>
</HTML>

0
 
RobSampsonCommented:
Hi there, I'm not so sure that a HTA is that good for logon scripts, because the system won't know how to launch one.  If you "really" want to us a HTA, you'd have to launch a VBS via Logon that runs
mshta.exe \\server\share\MyHTA.hta

But, as a workaround, you can have your VBS write directly to an Internet Explorer window, as I've shown in the code here with your logon script.  You only need to add new
Trace "This is your message"

statements.....

Regards,

Rob.
OPTION EXPLICIT
 
DIM oIE, strGroup, strUserPath, strGroupName, strGroupPath, strDomain, strUser, LogonServer, strUNCPrinter
DIM objNetwork, objFso, objShell, objOS, objWMIService, objUser, objGrp, objSysInfo, objSysEnv,  blnShowError
 
CONST ForReading = 1, ForWriting = 2
 
SET objSysInfo = CreateObject("ADSystemInfo")
SET objShell = WScript.CreateObject("WScript.Shell")
SET objFso = CreateObject("Scripting.FileSystemObject")
SET objSysEnv = objShell.Environment("PROCESS")
SET objNetwork = CreateObject("WScript.Network")
strUNCPrinter = "\\Sydprint\Xerox"
 
LogonServer = objShell.ExpandEnvironmentStrings("%LOGONSERVER%")
'Wscript.Echo LogonServer
strDomain = objNetwork.UserDomain
'Wscript.Echo strDomain
strUser = objNetwork.UserName
'Wscript.Echo strUser
 
Trace "Starting logon process."
Trace "Checking if this computer is a server..."
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
' SERVER CHECK: This part of the script will check if the current machine is a server or not. If it is a server the script execution will end right here.
			'Connect to WMI and obtain instances of Win32_OperatingSystem
FOR EACH objOS IN GetObject( _  
						   "winmgmts:").InstancesOf ("Win32_OperatingSystem")
	IF NOT objOS.ProductType = 1 THEN
		Wscript.Echo objOS.ProductType
		Wscript.Quit
	END IF
NEXT
 
IF Err <> 0 THEN
	Err.Clear
END IF
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
'USER MEMBERSHIP CHECK: Checks the membership of the user and depending on it maps the corresponding network drives, printers if any
 
'ON ERROR RESUME NEXT 
 
'################################################### KAPSTREAM #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"BUG-BTQ-KAPSTREAM-Admin") THEN 
		MapIt "G:","\\CSSYDA012\Kapstream$"
		AddPrinterConnection strUNCPrinter
		Wscript.Quit
END IF
 
'################################################### GREENCAPE #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-MELC-Green Cape") THEN
		MapIt "G:","\\CSMELC010\Greencape$"
		Wscript.Quit
END IF
 
'################################################### 5 OCEANS# #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-SYDA-5oam") THEN
		MapIt "L:","\\CSSYDA012\CHALLSYD"
		AddPrinterConnection strUNCPrinter
		Wscript.Quit
END IF
 
'######################################################ARDEA ######################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"BUG-BTQ-ARDEA-AllUsers") THEN
		MapIt "Q:","\\CSSYDA012\Ardea$"
		AddPrinterConnection strUNCPrinter
		Wscript.Quit
END IF
 
 
'##################################################### KINETIC #####################################################
 
IF IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"sg-MELC-Kinetic") THEN
		MapIt "G:","\\CSMELC010\Kinetic$"
		Wscript.Quit
END IF
 
'################################################################################################################
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
 
'Function that checks the group membership of the user
FUNCTION IsAMemberOf(strDomain,strUser,strGroup)
'ON ERROR RESUME NEXT
SET objUser=GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
SET objGrp=GetObject("WinNT://" & strDomain & "/" & strGroup & ",group")
 
	IF objGrp.IsMember(objUser.ADsPath) THEN
		IsAMemberOf=TRUE
		ELSE
			IsAMemberOf=FALSE
	END IF 
END FUNCTION
 
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
' Function that maps network drives
SUB MapIt(strDrive,strMap)
'ON ERROR RESUME NEXT
	IF objFSO.DriveExists(strDrive) THEN objNetwork.RemoveNetworkDrive(strDrive)
 
		objNetwork.MapNetworkDrive strDrive,strMap
 
			IF Err.Number<>0 AND blnShowError THEN
				strMsg="There was a problem mapping drive " & UCase(strDrive) & " to " &_
				strMap & VbCrLf & strHelpMsg & VbCrLf & "Error#:" & Hex(err.Number) &_
				VbCrLf & Err.Description
				objShell.Popup strMsg,iErrorTimeOut,"Error",vbOKOnly+vbExclamation
				Err.Clear
			END IF
 
END SUB
 
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
'Function that Maps the default printer. Only Maps \\SYDPRINT\XEROX to Sydney users
SUB AddPrinterConnection(strPrinterUNC)
ON ERROR RESUME NEXT
 
objNetwork.AddWindowsPrinterConnection strPrinterUNC
objNetwork.SetDefaultPrinter strPrinterUNC
 
IF Err.Number<>0 AND blnShowError THEN
	strMsg="There was a problem mapping " & UCase(strPrinterUNC) & ". " &_
	vbcrlf & VbCrLf & strHelpMsg & VbCrLf & "Error#:" & Hex(err.Number) &_
	VbCrLf & Err.Description
	
	objShell.Popup strMsg,iErrorTimeOut,"Error",vbOKOnly+vbExclamation
	Err.Clear
END IF
 
END SUB
 
SUB AddPrinterPortConnection(strPort,strPrinterUNC)
ON ERROR RESUME NEXT
 
objNetwork.AddPrinterConnection strPort,strPrinterUNC
 
IF Err.Number<>0 AND blnShowError THEN
	strMsg="There was a problem mapping " & UCase(strPrinterUNC) & " to " &_
	strPort & vbcrlf & VbCrLf & strHelpMsg & VbCrLf & "Error#:" & Hex(err.Number) &_
	VbCrLf & Err.Description
	
	objShell.Popup strMsg,iErrorTimeOut,"Error",vbOKOnly+vbExclamation
	Err.Clear
END IF
 
END SUB
'************************************************************************************************************************************************************************
'************************************************************************************************************************************************************************
 
Sub Trace(sMsg)
	If Not IsObject(oIE) Then
		Set oIE = CreateObject("InternetExplorer.Application")
		oIE.navigate "about:blank"
		oIE.ToolBar = False
		oIE.AddressBar = False
		oIE.Top = 10
		oIE.left = 10
		oIE.Width = 600
		oIE.Height = 300
		oIE.Visible = True
		oIE.menubar = False
		oIE.StatusBar = False
		oIE.Document.Body.Title = "Debug Messages"
	End If
	oIE.Document.writeln Date & " - " & smsg & "<br>"
End Sub

Open in new window

0
 
vithal_mAuthor Commented:
Hello Rob,

The workaround you've suggested seems to be working. I am trying to figure out how to close the IE window once the logonscript has finished what its doing. Also I've done some research on the IE Properties. I am unable to figure out how to disable the Minize, Maximize and Close buttons on the top right of IE window..

Any ideas?

http://www.microsoft.com/technet/scriptcenter/guide/sas_ent_qpyo.mspx?mfr=true

Thank you
VM
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
RobSampsonCommented:
Hi there.

To quit, you can use oIE.Quit
To remove the status bar, you can use the FullScreen property, but then resize the window with code anyway.

So I've combined both of those, and change the Trace sub routine.  Replace the existing Trace routine with the code below.

Now you can write as many Trace statements throughout as you like, and when you want to close it, run this line:
Trace "QUITIE"

and that will close it.

Regards,

Rob.
Sub Trace(sMsg)
	If Not IsObject(oIE) Then
		Set oIE = CreateObject("InternetExplorer.Application")
		oIE.navigate "about:blank"
		oIE.fullscreen = True
		oIE.ToolBar = False
		oIE.menubar = False
		oIE.StatusBar = False
		oIE.AddressBar = False
		oIE.Top = 10
		oIE.left = 10
		oIE.Width = 600
		oIE.Height = 300
		oIE.Visible = True
		oIE.Document.Body.Title = "Debug Messages"
	End If
	If sMsg <> "QUITIE" Then
		oIE.Document.writeln Date & " - " & smsg & "<br>"
	Else
		oIE.Quit
	End If
End Sub

Open in new window

0
 
vithal_mAuthor Commented:
Hello Rob,

Thanks heaps for your response. It was of great help.

Just wondering is there a way to get #### oIE.Document.Body.Title = "Debug Messages" #### this working. At the moment in the script I changed it to Logon Script in Progress but it does not show up in the title. I have attached a screenshot.

Also is there a way to center the text and change the font to something else and display a graphic. I found this article on MS http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar05/hey0316.mspx 
I've used this script and every time it processes the INNERHtml command it will replace the text that was previously displayed.

Thanks in Advance,

VM  





Title.bmp
0
 
RobSampsonCommented:
Hi, well, if you use the FullScreen trick, there is no title....it seems that the document.body.title doesn't work....

So, then you can just put your own heading, but you need to send Trace statements of HTML code. Here is an example VBS that I've just made to show you how to add an image and centre text in a table.

Are you familiar with HTML?

Regards,

Rob.
Dim oIE
 
Trace "<table width=90% align='center'>"
Trace "<tr>"
Trace "<td align='center'>"
Trace "<img src='\\server\share\img.bmp' height=100 width=100>"
Trace "</td>"
Trace "</tr>"
Trace "<tr>"
Trace "<td align='center'>"
Trace "<font color='red'><b>Logon script in progress...</b></font>"
Trace "</td>"
Trace "</tr>"
Trace "<tr>"
Trace "<td align='center'>"
Trace "<font color='blue'>This is a test</font>"
Trace "</td>"
Trace "</tr>"
Trace "</table>"
 
WScript.Sleep 3000
Trace "QUITIE"
Sub Trace(sMsg)
	If Not IsObject(oIE) Then
		Set oIE = CreateObject("InternetExplorer.Application")
		oIE.navigate "about:blank"
		oIE.fullscreen = True
		oIE.ToolBar = False
		oIE.menubar = False
		oIE.StatusBar = False
		oIE.AddressBar = False
		oIE.Top = 200
		oIE.left = 300
		oIE.Width = 600
		oIE.Height = 300
		oIE.Visible = True
		oIE.Document.Body.Title = "Debug Messages"
	End If
	If sMsg <> "QUITIE" Then
		oIE.Document.writeln smsg & ""
	Else
		oIE.Quit
	End If
End Sub

Open in new window

0
 
vithal_mAuthor Commented:
Hello Rob,

Thanks for the response. I will give it a try.
Yes I am familiar with HTML.

Thanks,
VM
0
 
vithal_mAuthor Commented:
Brilliant!! I was no where two days ago..but now I have a fully working solution. Great help from both of you guys. I wish I could award more points but 500 is all I can...Thanks to "dkikalis" for his help wtih HTAs and special thanks to Rob for all his help with this and IE front end.

Thanks again guys

VM
0
 
RobSampsonCommented:
No problem.  Thanks for the grade.

Regards,

Rob.
0
 
vithal_mAuthor Commented:
Hi Rob,

This is how the final product looks like

Thanks heaps for your help again.

Final.bmp
0
 
RobSampsonCommented:
Very nice!  Good work.  Did the Fullscreen not work?  Or you didn't bother with it?  I suspect that as it is, if you close the IE window, you'll get an error....

Rob.
0
 
RobSampsonCommented:
Although of course you can always ALT + F4 anyway.....
0
 
vithal_mAuthor Commented:
yeah the full screen worked but I thought the users might not be comfortable with the whole screen being occupied by IE..

As you said the error came up but not when I close IE but i think it was more to do with the timing and the sequence of using Wscript.Quit or oIE.Quit....I did Quit IE first and then sleep for 3 seconds and then quit Wscript....

by the way I was looking at having logging facility in that window. if in case the script encounters some error duing processing....i would like to pause it and give the user an option to dump the log into a text file and may be if they want call the help desk....not a big deal...its a nice to have thing i guess.

Cheers
VM


0
 
vithal_mAuthor Commented:
I am a bit concerned that this post might be open to public viewing as I have attached the actual code that will be used...is there a way that we can remove the code from this post...or hide it from public viewing?

VM
0
 
RobSampsonCommented:
Hi, you can use the "Request Attention" button at the top, and ask that your server names, and whatever else you feel is inappopriate, to be changed to just "server".  An EE page editor will hopefully do that for you.

As for logging, you have the basis for the screen output, so if you do a bit of error checking, you can do, say
On Error Resume Next
objNetwork.MapNetworkDrive "H:", "\\server\share"
If Err.Number <> 0 Then
   Trace "There was an error mapping H drive."
   btn_SaveOutput.visible = True
End If

but this approach requires that you have a fair bit more code...

btn_SaveOutput would be a hidden button on the page that you make, and when there's an error, this will be visible, and a user can click it to run the "save" code.

Regards,

Rob.
0
 
MiahmichnoCommented:
Rob, why would I get network path not found for line 94
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now