Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript
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.
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 8-Feb-13 6:50am
namerg389
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 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)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 130
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100