Visual Basic - ¿Cómo repetir un VBS desde el principio?

Life is soft - evento anual de software empresarial
 
Vista:
sin imagen de perfil

¿Cómo repetir un VBS desde el principio?

Publicado por Daniel (7 intervenciones) el 01/09/2017 12:46:41
Hola, muy buenos días.

Mi problema radica en el siguiente VBS:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
Option Explicit
Dim objShell
Dim objNetwork
Dim strTitle
Dim strDefaultServer
Dim strDefaultUser
Dim strComputer
Dim strUsername
Dim strPassword
Dim strDefaultGateway
Dim time2
Set objShell=CreateObject("WScript.Shell")
objShell.run("http://es.geoipview.com/")
 
 
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.run "chrome.exe", 3, false
WScript.Sleep 500
objShell.SendKeys "chrome://settings/"
WScript.Sleep 500
objShell.SendKeys "~"
WScript.Sleep 1000
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 500
objShell.SendKeys "^w"
For time = 1 To 2
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.run "chrome.exe", 3, false
WScript.Sleep 500
objShell.SendKeys "chrome://settings/clearBrowserData"
WScript.Sleep 500
objShell.SendKeys "~"
WScript.Sleep 1000
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 100
objShell.SendKeys "{END}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 500
objShell.SendKeys "^w"
WScript.Sleep 100
next
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.run "chrome.exe", 3, false
WScript.Sleep 500
objShell.SendKeys "chrome://settings/content/cookies"
WScript.Sleep 500
objShell.SendKeys "~"
WScript.Sleep 1000
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 500
objShell.SendKeys "{ESC}"
WScript.Sleep 100
objShell.SendKeys "^w"
 
 
Set objNetwork=CreateObject("WScript.Network")
strTitle="Telnet Demo"
strDefaultServer="Server01"
strDefaultUser=objNetwork.UserDomain & "\" & objNetwork.UserName
strComputer="192.168.1.1" 		'INTRODUCE LA PUERTA DE ENLACE PREDETERMINADA DE TU ROUTER  |LAS "." SE MANTIENEN|  EJEMPLO: strComputer="TU-PUERTA-DE-ENLACE"
If Len(strComputer)=0 Then WScript.quit
strUsername="admin"				'INTRODUCE EL USUARIO DE ACCESO A TU ROUTER				    |LAS "." SE MANTIENEN|  EJEMPLO: strUsername="EL-USUARIO"
If Len (strUsername)=0 Then WScript.Quit
strPassword="admin"				'INTRODUCE LA CONTRASEÑA DE ACCESO A TU ROUTER				|LAS "." SE MANTIENEN|  EJEMPLO: strPassword="LA-CONTRASEÑA"
If Len (strPassword)=0 Then WScript.Quit
strDefaultGateway="ppp0.1"		'INTRODUCE EL DEFAULT GATEWAY DE TU ROUTER				    |LAS "." SE MANTIENEN|  EJEMPLO: strDefaultGateway="TU-GATEWAY"
If Len (strDefaultGateway)=0 Then Wscript.Quit
Set objShell=CreateObject("wscript.shell")
objShell.Run "Telnet "& strComputer
WScript.Sleep 2000 	'EN CASO DE QUE NO RESPONDA EL SCRIPT POR UN PC LENTO, DEBEMOS EDITAR LOS NÚMEROS EN COLOR ROJO, DUPLICANDO LA CANTIDAD ESCRITA |Ej:1000X2
objShell.AppActivate "Telnet " & strComputer, true
WScript.Sleep 8000	'SABIENDO QUE DEFINEN EL TIEMPO DE ESPERA EN MILISEGUNDOS, DEDUCIMOS QUE; 500 = 1/2 SEGUNDO; 1000 = 1 SEGUNDO; ETC...
objShell.SendKeys strUsername & "~", true
WScript.Sleep 5000
objShell.SendKeys strPassword & "~", false
WScript.Sleep 5000
objShell.SendKeys "ppp config " & strDefaultGateway & " down" & "~", true
WScript.Sleep 8000
objShell.SendKeys "ppp config " & strDefaultGateway & " up" & "~", true
WScript.Sleep 1000	'SI EL SCRIPT NO TE FUNCIONA, Y YA PROBASTE DUPLICANDO LOS NUMEROS EN ROJO MÁS DE 3 VECES, LO MÁS PROBABLE ES QUE NO LO SOPORTE TU SISTEMA
objShell.SendKeys "logout" & "~", true
WScript.Sleep 1000
objShell.SendKeys "~", true
WScript.Sleep 1000
Set objShell=CreateObject("WScript.Shell")
objShell.run("http://es.geoipview.com/")
WScript.Sleep 1000
'|||||MUY IMPORTANTE|||'
'|||SE REQUIERE TENER EL CLIENTE TELNET ACTIVADO EN NUESTRO SISTEMA OPERATIVO WINDOWS|||'
 
 
For time2 = 1 To 2
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.run "chrome.exe", 3, false
WScript.Sleep 500
objShell.SendKeys "chrome://settings/clearBrowserData"
WScript.Sleep 500
objShell.SendKeys "~"
WScript.Sleep 1000
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 100
objShell.SendKeys "{END}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}" & "~"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 500
objShell.SendKeys "^w"
WScript.Sleep 100
next
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.run "chrome.exe", 3, false
WScript.Sleep 500
objShell.SendKeys "chrome://settings/content/cookies"
WScript.Sleep 500
objShell.SendKeys "~"
WScript.Sleep 1000
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 100
objShell.SendKeys "~"
WScript.Sleep 500
objShell.SendKeys "{ESC}"
WScript.Sleep 100
objShell.SendKeys "^w"
WScript.Sleep 1000
objShell.SendKeys "{F5}" & "{F5}" & "{F5}" & "{F5}" & "{F5}"



Lo que me gustaría lograr, es añadir un MsgBox de sí/no al final de este vbs, para si la condición devuelta = sí, no haga nada; pero si la condicion devuelta = no; que volviese al principio del vbs y se repita todo hasta llegar de nuevo al MsgBox.


He probado distintas maneras y buscado durante horas; pero no consigo solución.

SI me pudiesen ayudar con esto, que seguramente sea algo muy simple para ustedes, les estaría muy agradecido.

Que pasen muy buen día; saludos cordiales, Daniel.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

¿Cómo repetir un VBS desde el principio?

Publicado por Javi (1 intervención) el 01/09/2017 13:48:14
Puedes probar a hacer un goto
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

¿Cómo repetir un VBS desde el principio?

Publicado por Daniel (7 intervenciones) el 01/09/2017 15:08:04
Vbscript tengo entendido que ya no utiliza goto; solo para goto on error.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

¿Cómo volver en un VBScript a la primera línea de instrucciones?

Publicado por Daniel (7 intervenciones) el 01/09/2017 15:57:00
Hola, Muy Buenos Días

Lo que me gustaría lograr, es añadir un MsgBox de sí/no al final de este vbs, para si la condición devuelta = sí, no haga nada; pero si la condicion devuelta = no; que volviese al principio del vbs y se repita todo hasta llegar de nuevo al MsgBox.

Ya he probado distintas maneras y buscado durante horas; pero no consigo solución.


