Click here to Skip to main content
15,888,908 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello I have the following code but is giving me the error mentioned in the subject and I cant figure it out where is it. Thanks for your help.
VB
wscript.echo ""
strKeyPath17 = "Software\Microsoft\Internet Explorer"
strKeyPath17a = "Software\Microsoft\Internet Explorer\Safety"
strKeyPath17b = "Software\Microsoft\Internet Explorer\Safety\PrivacIE"
oReg.EnumKey HKEY_CURRENT_USER,strKeyPath17,arrValueKeys
For Each strValueKey In arrValueKeys
    SafetyNameExists = (StrComp(strValueKey,"Safety"))
	If SafetyNameExists = 0 Then
		oReg.EnumKey HKEY_CURRENT_USER,strKeyPath17a,arrValueKeys
		PrivacIENameExists = (StrComp(strValueKey,"PrivacIE"))
		If PrivacIENameExists = 0 Then
			oReg.EnumValues HKEY_CURRENT_USER,strKeyPath17b,arrValueNames
			For Each strValueName In arrValueNames
				DisableToolBars_NameExists = (StrComp(strValueName,"DisableToolbars"))
				If DisableToolBars__NameExists = 0 Then
					FlagDisableToolBars_NameExists = 1
					oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
					If dwValue17b = 0 OR dwValue17b = 1 Then
						If dwValue17b = 0 Then
							Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Unchecked"
						End If
						If dwValue17b = 1 Then
							Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Checked"
						End If
					Else
						Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Unchecked"
						dwValue17b = 1
						Wscript.Echo "Setting the right GE Recommendation"
						oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
						Wscript.Echo "DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Value Set. You have 10 seconds to verify registry change"
						wscript.sleep (10000)
						oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath16,"1409",dwValue16
						Wscript.Echo "New DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Checked"
					End If
				Else
					'Creating DisableToolbars and Setting value
					dwValue17b = 1
					oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
				End If
			Next
		Else
		   'Create PrivacIE Key
		   oReg.CreateKey HKEY_CURRENT_USER,strKeyPath17b
		   oReg.EnumValues HKEY_CURRENT_USER,strKeyPath17b,arrValueNames
		   For Each strValueName In arrValueNames
				DisableToolBars_NameExists = (StrComp(strValueName,"DisableToolbars"))
				If DisableToolBars__NameExists = 0 Then
					FlagDisableToolBars_NameExists = 1
					oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
					If dwValue17b = 0 OR dwValue17b = 1 Then
						If dwValue17b = 0 Then
							Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Unchecked"
						End If
						If dwValue17b = 1 Then
							Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Checked"
						End If
					Else
						Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Unchecked"
						dwValue17b = 1
						Wscript.Echo "Setting the right GE Recommendation"
						oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
						Wscript.Echo "DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Value Set. You have 10 seconds to verify registry change"
						wscript.sleep (10000)
						oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath16,"1409",dwValue16
						Wscript.Echo "New DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Checked"
					End If
				Else
					'Creating DisableToolbars and Setting value
					dwValue17b = 1
					oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
				End If
			Next
		End If
	Else 
		'Create Safety Key
		oReg.CreateKey(HKEY_CURRENT_USER,strKeyPath17a)
		wscript.sleep (1000)
		oReg.CreateKey(HKEY_CURRENT_USER,strKeyPath17b)
		oReg.EnumValues HKEY_CURRENT_USER,strKeyPath17b,arrValueNames
		   For Each strValueName In arrValueNames
				DisableToolBars_NameExists = (StrComp(strValueName,"DisableToolbars"))
				If DisableToolBars__NameExists = 0 Then
					FlagDisableToolBars_NameExists = 1
					oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
					If dwValue17b = 0 OR dwValue17b = 1 Then
						If dwValue17b = 0 Then
							Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Unchecked"
						End If
						If dwValue17b = 1 Then
							Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Checked"
						End If
					Else
						Wscript.Echo "Current DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Unchecked"
						dwValue17b = 1
						Wscript.Echo "Setting the right GE Recommendation"
						oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
						Wscript.Echo "DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Value Set. You have 10 seconds to verify registry change"
						wscript.sleep (10000)
						oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath16,"1409",dwValue16
						Wscript.Echo "New DISABLE TOOLBARS AND EXTENSIONS WHEN INPRIVATE BROWSING STARTS Status: " & dwValue17b & " Checked"
					End If
				Else
					'Creating DisableToolbars and Setting value
					dwValue17b = 1
					oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath17b,"DisableToolbars",dwValue17b
				End If
			Next

	End If
Next

Error:
C:\scripts\FindRegEntry.vbs(453, 50) Microsoft VBScript compilation error: Cannot use parentheses when calling a Sub
Posted

If in doubt, Google the error message!
It would have taken you straight here: What do you mean "cannot use parentheses?"[^] - it explains the cause and the solution.
 
Share this answer
 
These will cause errors:
oReg.CreateKey(HKEY_CURRENT_USER,strKeyPath17a)
wscript.sleep (1000)
oReg.CreateKey(HKEY_CURRENT_USER,strKeyPath17b)

Should be:

oReg.CreateKey HKEY_CURRENT_USER,strKeyPath17a
wscript.sleep 1000
oReg.CreateKey HKEY_CURRENT_USER,strKeyPath17b
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Feb-13 18:23pm    
Please don't post such content as "answer" — it is not.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900