Equivalencia de gotoline - Forum

Forum Navigation
You need to log in to create posts and topics.

Equivalencia de gotoline

Buenos días. Estoy dando los primeros pasos en esta aplicación.

Tengo hecho un script en neobook tradicional y al intentar convertirlo a visualneo Web me encuentro que no tengo equivalencia en el comando gotoline que sí estaba en visualneo win, pero no en aquel.

Cómo puedo solucionarlo? No puedo hacer un bucle dado que no sé las veces que se puede repetir la condición

Gracias

@julian no existe gotoline en VisualNEO Web, en su lugar puedes crear una subrutina y llamarla en el punto en que pondrías el gotoline. Una subrutina no es más que un bloque de código al que le das un nombre. Lo ejecutas simplemente poniendo su nombre como si de un comando se tratase.

Saludos!

Buenas y gracias. No termino de ver la aplicación a lo que estoy haciendo mediante el empleo de un subrutina.

Pego el código para que veas lo que estoy intentando hacer

FocusObject "NumericInput1"
SetVar [ms] 0
SetVar [he] 0
SetVar [K] 1

Random 9999 [aleatorio]
SetVar [numero] [aleatorio]

If [aleatorio] < "1234"
Gotoline "1"
endif

SetVar [aleatorio] [aleatorio]+""

StrSearch "0" "[aleatorio]" "[posicion]"

If "[posicion]" != 0
Gotoline "1"
endif

 

 

 

SubStr "[aleatorio]" 1 1 [al1]
SubStr "[aleatorio]" 2 3 [aleatorio]
SearchStr "[al1]" "[aleatorio]" [posicion]
If [posicion] != 0
.WinExecAction "gotoline 1"
GotoPage "NewPage"
endif

 

Como ves lo que hago es volver a ejecutar el código desde el inicio en el caso que no se cumplan las condiciones. Si hago una subrutina, si no se cumple a la primera volverá a la línea siguiente.

Gracias

@julian

1) GoToLine commands have been removed from most computer languages for about 20+ years because they do not fit the "structured mold" of conditional command blocks (and are/were the root cause of a lot of errors).

2) I can not decipher your logic, but here is some code that might do what your VisualNEOWin code allowed you to do ...

FocusObject "NumericInput1"
SetVar [ms] 0
SetVar [he] 0
SetVar [K] 1

SetVar "[keepGoing]" "yes"

While "[keepGoing]" = "yes"

Random 9999 [aleatorio]
SetVar [numero] [aleatorio]

If [aleatorio] >= "1234"
   SetVar [aleatorio] [aleatorio]+""
   StrSearch "0" "[aleatorio]" "[posicion]"

   If "[posicion]" = 0
      SubStr "[aleatorio]" 1 1 [al1]
      SubStr "[aleatorio]" 2 3 [aleatorio]
      SearchStr "[al1]" "[aleatorio]" [posicion]
      If [posicion] = 0
         SetVar "[keepGoing]" "no"
      endif
      
   endif
   
endif

Wend

GotoPage "NewPage"

... it uses the While/Wend code block ... and only continues processing for an iteration if the "opposite If condition" is met.

 

Added later: Chrome's AutoTranslate feature messes up some of the code (equal signs) ... so you may have to revert to untranslated web contents to get the correct code.

 

@julian @gaev note that it shouldn't be While - Wend but While - EndWhile.
Regards.