El problema radica en el siguiente VBscript:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
Option Explicit
	Dim objShell
	Dim objNetwork
	Dim strTitle
	Dim strDefaultServer
	Dim strDefaultUser
	Dim strComputer
	Dim strUsername
	Dim strPassword
	Dim strDefaultGateway
	Dim time2
	Set objShell=CreateObject("WScript.Shell")
	objShell.run("http://es.geoipview.com/")
Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "casi terminado.vbs"
 
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 500
	objShell.SendKeys "chrome://settings/"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "^w"
	For time = 1 To 2
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 500
	objShell.SendKeys "chrome://settings/clearBrowserData"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{END}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "^w"
	WScript.Sleep 100
	next
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 500
	objShell.SendKeys "chrome://settings/content/cookies"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "{ESC}"
	WScript.Sleep 100
	objShell.SendKeys "^w"
 
 
	Set objNetwork=CreateObject("WScript.Network")
	strTitle="Telnet Demo"
	strDefaultServer="Server01"
	strDefaultUser=objNetwork.UserDomain & "\" & objNetwork.UserName
strComputer="192.168.1.1" 		'INTRODUCE LA PUERTA DE ENLACE PREDETERMINADA DE TU ROUTER  |LAS "." SE MANTIENEN|  EJEMPLO: strComputer="TU-PUERTA-DE-ENLACE"
	If Len(strComputer)=0 Then WScript.quit
strUsername="admin"				'INTRODUCE EL USUARIO DE ACCESO A TU ROUTER				    |LAS "." SE MANTIENEN|  EJEMPLO: strUsername="EL-USUARIO"
	If Len (strUsername)=0 Then WScript.Quit
strPassword="admin"				'INTRODUCE LA CONTRASEÑA DE ACCESO A TU ROUTER				|LAS "." SE MANTIENEN|  EJEMPLO: strPassword="LA-CONTRASEÑA"
	If Len (strPassword)=0 Then WScript.Quit
strDefaultGateway="ppp0.1"		'INTRODUCE EL DEFAULT GATEWAY DE TU ROUTER				    |LAS "." SE MANTIENEN|  EJEMPLO: strDefaultGateway="TU-GATEWAY"
	If Len (strDefaultGateway)=0 Then Wscript.Quit
	Set objShell=CreateObject("wscript.shell")
	objShell.Run "Telnet "& strComputer
WScript.Sleep 2000 	'EN CASO DE QUE NO RESPONDA EL SCRIPT POR UN PC LENTO, DEBEMOS EDITAR LOS NÚMEROS EN COLOR ROJO, DUPLICANDO LA CANTIDAD ESCRITA |Ej:1000X2
	objShell.AppActivate "Telnet " & strComputer, true
WScript.Sleep 8000	'SABIENDO QUE DEFINEN EL TIEMPO DE ESPERA EN MILISEGUNDOS, DEDUCIMOS QUE; 500 = 1/2 SEGUNDO; 1000 = 1 SEGUNDO; ETC...
	objShell.SendKeys strUsername & "~", true
WScript.Sleep 5000
	objShell.SendKeys strPassword & "~", false
WScript.Sleep 5000
	objShell.SendKeys "ppp config " & strDefaultGateway & " down" & "~", true
	WScript.Sleep 8000
	objShell.SendKeys "ppp config " & strDefaultGateway & " up" & "~", true
WScript.Sleep 1000	'SI EL SCRIPT NO TE FUNCIONA, Y YA PROBASTE DUPLICANDO LOS NUMEROS EN ROJO MÁS DE 3 VECES, LO MÁS PROBABLE ES QUE NO LO SOPORTE TU SISTEMA
	objShell.SendKeys "logout" & "~", true
	WScript.Sleep 1000
	objShell.SendKeys "~", true
	WScript.Sleep 1000
	Set objShell=CreateObject("WScript.Shell")
	objShell.run("http://es.geoipview.com/")
	WScript.Sleep 1000
'|||||MUY IMPORTANTE|||'
	'|||SE REQUIERE TENER EL CLIENTE TELNET ACTIVADO EN NUESTRO SISTEMA OPERATIVO WINDOWS|||'
 
 
	For time2 = 1 To 2
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 500
	objShell.SendKeys "chrome://settings/clearBrowserData"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{END}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "^w"
	WScript.Sleep 100
	next
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 500
	objShell.SendKeys "chrome://settings/content/cookies"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "{ESC}"
	WScript.Sleep 100
	objShell.SendKeys "^w"
	WScript.Sleep 1000
	objShell.SendKeys "{F5}" & "{F5}" & "{F5}" & "{F5}" & "{F5}"

