#122086 - 2004-07-02 03:38 PM
passing variable
|
Stealth
Fresh Scripter
Registered: 2001-08-09
Posts: 48
Loc: Scotland
|
Can someone please enlighten me I cant get my head round this heres part of my script
:variables $CITRIXCHECK = "C:\Winnt\Profiles\%username%\Application Data\ICAClient" $HOMEDIR = "%HOMEDRIVE%%HOMEPATH%" ; Required - Path For Users Home Directory $AUTOCORRECT = $HOMEDIR+"Autocorrect\" ; Required - Default path for locaton of Auto Correct files. $OUTLOOKROOT = $HOMEDIR+"Exchange\" ; Required - Default Path For Outlook Files ; $HKCUSMWCVEUSF = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" $HKCUSMWCVIS = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $HKCUSMWCVISPS = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer" $HKCUSMWCVPE = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" $HKCUSMO8CFNLT = "HKCU\Software\Microsoft\Office\8.0\Common\FileNew\LocalTemplates\" $HKCUCPC = "HKCU\Control Panel\Colors" $HKCUCPDT = "HKCU\Control Panel\Desktop" $HKCUSMWCVIE4SS = "HKCU\Software\Microsoft\Windows\CurrentVersion\IE4 Screen Saver" $HKCUSPMIECP = "HKCU\Software\Policies\Microsoft\Internet Explorer\Control Panel" $HKCUSMWCVISZMD = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains" $HKCUSMWCVISZM = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges" $HKCUSMWCVISZMR = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range" $HKCUSMWCVISZ1 = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1" $HKCUSMO8CAC = "HKCU\Software\Microsoft\Office\8.0\Common\AutoCorrect\" $HKCUSMO8OOE = "HKCU\Software\Microsoft\Office\8.0\Outlook\Office Explorer" $HKCUSMIE = "HKCU\Software\Microsoft\Internet Explorer" $HKCUSMIEM = "HKCU\Software\Microsoft\Internet Explorer\Main" $HKCUIACD = "HKCU\IDENTITIES\Auto Correct Done" $HKCUSPMIER = "HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions" : proxy_settings
If Val (ReadProfileString(C: +'\Kix\include.ini','Include',@WKSTA)) = 1 $nul=WriteValue($HKCUSMWCVIS,"ProxyEnable","1","REG_DWORD") EndIf ; $Proxy = ReadProfileString(c: +'\Kix\include.ini','Include','Proxy') WriteValue($HKCUSMWCVIS,"ProxyServer",'$Proxy',"REG_SZ")
Contents of include.ini
[Include]
PCNAME=1 ; Allows certain comuputers to have proxy enabled
[Proxy]
PROXYSERVER:PORTNUMBER ; Hopefully writes the proxy listed here to the registry
I want to be able to read the value in the include.ini under the header proxy and pass it to the writevalue and write it to the registry
Any help appreciated thanks in advance
|
Top
|
|
|
|
#122088 - 2004-07-02 03:45 PM
Re: passing variable
|
Stealth
Fresh Scripter
Registered: 2001-08-09
Posts: 48
Loc: Scotland
|
maybe it doesn't but will it not work and if not how can i achieve what im looking for?
|
Top
|
|
|
|
#122089 - 2004-07-02 03:53 PM
Re: passing variable
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Providing that you have control over the ini file, a better solution is: Code:
[Include] PCNAME=ProxyConfigX
[ProxyConfigX] ProxyName=wwwproxy.acme.com ProxyPort=3128 Direct=*.acme.com Otherparameter=foo
This way you can have different sections for different proxy configurations.
However the correct way to do this is to use WPAD (or similar) to deliver the proxy configuration to all machines, then use authentication rules on the proxy to determine if access should be allowed or not.
|
Top
|
|
|
|
#122091 - 2004-07-02 04:11 PM
Re: passing variable
|
Stealth
Fresh Scripter
Registered: 2001-08-09
Posts: 48
Loc: Scotland
|
Ok I dont want to use wpad i want to certain users on certain domain to use 1 of 6 or more proxy servers this is what I had before
: proxy_settings ; $nul=WriteValue($HKCUSMWCVIS,"ProxyOverride","home.*;10.*etc etc.*;<local>","REG_SZ") $nul=AddKey($HKCUSMWCVISPS) $nul=WriteValue($HKCUSMWCVIS,"ProxyEnable","0","REG_DWORD") If Val (ReadProfileString(C: +'\Kix\include.ini','Include',@WKSTA)) = 1 $nul=WriteValue($HKCUSMWCVIS,"ProxyEnable","1","REG_DWORD") EndIf ; If Val (ReadProfileString(C: +'\Kix\include.ini','Proxy',Proxy1) = 1 $nul=WriteValue($HKCUSMWCVIS,"ProxyServer","Proxy1:80","REG_SZ") ; Else $nul=WriteValue($HKCUSMWCVIS,"ProxyServer","Proxy2:80","REG_SZ") ; EndIf
As you can see this is hardcoded to the script although you could mess around with cnames you are still limited to 2 All I want to do is manually read a value as a variable? as described before and enter it into the registry surley it cant be that difficult??
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 369 anonymous users online.
|
|
|