View Single Post
Old 20 June 2018, 00:51   #130
AlfaRomeo
A1200 040 SAM440EP 667
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 793
If you run this code (including already your suggestion), and change the MUICycle and go to see the console output you will see that the statement generates many passwords.
Anyway, I think your suggestion it´s the best bet, thanks


Code:
optimize 7

; Set some application properties
MUIApplicationTitle "3ncrYptor"
MUIApplicationDescription "MUI encrypter/Decrypter program"

pass$=""

Statement rndKey{}
SHARED pass$
alpha$="ABCDEFGHIJKLMNOPQRSTYUVWXZabcdefghijklmnopqrstyuvwxz#/+=0123456789"

Dim s$(Len(alpha$))
Dim p$(20)

For x=0 To Len(alpha$)
  s$(x)=Mid$(alpha$,x,1)
Next

For i=0 To 19
  p$(i)=s$(Rnd(66))
  pass$=pass$+ p$(i)
Next

MUISet 3, #MUIA_ShowMe, 1 : MUISetString 3, "Generated key> "+pass$

NPrint pass$
End Statement


Statement noRnd{}

  MUISet 2, #MUIA_ShowMe, 1 : teste$=MUIGetString$(2)
;  MUIFreeObject 3

End Statement

success.l=0
myChoice.l=False
cy.l=0

;NoCli
WBStartup
FindScreen 0

Dim PageName$(2)

PageName$(0)="3ncrYpter"
PageName$(1)="d3crypt3r"

MUILabel 0,"Generate a random key?",#MUIO_Label_DoubleFrame
MUICycle 1,"Rnd key","Yes","No"
MUIString 2,"Enter key",10 : MUISet 2, #MUIA_ShowMe, 0
MUIString 3,"",37 : MUISet 3, #MUIA_ShowMe, 0
MUIHSpace 4,60


MUIAddObjsHGroup 6,0,1
MUICreateHGroup 6

MUIAddObjsHGroup 7,2,3,4
MUICreateHGroup 7

MUIAddObjsVGroup 8,6,7
MUICreateVGroup 8

MUIAddObjsPage 10,8
MUICreatePage 10,"3ncrYpt3r","d3crYpt3r"

MUICreateWindow 11,"crYpt3r","PAGE",10
MUIAddSubWindow 11

If MUICreateApplication <> True Then End

MUINotifyApp 11,#MUIA_Window_CloseRequest,1,-11


success=MUIOpenWindow(11)

Repeat
  ev.l=MUIWaitEvent
  Select ev
    Case myChoice
      cy=MUIGetCycle(1)
      If cy=1 Then rndKey{}
      If cy=2 Then noRnd{}
    End Select
Until ev=-11

MUICloseWindow 11

End
AlfaRomeo is offline  
 
Page generated in 0.05994 seconds with 11 queries