SI me pudiesen ayudar con esto, que seguramente sea algo muy simple para ustedes, les estaría muy agradecido.

Que pasen muy buen día; saludos cordiales, Daniel.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 8
Ha disminuido su posición en 2 puestos en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

¿Cómo volver en un VBScript a la primera línea de instrucciones?

Publicado por Ismael (3 intervenciones) el 01/09/2017 23:29:25
Hola,

Puedes meterlo todo en un do loop, para que la primera vez tuviera que entrar.

declara la variable antes del do loop
1
Dim mbResult as Integer
Al final, antes de salir del do while puedes poner un msgbox
1
mbResult = MsgBox("Salir?",vbYesNo)
en loop final evalua mbResult
1
loop until mbResult<>vbNo

mas o menos sería así
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil

¿Cómo volver en un VBScript a la primera línea de instrucciones?

Publicado por Daniel (7 intervenciones) el 02/09/2017 17:55:05
ESA MANERA NO ME FUNCIONÓ; PERO HE LOGRADO ENCONTRARLE OTRA SOLUCIÓN:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
Call codigo (objShell,objNetwork,strTitle,strDefaultServer,strDefaultUser,strComputer,strUsername,strPassword,strDefaultGateway,time)
	Function codigo (objShell,objNetwork,strTitle,strDefaultServer,strDefaultUser,strComputer,strUsername,strPassword,strDefaultGateway,time)
	Set objShell=CreateObject("WScript.Shell")
	objShell.run("http://es.geoipview.com/")
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 1000
	objShell.SendKeys "chrome://settings/"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "^w"
	For time = 1 To 2
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 1000
	objShell.SendKeys "chrome://settings/clearBrowserData"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{END}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "^w"
	WScript.Sleep 100
	next
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 1000
	objShell.SendKeys "chrome://settings/content/cookies"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "{ESC}"
	WScript.Sleep 100
	objShell.SendKeys "^w"
 
 
	Set objNetwork=CreateObject("WScript.Network")
	strTitle="Telnet Demo"
	strDefaultServer="Server01"
	strDefaultUser=objNetwork.UserDomain & "\" & objNetwork.UserName
strComputer="192.168.1.1" 		'INTRODUCE LA PUERTA DE ENLACE PREDETERMINADA DE TU ROUTER  |LAS "." SE MANTIENEN|  EJEMPLO: strComputer="TU-PUERTA-DE-ENLACE"
	If Len(strComputer)=0 Then WScript.quit
strUsername="admin"				'INTRODUCE EL USUARIO DE ACCESO A TU ROUTER				    |LAS "." SE MANTIENEN|  EJEMPLO: strUsername="EL-USUARIO"
	If Len (strUsername)=0 Then WScript.Quit
strPassword="admin"				'INTRODUCE LA CONTRASEÑA DE ACCESO A TU ROUTER				|LAS "." SE MANTIENEN|  EJEMPLO: strPassword="LA-CONTRASEÑA"
	If Len (strPassword)=0 Then WScript.Quit
strDefaultGateway="ppp0.1"		'INTRODUCE EL DEFAULT GATEWAY DE TU ROUTER				    |LAS "." SE MANTIENEN|  EJEMPLO: strDefaultGateway="TU-GATEWAY"
	If Len (strDefaultGateway)=0 Then Wscript.Quit
	Set objShell=CreateObject("wscript.shell")
	objShell.Run "Telnet "& strComputer
WScript.Sleep 2000 	'EN CASO DE QUE NO RESPONDA EL SCRIPT POR UN PC LENTO, DEBEMOS EDITAR LOS NÚMEROS EN COLOR ROJO, DUPLICANDO LA CANTIDAD ESCRITA |Ej:1000X2
	objShell.AppActivate "Telnet " & strComputer, true
