Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/12/2009, 06:15
securedigital
 
Fecha de Ingreso: junio-2007
Mensajes: 11
Antigüedad: 17 años, 9 meses
Puntos: 0
Respuesta: wsh-vbscript no funciona...

Buenas,

Sí...ayer por la noche estuve buscando y no lo vi por ninguna parte. Gracias.
De todas formas también tenia un error al final de todo, faltaba un "&" para concatenar el texto.

Después de haber arreglado ese par de errores, no consigo con esa condición un control básico de errores.

objReg.SetStringValue devuelve '0' si todo ha ido bien, '1' si ha ido mal, pues se guardan esos valores en la matriz. La intención era recorrer la matriz y si alguno contenía un valor diferente de '0' sumar los errores en 'errors' y mostrar la cantidad de errores (llaves del registro que no se pudieron modificar).

Alguna idea al respecto de que hago mal?

Código:
const HKUS = &H80000003
strKeyPath = ".DEFAULT\Control Panel\Colors"
strComputer = "." 

set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
Dim intRC(2)

intRC(0) = objReg.SetStringValue(HKUS, strKeyPath, "ActiveBorder", "212 208 200")
intRC(1) = objReg.SetStringValue(HKUS, strKeyPath, "ActiveTitle", "10 36 106")
intRC(2) = objReg.SetStringValue(HKUS, strKeyPath, "AppWorkSpace", "128 128 128")

errors = 0
For Each item In intRC

	If intRC <> 0 Then
		'err
		errors = errors + 1
	End if
	

Next

WScript.Echo "Error setting values. Found: " & errors & "errors"