Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: .:: KsV ::. en 27 Enero 2015, 06:39 am



Título: Ayuda Vbscript
Publicado por: .:: KsV ::. en 27 Enero 2015, 06:39 am
Algien q me ayude


Código:
 ocp = MsgBox ("aleatorio? ",36,".::Kvs::.")  

si le usuario marca q si quiero q en
genere (:) o (.)(en modo randomize)
osea no todas las x seran iguales
a veces valdra : otras (.)

y si el usuario dice q no x = ":"

Código:
.WriteLine "12"&x&"3"&x&"45"&x&"678"&x&"9"&x&"0"




esta funcion regresa (.) o (:) si les ayuda
a ayudarme


Código
  1.  
  2. Function odc()
  3. Randomize
  4.   ksv = Mid(01, Int(Rnd * 2) + 1, 1)
  5. if ksv = 1 then
  6. odc = ":"
  7. else
  8. odc = "."
  9. end if
  10. end function
  11.  
  12.  


Título: Re: Ayuda Vbscript
Publicado por: MCKSys Argentina en 27 Enero 2015, 07:46 am
Algien q me ayude


 ocp = MsgBox ("aleatorio? ",36,".::Kvs::.")  
 
si le usuario marca q si quiero q en
genere (:) o (.)(en modo randomize)
osea no todas las x seran iguales
a veces valdra : otras (.)

y si el usuario dice q no x = ":"

.WriteLine "12"&x&"3"&x&"45"&x&"678"&x&"9"&x&"0"




esta funcion regresa (.) o (:) si les ayuda
a ayudarme


Código
  1.  
  2. Function odc()
  3. Randomize
  4.   ksv = Mid(01, Int(Rnd * 2) + 1, 1)
  5. if ksv = 1 then
  6. odc = ":"
  7. else
  8. odc = "."
  9. end if
  10. end function
  11.  
  12.  

Creo que entendí mal, asi que te pregunto:

Quieres una función que en base a lo devuelto por un MsgBox (vbYes o vbNo) te genere un string, el cual variará entre ":" y "." si el MsgBox devuelve vbYes y ":" si devuelve vbNo.

Es asi? Si es asi:

Código
  1. Function Aleatoria() As String
  2. Dim ret As Integer
  3.  
  4. ret = MsgBox("Dime si SI o NO", vbYesNo, "El titulo")
  5. If ret = vbYes Then
  6.    Randomize
  7.    ret = Int(10 * Rnd) 'Random de 0 a 9
  8.    If (ret Mod 2) = 0 Then 'si el random generó un numero par
  9.        Aleatoria = ":"
  10.    Else 'si es impar
  11.        Aleatoria = "."
  12.    End If
  13. Else
  14.    Aleatoria = ":"
  15. End If
  16. End Function
  17.  

Sino, bueno, deberás explicarte mejor...  :P

Saludos!


Título: Re: Ayuda Vbscript
Publicado por: .:: KsV ::. en 27 Enero 2015, 08:22 am
me explico  al principio del code  el programa pedira q si qiere aleatorio o no si marca q si x tomara un valor (:) o(.) cada x tomara un valor aleatorio (:) (.) y lo escribe en un txt


pej.

el usuario marca si



Código:
.writeline "1"&x&"2"&x&"45"&x&"67"....n"

cada x sera distinta :   .

resultado

*.txt

Código:
1.2.45;67.74;96;246.35;....n


y si marca q no

Código:
 1:2:45:67:74:96:246:35:...n



la funcion q propones abrira un mensaje por cada n X




Título: Re: Ayuda Vbscript
Publicado por: .:: KsV ::. en 27 Enero 2015, 15:41 pm
RESUELTO

Soli era cuestion de sacar el msgbox de la fncion q proporcionaste  y llamar a pa funcion