Jump to content

Recommended Posts

Posted (edited)

I have a script with more than 5000 thousand lines of code (yes, i'm sure i could slim it down, but i'm a n00bish)

I've got more than one GUI and lots of functions, and everything is working so far, but...

Now i'm trying to put a password script in the beginning of that huge code. If the password is correct, it should go to the GUI and show it.

How can i point to the beginning of the GUI if i have tons of functions and other GUIs in it? Is this possible, or do i need a specific function for the GUIs?

I know i can't have functions inside functions...

Edited by telmob
Posted

you should probably post a code snippet to the areas you want to adjust/add to. Makes it easier for someone to help.

also... how the hell did you write 5k lines of code and not know what you're doing :oops:

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Posted

LOL!

Ok, let's try to write some example code...

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonCancel
Exit
Case $ButtonOk
_Decrypt()
$Hash=IniRead($HashFile, GUICtrlRead($UsernameCheck), "Hash", "")
$HashTrimmed="0x"&StringTrimLeft(StringTrimRight($Hash,3),1)
$UserExists=IniReadSection($HashFile, GUICtrlRead($UsernameCheck))
If $UsernameCheck<>"" And $UserExists<>"" And _Crypt_HashData(GUICtrlRead($PasswordCheck),$CALG_MD5)=$HashTrimmed Then
Global $FirstUserNameFind = StringInStr(IniRead(@ScriptDir & "\data\config.ini", GUICtrlRead($UsernameCheck), "Nome", ""), " ")
Global $FirstUserNameResult = StringLeft(IniRead(@ScriptDir & "\data\config.ini", GUICtrlRead($UsernameCheck), "Nome", ""), $FirstUserNameFind)
Global $FullUserNameFind = IniRead(@ScriptDir & "\data\config.ini", GUICtrlRead($UsernameCheck), "Nome", "")
Global $UserQualif=GUICtrlRead($UsernameCheck)
_Crypt()
GUICtrlSetState($AcessDeniedLabel, $GUI_HIDE)
GUICtrlSetState($AcessGrantedLabel, $GUI_SHOW)
Sleep(1000)
GUIDelete()
-------------------------------------------------------How do i point to the GUI here if i can't use more funcs?
ElseIf $UserExists="" OR _Crypt_HashData(GUICtrlRead($PasswordCheck),$CALG_MD5)<>$Hash Then
GUICtrlSetState($AcessDeniedLabel, $GUI_SHOW)
Sleep(1000)
GUICtrlSetState($AcessDeniedLabel, $GUI_HIDE)
_Crypt()
EndIf
EndSwitch
WEnd


$GUI
bla
bla
bla
Lots of funcs here...

Here some GUI elements change.
  • Moderators
Posted (edited)

Hi, Telmob. So put in a Function like this:

Func _mypw()

$pw = "mypw"
$input = InputBox("My Script Name", "Please enter a password", "", "*")
If $pw <> $input Then
Exit
EndIf

EndFunc

And then call the function on your first line:

_mypw()
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

Thanks Kylomas, i'm using inputboxes already. It just would make the example code huge to post everything here.

JLogan3013, You just gave me an idea :oops:

You can mark this thread as solved!

Thanks again.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...