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

Life is soft - evento anual de software empresarial
 
Vista:
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 16:00:21
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 pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder