#89404 - 2002-11-14 09:18 PM
Re: Run IE and enable proxy only for this windows
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
get this to work right... and it could be used as a great pop-up ad killer.
|
Top
|
|
|
|
#89411 - 2002-11-19 02:58 PM
Re: Run IE and enable proxy only for this windows
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Apologies for coming a little late to this, but...
Wouldn't the simplest solution be to provide a ".pac" file?
This is a file used to automatically configure the browser proxy settings. It is simple javascript, and would look something like:
code:
function FindProxyForURL(url, host) { if (host == "www.training-host.com"){ return "PROXY myproxy.mydomain.com:8080"; } else { return "DIRECT"; } }
In this example any request for www.training-host.com would be sent to the proxy "myproxy.mydomain.com", all other requests would be forced to be local.
You would disable access to the IE configuration screens to stop your users fiddling, and assign the ".pac" file name during logon.
|
Top
|
|
|
|
#89412 - 2002-11-19 03:04 PM
Re: Run IE and enable proxy only for this windows
|
MightyR1
MM club member
Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
|
Richard,
howto assign the .pac???
I came up with this:
code:
;**************************************************************************** ; ;SCRIPT : IE_with_proxy() ; ;AUTHOR : Patrick Rutten (MightyR1@hotmail.com) ; ;CONTRIBUTORS : KiXtart buddies ; ;ACTION : Starts IE with proxy settings ; ;SYNTAX : <path>wkix32.exe /i <path>IE_with_proxy.kix $proxy="PROXY_IP:PROXY_PORT" ; $url="http://URL_TO_GO_TO" ; ;VERSION : 1.0 - 2002-11-14 ; initial release ; 1.1 - 2002-11-15 ; added $proxy/$url arguments support ; modified proxyoverride/proxyserver; now contains correct settings ; window is now created dynamically using screenresolution ; ;PARAMETERS : $proxy ; IP-address of proxyserver ; $url ; destination url ; ;REMARKS : Current proxy settings will be remembered ; ;RETURNS : Nothing ; ;DEPENDENCIES : wkix32.exe (4.12) in @scriptdir ; - http://www.scriptlogic.com/downloads/kix/KiX2001_412.zip ; W9x (@inwin=2): kill95.exe in @scriptdir ; - http://helpdesk.kixtart.org/Download/Utils/kill95.zip ; NT and up (@inwin=1): WMI (installed on W2k by default) ; UDF GetScreenRes written by Kholm ; - http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000035 ; UDF WMIQuery written by Radimus ; - http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000117 ; UDF Taskbar written by Lonkero ; - http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_profile;u=00002306 ; ;KIXTART VER : 4.x ; ;EXAMPLE(S) : ; ;KNOWN ISSUES : ; ;**************************************************************************** ; ;
;Allow CTRL-C Break on
;Display error message if parameters are empty and exit If ""=$url OR ""=$proxy $rc=MessageBox("Parameters incorrect!"+@crlf+"Neem contact op met uw helpdesk.", "KiXtart message",16,120) Exit 0 EndIf
;Display warning message; OK/CANCEL buttons, timeout = 120 seconds $rc=MessageBox("Sluit alle andere Internet Explorer vensters."+ @crlf+"Na 2 minuten òf na het klikken op OK, worden ze automatisch gesloten!", "KiXtart message",49,120)
;Quit script if CANCEL is pressed If 2=$rc Exit 0 EndIf
;KILL all running iexplore.exe; W95 use kill95, NT use WMI If 2=@inwin ;Still shows dos box ;( Shell "%comspec% /c @scriptdir\kill95 iexplore.exe > nul" Else $GetObj="winmgmts:{impersonationLevel=impersonate}!//@WKSTA" $Sel="select * from Win32_Process where Name='IEXPLORE.exe'" For Each $Process in GetObject("$GetObj").ExecQuery("$sel") $rc=$Process.Terminate Next EndIf
;Save previous proxy settings $prevprox=ReadValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable") ;Enable proxy $rc=WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable","1","REG_DWORD") ;Set proxy override $ProxyOverride="PROXY_OVERRIDE_SETTINGS" $rc=WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride",$ProxyOverride,"REG_SZ") ;Set proxy server to $proxy $ProxyServer="$proxy" $rc=WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer",$ProxyServer,"REG_SZ") ;Disable CTRL-O in IE $rc=WriteValue("HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions", "NoFileOpen","1","REG_DWORD") ;Disable CTRL-N in IE $rc=WriteValue("HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions", "NoFileNew","1","REG_DWORD") ;Disable F3 in IE $rc=WriteValue("HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions", "NoFindFiles","1","REG_DWORD") ;Disable F11 in IE $rc=WriteValue("HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions", "NoTheaterMode","1","REG_DWORD") ;Disable IE splashscreen $rc=WriteValue("HKLM\Software\Policies\Microsoft\Internet Explorer\Infodelivery\Restrictions", "NoSplash","1","REG_DWORD")
;Create IE object $ie=CreateObject("internetexplorer.application") ;Define IE properties $ie.addressbar=0 $ie.menubar=0 $ie.statusbar=0 $ie.toolbar=0 $ie.resizable=0 $ie.Left=1 $ie.top=1 $res=Split(getscreenres(),",") $x=$res[0] $y=$res[1] $tb=taskbar() $y=CInt($y)-$tb $ie.width=$x $ie.height=$y
;Display white window $ie.navigate("about:blank") ;Loop until IE is ready While $ie.busy AND $ie.readystate <> 4 AND @error=0 Loop ;Make IE window visible $ie.visible=1
;Browse to $url $ie.navigate("$url") ;Loop until IE is ready While $ie.busy AND $ie.readystate <> 4 AND @error=0 Loop
;Restore previous proxy setting $rc=WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable",$prevprox,"REG_DWORD")
;Quit script Exit 0
;**************************************************************************** ;**************************************************************************** ;**************************************************************************** ;Following UDF are borrowed from KiXtart buddies...
;Function GetScreenRes written by Kholm ;http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000035 Function GetScreenRes() Dim $Dev,$Idx,$RKey,$ScreenXRes,$ScreenYRes,$SType $GetScreenRes = '' If @InWin = 1 If Split(@ProductType)[1] <> "NT" $Dev = Split('' + WMIQuery("VideoModeDescription","Win32_VideoController")) If Ubound($Dev) > 1 $GetScreenRes = $Dev[0] + "," + $Dev[2] EndIf Else $RKey="HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services" $Dev = "\Device0" If KeyExist($RKey) $Idx = 0 Do $SType = EnumKey($RKey,$Idx) If @Error = 0 AND $SType <> "VgaSave" $ScreenXRes = '' + ReadValue($RKey + "\" + $SType + $Dev,"DefaultSettings.XResolution") $ScreenYRes = '' + ReadValue($RKey + "\" + $SType + $Dev,"DefaultSettings.YResolution") Else $Idx = $Idx + 1 EndIf Until @Error OR $ScreenXRes If $ScreenXRes $GetScreenRes = $ScreenXRes + ',' + $ScreenYRes EndIf EndIf EndIf Else $RKey="HKLM\Config\0001\Display\Settings" If KeyExist($RKey) $GetScreenRes = ReadValue($RKey,"Resolution") EndIf EndIf EndFunction ;Function WMIQuery written by Radimus ;http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000117 Function WMIQuery($what,$where, optional $computer) Dim $strQuery, $objEnumerator, $value If NOT $computer $computer="@WKSTA" EndIf $strQuery = "Select $what From $where" $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer") $objEnumerator = $SystemSet.ExecQuery($strQuery) For Each $objInstance in $objEnumerator If @Error = 0 AND $objInstance <> "" $=Execute("$$value = $$objInstance.$what") $WMIQuery="$value"+"|"+"$WMIQuery" EndIf Next $WMIQuery=Left($WMIQuery,Len($WMIQuery)-1) Exit @error EndFunction
;Function borrowed from Lonkero's bbChecker Function TaskBar() If @dos=="4.0" $_S="StuckRects" Else $_S="StuckRects2" EndIf $TaskBar=Val("&"+SubStr(ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\$_S","settings"),41,2)) EndFunction
Any comments are welcome...
_________________________
Greetz, Patrick Rutten
- We'll either find a way or make one... - Knowledge is power; knowing how to find it is more powerful... - Problems don't exist; they are challenges...
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 557 anonymous users online.
|
|
|