Page 1 of 1 1
Topic Options
#176910 - 2007-06-12 10:34 AM IE AutoDetect
david_minter Offline
Fresh Scripter

Registered: 2007-05-18
Posts: 20
Hi, I have the script below as part of a login script. This script will switch the auto detect settings within IE on. The problem I have is that the login script has to be run twice for auto detect to be switched on, can anyone see why this is ?

$rc=setIEAutoDetect(1)
function SetIEAutoDetect($enable)
dim $subkey, $value, $byte, $rc
$subkey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
$value = readvalue($subkey, "DefaultConnectionSettings")
$rc = @error

If $rc = 0
$byte = val(substr($value, 18, 1))
If $enable
$byte = $byte | 8 ; set bit
Else
$byte = $byte & 7 ; clear bit
Endif

$byte = dectohex($byte)
$value = substr($value, 1, 17) + $byte + substr($value, 19, len($value) - 18)
$rc = writevalue($subkey, "DefaultConnectionSettings", $value, "REG_BINARY")

Endif
$SetIEAutoDetect = $rc
endfunction

Top
#176911 - 2007-06-12 10:48 AM Re: IE AutoDetect [Re: david_minter]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Please use the code tags when posting code. That way the formatting gets preserved and the script is much more readable.

When you run the script the first time and you check the settings in IE they are not set? This might be because the registry has to be reloaded and that happens when you logon again. If you check the registry after the first logon is the setting set as you want it?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#176912 - 2007-06-12 10:52 AM Re: IE AutoDetect [Re: david_minter]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Could be a timing issue - the first time the script run the profile has not been established. The second time it runs the profile has been established and the script works as expected.

If this is the case, ensure that you are running the script synchronously. This will wait for the user environment to establish before running the logon script, if it is a legacy logon script.

For more information search the board / web for RunLogonScriptSync

Top
#176913 - 2007-06-12 11:00 AM Re: IE AutoDetect [Re: Mart]
david_minter Offline
Fresh Scripter

Registered: 2007-05-18
Posts: 20
The script attached is called as part of another proxy script. When this runs first time, Auto Detect is ticked, but proxy enabled isn't. When the logon script is re-run both the auto detect is ticked and the proxy enable is ticked.
Top
#176914 - 2007-06-12 11:18 AM Re: IE AutoDetect [Re: david_minter]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Like said you should check if the stuff is set right in the registry or not after the first logon. The registry needs to be reloaded for some settings so the settings will show in the GUI.
Or like Richard said it could be a timing issue.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1126 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.071 seconds in which 0.049 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org