Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Cannot Use parentheses when calling a sub

$
0
0
Good afternoon
i am just finishing a script but i have the following scenario

1. script needs to check if the string value is present at all in that particular entry, if it is then DO NOTHING.
2. script checks if reg key exists but the value is missing and amends this
3. script checks for reg structure and creates this if missing.

2 and 3 are done

but i need to put a fail safe in to prevent it writing the characters alongside them already if they are present in the key.
when i copy my code for this i get the "cannot use parentheses when calling a sub error" my code is attached below, i have bolded the part causing me issues, i have basically change the IF NOT to IF for the first check


Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
Set WshShell = CreateObject("WScript.Shell")
strKeyPath = "Software\Microsoft\Internet Explorer\International"
strValueName = "AcceptLanguage"
objRegistry.GetStringValue HKEY_CURRENT_USER,strKeyPath,strValueName,strValue


'-----------Registry Key and Value Exist - DO Nothing-----------------------
IfInstr(1, strValue, "en-GB;q=0.5", 1) > 0 then
End


Else

'----------- Registry Key Exists - Modify Key ------------
If NOT Instr(1, strValue, "en-GB;q=0.5", 1) > 0 then
WshShell.Run """" & "C:\AmendLanguage.vbs" & """"
WScript.Echo "Modifying Registry"


Else

'----------- Registry Key does not exist - create key ------------
WshShell.Run """" & "C:\InputLanguage.vbs" & """"
WScript.Echo "Creating Registry Keys"

can anyone advise how to amend my script so i dont see this error?
Thanks

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>