WScript.Sleep 8000	'SABIENDO QUE DEFINEN EL TIEMPO DE ESPERA EN MILISEGUNDOS, DEDUCIMOS QUE; 500 = 1/2 SEGUNDO; 1000 = 1 SEGUNDO; ETC...
	objShell.SendKeys strUsername & "~", true
WScript.Sleep 5000
	objShell.SendKeys strPassword & "~", false
WScript.Sleep 5000
	objShell.SendKeys "ppp config " & strDefaultGateway & " down" & "~", true
	WScript.Sleep 8000
	objShell.SendKeys "ppp config " & strDefaultGateway & " up" & "~", true
WScript.Sleep 1000	'SI EL SCRIPT NO TE FUNCIONA, Y YA PROBASTE DUPLICANDO LOS NUMEROS EN ROJO MÁS DE 3 VECES, LO MÁS PROBABLE ES QUE NO LO SOPORTE TU SISTEMA
	objShell.SendKeys "logout" & "~", true
	WScript.Sleep 1000
	objShell.SendKeys "~", true
	WScript.Sleep 1000
	Set objShell=CreateObject("WScript.Shell")
	objShell.run("http://es.geoipview.com/")
	WScript.Sleep 3500
'|||||MUY IMPORTANTE|||'
	'|||SE REQUIERE TENER EL CLIENTE TELNET ACTIVADO EN NUESTRO SISTEMA OPERATIVO WINDOWS|||'
 
 
	For time = 1 To 2
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 1000
	objShell.SendKeys "chrome://settings/clearBrowserData"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{END}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}" & "~"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "^w"
	WScript.Sleep 100
	next
	Set objShell = WScript.CreateObject("WScript.Shell")
	objShell.run "chrome.exe", 3, false
	WScript.Sleep 1000
	objShell.SendKeys "chrome://settings/content/cookies"
	WScript.Sleep 500
	objShell.SendKeys "~"
	WScript.Sleep 1000
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "{TAB}"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 100
	objShell.SendKeys "~"
	WScript.Sleep 500
	objShell.SendKeys "{ESC}"
	WScript.Sleep 100
	objShell.SendKeys "^w"
	WScript.Sleep 1000
	objShell.SendKeys "{F5}"
	WScript.Sleep 100
	objShell.SendKeys "{F5}"
	resultado = MsgBox("|>||  SI SU IP HA CAMBIADO, HAGA CLICK EN SI  ||<|" & vbNewLine & "|>||  DE LO CONTRARIO, HAGA CLICK EN NO      ||<|",vbYesNo or vbExclamation, "	|||>>>|CONFIRMACION|<<<|||	")
	If resultado = vbnO Then
	objShell.SendKeys "^+w"
	WScript.Sleep 100
	objShell.SendKeys "^+w"
	WScript.Sleep 100
	Call codigo (objShell,objNetwork,strTitle,strDefaultServer,strDefaultUser,strComputer,strUsername,strPassword,strDefaultGateway,time)
	Else
	WScript.quit
	End If
	End Function


LO CONSEGUI INTRODUCIENDO LAS VARIABLES DENTRO DE LOS PARENTESIS, DESPUÉS DE DECLARAR EL NOMBRE DE LA FUNCIÓN; Y ELIMINANDO ·OPTION EXPLICIT·, YA QUE SI NO ME DABA ERROR.

ESPERO PODER AYUDAR A OTROS QUE PUEDAN TENER ESTE MISMO PROBLEMA ALGUN DÍA, POR ESO DEJO AQUI LA SOLUCIÓN.

TAL VEZ A ALGUNOS LES PAREZCA ALGO MUY SIMPLE Y TONTO; PERO ESTAS SON LAS COSAS QUE A VECES MÁS SE RECISTEN.

SALUDOS Y QUE PASEN UN BUEN DÍA.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar