Webmaster Forum

Go Back   Webmaster Forum > Scripting/Programming & Debugging > ASP & VBScript Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2007, 03:11 PM
MTBER MTBER is offline
Junior Member
 
Join Date: Jul 2007
Posts: 4
MTBER is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Question Opening an Application!

Hi,

I am trying to make a script that maps network drives. and i need to use IE as the viewing window. i am new to VBScript can anyone help me. does anyone know how to open an application with VBScript.

Thanks,
Reply With Quote

This ad is part of our Revenue Sharing program
  #2 (permalink)  
Old 07-03-2007, 10:56 PM
ALL's Avatar
ALL ALL is offline
Senior Member
 
Join Date: Oct 2006
Location: Sturgis, SD
Posts: 145
ALL is on a distinguished road
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

If you are trying to do this within IE, you will probably have little luck, because IE is pretty good at limiting JS and VBS.

I am not 100% on this, but i do not believe it is possable without making an extension/addon.

There might also be an object do to that, but unlikely that is built in,
-ALL
Reply With Quote
  #3 (permalink)  
Old 07-10-2007, 07:13 PM
MTBER MTBER is offline
Junior Member
 
Join Date: Jul 2007
Posts: 4
MTBER is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

I am trying to get IE to only open once and then run a script that will appear in that window. as of right now i have IE opening each time a drive is being mapped and i want to eliminate this so that i can use a table to show which drives have been mapped.
Reply With Quote
  #4 (permalink)  
Old 07-10-2007, 08:34 PM
ALL's Avatar
ALL ALL is offline
Senior Member
 
Join Date: Oct 2006
Location: Sturgis, SD
Posts: 145
ALL is on a distinguished road
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

try this...

HTML Code:
<script language="vbscript"> sub execute (byval program) set objShell=CreateObject("Wscript.Shell") objShell.Run(program) end sub execute("http://www.google.com/") </script>
Reply With Quote
  #5 (permalink)  
Old 07-11-2007, 12:03 PM
MTBER MTBER is offline
Junior Member
 
Join Date: Jul 2007
Posts: 4
MTBER is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Post

That code works it just doesent work the way i need it to. here is my code so you can see what i have. as of right now i have IE opening each time that a drive is being mapped and i am trying to get it so that IE only opens once.

Code:
Option Explicit const pcstrPath = ";G:\SYSINFO;F:\Public" const pcstrC3Server = "\\Z02DBCVSC01\" dim OIE,Time_out,Title,Button set oIE = CreateObject("InternetExplorer.Application") Modeless oIE, "VSC Logon Script is running, please wait..." Dim pstrUserName,pstrGroups,pstrFailed,pstrSpecialVolChar Modeless oIE, "VSC Logon Script is running, please wait...</p></p> getting User Name" pstrUserName = fstrGetUserProperty("samAccountName") Modeless oIE, "VSC Logon Script is running, please wait...</p></p> getting group membership" pstrGroups = ucase(fstrGetUserProperty("MemberOf")) if InStr(pstrGroups, "VSC C3 SERVICE ACCOUNTS") then pstrSpecialVolChar = "Z" end if If fblnMapDriveAndFolder("I:", "\\Z02APPVSC01\User Share", "\" & pstrUserName) = False Then pstrFailed = pstrFailed & "</p>" & "I:" & "\\Z02APPVSC01\User Share\" & pstrUserName & "\ Has NOT been mapped" End If Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "G:" & pcstrC3Server & pstrSpecialVolChar & "RAFACSII$\" If fblnMapDriveAndFolder("G:", pcstrC3Server & pstrSpecialVolChar & "RAFACSII$", "") = False Then pstrFailed = pstrFailed & "</p>" & "G:" & pcstrC3Server & pstrSpecialVolChar & "RAFACSII$\ Has NOT been mapped" End If Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "H:" & pcstrC3Server & pstrSpecialVolChar & "RAFACS$\" If fblnMapDriveAndFolder("H:", pcstrC3Server & pstrSpecialVolChar & "RAFACS$", "") = False Then pstrFailed = pstrFailed & "</p>" & "H:" & pcstrC3Server & pstrSpecialVolChar & "RAFACS$\ Has NOT been mapped" End If if InStr(pstrGroups, "VSC USERS - CIS") then Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "J:\\Z02RSCVSC04\NOVAShare\MIS\LOCAL" If fblnMapDriveAndFolder("J:", "\\Z02RSCVSC04\NOVAShare\MIS\LOCAL", "") = False Then pstrFailed = pstrFailed & "</p>" & "J:" & "\\Z02RSCVSC04\NOVAShare\MIS\LOCAL Has NOT been mapped" End If end if Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "K:\\Z02APPVSC01\PUBARC\" If fblnMapDriveAndFolder("K:", "\\Z02APPVSC01\PUBARC", "") = False Then pstrFailed = pstrFailed & "</p>" & "K:" & "\\Z02APPVSC01\PUBARC\ Has NOT been mapped" End If if InStr(pstrGroups, "VSC USERS - CIS") then Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "L:\\Z02RSCVSC04\APPLShare\" If fblnMapDriveAndFolder("L:", "\\Z02RSCVSC04\APPLShare\", "") = False Then pstrFailed = pstrFailed & "</p>" & "L:" & "\\Z02RSCVSC04\APPLShare\ Has NOT been mapped" End If end if ' if InStr(pstrGroups, "VSC C3 Service Accounts") then ' Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "L:\\Z02RSCVSC04\APPLShare\" ' If fblnMapDriveAndFolder("L:", "\\Z02RSCVSC04\APPLShare\", "") = False Then ' pstrFailed = pstrFailed & "</p>" & "L:" & "\\Z02RSCVSC04\APPLShare\ Has NOT been mapped" ' End If ' end if Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "M:" & pcstrC3Server & pstrSpecialVolChar & "IMROOT$\" If fblnMapDriveAndFolder("M:", pcstrC3Server & pstrSpecialVolChar & "IMROOT$", "") = False Then pstrFailed = pstrFailed & "</p>" & "M:" & pcstrC3Server & pstrSpecialVolChar & "IMROOT$\ Has NOT been mapped" End If ' 'Sets up mappings for Supervisory share - \\Z02RSCVSC04\MGMTShare - Added by Rene 12/19/2006 ' if InStr(pstrGroups, "VSC _ADJUDICATIONS_MGMT_ZEN - CIS") then Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "N:\\Z02RSCVSC04\SUPVShare\" If fblnMapDriveAndFolder("N:", "\\Z02RSCVSC04\SUPVShare", "") = False Then pstrFailed = pstrFailed & "</p>" & "N:" & "\\Z02RSCVSC04\SUPVShare\ Has NOT been mapped" End If end if if InStr(pstrGroups, "VSC _SIIO_ZEN - CIS") then Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "N:\\Z02RSCVSC04\SUPVShare\" If fblnMapDriveAndFolder("N:", "\\Z02RSCVSC04\SUPVShare", "") = False Then pstrFailed = pstrFailed & "</p>" & "N:" & "\\Z02RSCVSC04\SUPVShare\ Has NOT been mapped" End If end if if InStr(pstrGroups, "VSC _N_DRIVE - CIS") then Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "N:\\Z02RSCVSC04\SUPVShare\" If fblnMapDriveAndFolder("N:", "\\Z02RSCVSC04\SUPVShare", "") = False Then pstrFailed = pstrFailed & "</p>" & "N:" & "\\Z02RSCVSC04\SUPVShare\ Has NOT been mapped" End If end if ' 'End of Supervisory share mappings ' Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping " & "Checking to see if using Citrix" if fblnCitrix = false then Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Mapping P:\\Z02C4CVSC01\DocProd" If fblnMapDriveAndFolder("P:", "\\Z02C4CVSC01\DocProd", "") = False Then pstrFailed = pstrFailed & "</p>" & "P:\\Z02C4CVSC01\DocProd Has NOT been mapped" End If end if Modeless oIE, "VSC Logon Script is running, please wait...</p></p>Setting the PATH variable" if fblnSetUserEnvVar("PATH",pcstrPath,True) = false then pstrFailed = pstrFailed & "</p>" & "Could not set the Path environment variable to: " & "</p>" & pcstrPath end if if pstrFailed <> "" then Modeless oIE, " The following Errors Occured:" & pstrFailed call pause(10) 'pause for 5 seconds end if 'Close the Splash Screen oIE.quit 'Determines whether is the drive is already mapped ' If it is mapped to the wrong location this function will map it to ' the correct one ' else if drive doesn't exist then ' map it ' Yuppers Get 'R Done Function fblnMapDriveAndFolder(strDriveLetter,strServerName, strPath) On Error resume next fblnMapDriveAndFolder = True Dim pobjFsys Set pobjFsys = CreateObject("Scripting.FileSystemObject") 'correction for wrong slash strServerName = Replace(strServerName, "/", "\") strPath = Replace(strPath, "/", "\") 'Below will put a "\\" on the front of the server name if it doesn't exist If Left(strServerName, 2) <> "\\" Then strServerName = "\\" & strServerName End If 'Below will put take the "\" off of the end of the server name if it exists If Right(strServerName, 1) = "\" Then strServerName = Left(strServerName, Len(strServerName) - 1) End If 'Below will put a "\" on the front of the path name if it doesn't exist If Left(strPath, 1) <> "\" And strPath <> "" Then strPath = "\" & strPath End If 'Below will put a ":" on the end of the strDriveLetter if it doesn't exist If Right(strDriveLetter, 1) <> ":" Then strDriveLetter = Left(strDriveLetter, 1) & ":" End If If pobjFsys.FolderExists(strServerName & strPath) = False Then 'Create the folder because it doesn't exist pobjFsys.CreateFolder strServerName & strPath & "\" End If 'Check to see if the drive is already mapped If pobjFsys.DriveExists(strDriveLetter) = True Then 'Check to see if the drive letter is mapped to the correct folder If pobjFsys.FolderExists(strDriveLetter & strPath) = False Or strPath = "" Then 'The drive is mapped to the wrong location 'Map over the existing drive with the correct path If fblnMapDrive(strDriveLetter, strServerName, strPath, True) = False Then fblnMapDriveAndFolder = false End If End If Else 'The drive doesn't exist 'Map the drive If fblnMapDrive(strDriveLetter, strServerName, strPath, False) = False Then fblnMapDriveAndFolder = false End If End If Set pobjFsys = Nothing If Err.Number <> 0 Then err.clear fblnMapDriveAndFolder = False End If End Function Function fblnMapDrive(strDriveLetter, strServer, strFolderPath, blnRemoveFirst)' As Boolean On Error resume next fblnMapDrive = True Dim objNetwork ' Purpose of script to create a network object. (objNetwork) ' Then to apply the MapNetworkDrive method. Set objNetwork = CreateObject("WScript.Network") If blnRemoveFirst = True Then objNetwork.RemoveNetworkDrive strDriveLetter, True, True End If objNetwork.MapNetworkDrive strDriveLetter, strServer & strFolderPath, True If Err.Number <> 0 Then fblnMapDrive = False End If End Function function fblnSetUserEnvVar(strVariable, strValue, blnConcat) on Error resume next dim wshShell, pobjEnv fblnSetUserEnvVar = true set WshShell = CreateObject("WScript.Shell") Set pobjEnv = WshShell.Environment("User") if blnConcat = true then pobjEnv(strVariable) = pobjEnv(strVariable) & strValue else pobjEnv(strVariable) = strValue end if if err.number <> 0 then fblnSetUserEnvVar = false err.clear end if end function Function fblnCitrix() Dim strComputer Dim objWMIService Dim clSettings Dim objRecord fblnCitrix = true on error resume next strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set clSettings = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") fblnCitrix = false For Each objRecord In clSettings if objRecord.WindowsDirectory <> "" then if left(objRecord.WindowsDirectory,2) = "P:" then fblnCitrix = true exit for end if end if Next if err.number <> 0 then msgbox err.description, "fblnCitrix",vbcritical end if Set objWMIService = Nothing Set clSettings = Nothing End Function 'This function will return the specified property Function fstrGetUserProperty(strProperty) On Error resume next Dim pstrConnect, pstrVal Dim pobjUser 'As ActiveDs.IADsUser pstrConnect = fstrADSpath Set pobjUser = GetObject(pstrConnect) pstrVal = pobjUser.Get(strProperty) if isArray(pstrVal) = true then fstrGetUserProperty = join(pstrVal) else fstrGetUserProperty = pstrVal end if If Err.Number <> 0 Then MsgBox Err.Description, vbCritical End If Set pobjUser = Nothing End Function 'Gets the local Active Directory information ' Used to obtain the string to connect the user's AD object Function fstrADSpath() 'As String Dim pobjAdSysInfo 'As ActiveDs.ADSystemInfo 'Set pobjAdSysInfo = New ActiveDs.ADSystemInfo Set pobjAdSysInfo = CreateObject("AdSystemInfo") fstrADSpath = "LDAP://" & pobjAdSysInfo.UserName Set pobjAdSysInfo = Nothing End Function function fblnSetUserEnvVar(strVariable, strValue, blnConcat) on Error resume next dim wshShell, pobjEnv fblnSetUserEnvVar = true set WshShell = CreateObject("WScript.Shell") Set pobjEnv = WshShell.Environment("User") if blnConcat = true then if instr(1,ucase(pobjEnv(strVariable)),ucase(strValue)) <= 0 then pobjEnv(strVariable) = pobjEnv(strVariable) & strValue end if else pobjEnv(strVariable) = strValue end if if err.number <> 0 then fblnSetUserEnvVar = false err.clear end if end function

Last edited by MTBER : 07-11-2007 at 12:12 PM.
Reply With Quote
  #6 (permalink)  
Old 07-11-2007, 06:51 PM
ALL's Avatar
ALL ALL is offline
Senior Member
 
Join Date: Oct 2006
Location: Sturgis, SD
Posts: 145
ALL is on a distinguished road
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

to tell you the truth i am not a vbscripter, i am a javascripter. the only reason i help people with vbscript is because i know visual basic 6 & vb.net.

i am not sure if vbscript supports this, but i would see if you can put it all into a module/class then create new instances of the class. This would make each one independent and no data would interfeer with eachother. if not you should beable to make a "master" function that you can run with spacific parameters to map each drive.

But as for adding a new tab to IE insted of a new window is very hard to do. What you can do is run the script multiple times in the same window though, but i would categorize all the data into a class or function before you do it, so it will be ezier to do.

hope that helps,
-ALL
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:20 AM.


Creative Commons License
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30