Jump to content

Reduction code


Recommended Posts

Hi, please reduction function..

Code, case func..

case $a
       a()
    case $b
       b()
     case $c
       c()
    case $d
       d()
    case $e
       e()
    case $f
       f()
    case $Lock
       lock()
    case $Unlock
       unlock()

and code function ;/

func a()
local $Form1 = GUICreate("Hasło do: " & $passkey[0], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[0], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
    Case $GUI_EVENT_CLOSE
       GUIDelete($Form1)
     Return
    case $change
       $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
       IniWrite("config.passwordmanagerpro","password","pass1",$newpw)
       GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func b()
local $Form1 = GUICreate("Hasło do: " & $passkey[1], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[1], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
    Case $GUI_EVENT_CLOSE
       GUIDelete($Form1)
     Return
    case $change
       $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
       IniWrite("config.passwordmanagerpro","password","pass2",$newpw)
       GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func c()
local $Form1 = GUICreate("Hasło do: " & $passkey[2], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[2], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
    Case $GUI_EVENT_CLOSE
       GUIDelete($Form1)
     Return
       case $change
       $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
       IniWrite("config.passwordmanagerpro","password","pass3",$newpw)
       GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func d()
Local $Form1 = GUICreate("Hasło do: " & $passkey[3], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($passkey[3], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
    Case $GUI_EVENT_CLOSE
       GUIDelete($Form1)
     Return
   case $change
       $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
       IniWrite("config.passwordmanagerpro","password","pass4",$newpw)
       GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func e()
local $Form1 = GUICreate("Hasło do: " & $passkey[4], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[4], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
    Case $GUI_EVENT_CLOSE
       GUIDelete($Form1)
     Return
       case $change
       $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
       IniWrite("config.passwordmanagerpro","password","pass5",$newpw)
       GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func f()
local $Form1 = GUICreate("Haslo do: " & $passkey[5] , 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[5], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
    Case $GUI_EVENT_CLOSE
       GUIDelete($Form1)
     Return
    case $change
       $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",220,180)
       IniWrite("config.passwordmanagerpro","password","pass6",$newpw)
       GUICtrlSetData($input1,$newpw)
endfunc

Please do not use the reply msgbox, i want to gui.

Have a nice day ;)

PS.

I'm from a poland, code in polish language.

Edited by Melba23
Added autoit tags
Link to comment
Share on other sites

  • Moderators

Bumek662,

And what exactly is the problem with this script? What does it not do that you want it to do? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Bumek662,

Something using parameters like this is much shorter: ;)

Switch $vFred
    Case $a
        _Function(0)
    Case $b
        _Function(1)
    Case $c
        _Function(2)
    Case $d
        _Function(3)
    Case $e
        _Function(4)
    Case $f
        _Function(5)
    Case $Lock
        lock()
    Case $Unlock
        unlock()
EndSwitch

Func _Function($iIndex)
    Local $Form1 = GUICreate("Haslo do: " & $passkey[$iIndex], 338, 152, 192, 132)
    $Input1 = GUICtrlCreateInput($pass[0], 0, 48, 337, 36)
    $IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Change = GUICtrlCreateButton("Zmien haslo", 56, 96, 201, 41)
    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                Return
            Case $Change
                $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostana zapisane po restarcie programu.", "", "*", 250, 200)
                IniWrite("config.passwordmanagerpro", "password", "pass" & ($iIndex + 1), $newpw)
                GUICtrlSetData($Input1, $newpw)
        EndSwitch
    WEnd
EndFunc   ;==>_Function

Please check that you do in fact get the correct values in the GUI title and the ini file - that matches the code you posted, but as I have no idea what structures you are actually using I cannot be 100% sure it is correct. :)

M23

P.S. When you post code please use Code tags - put [autoit] before and [/autoit] after your posted code. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. ;)

P.P.S. Do NOT send PMs asking for help - read the Forum rules before posting again. :naughty:

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Bumek662,

Something using parameters like this is much shorter: ;)

Switch $vFred
Case $a
_Function(0)
Case $b
_Function(1)
Case $c
_Function(2)
Case $d
_Function(3)
Case $e
_Function(4)
Case $f
_Function(5)
Case $Lock
lock()
Case $Unlock
unlock()
EndSwitch

Func _Function($iIndex)
Local $Form1 = GUICreate("Haslo do: " & $passkey[$iIndex], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[0], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmien haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form1)
Return
Case $Change
$newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostana zapisane po restarcie programu.", "", "*", 250, 200)
IniWrite("config.passwordmanagerpro", "password", "pass" & ($iIndex + 1), $newpw)
GUICtrlSetData($Input1, $newpw)
EndSwitch
WEnd
EndFunc ;==>_Function

Please check that you do in fact get the correct values in the GUI title and the ini file - that matches the code you posted, but as I have no idea what structures you are actually using I cannot be 100% sure it is correct. :)

M23

P.S. When you post code please use Code tags - put

before and
after your posted code. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. ;)

P.P.S. Do NOT send PMs asking for help - read the Forum rules before posting again. :naughty:

Full code:

#NoTrayIcon
#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$filepassword = IniRead("config.passwordmanagerpro","filepassword","passwordfile","123")
   $x = InputBox("Hasło do programu", "Podaj hasło do tego programu. " & @LF & 'Domyślne to "123"', "","*",240,190)
   If $x = $filepassword Then
FileSetAttrib("config.passwordmanagerpro","H")

Global $pass[12], $passkey[12]
For $i = 0 to 11 step +1
$pass[$i] = IniRead("config.passwordmanagerpro","password","pass"&($i+1),"")
Next

For $i = 0 to 11 step +1
$passkey[$i] = IniRead("config.passwordmanagerpro","guipass","pass"&($i+1),"")
Next
$licensekey = IniRead("config.passwordmanagerpro","LicenseSettings","LicenseTo","xxx")

$PassGui = GUICreate("Password Manager Premium 1.4 -  " & $licensekey, 654, 359, 200, 125)
GUISetBkColor(0xFFFFFF)
$a = GUICtrlCreateButton($passkey[0], 8, 8, 161, 57)
$b = GUICtrlCreateButton($passkey[1], 8, 72, 161, 57)
$c = GUICtrlCreateButton($passkey[2], 8, 136, 161, 57)
$d = GUICtrlCreateButton($passkey[3], 8, 200, 161, 57)
$e = GUICtrlCreateButton($passkey[4], 176, 8, 161, 57)
$f = GUICtrlCreateButton($passkey[5], 176, 72, 161, 57)
$g = GUICtrlCreateButton($passkey[6], 176, 136, 161, 57)
$h = GUICtrlCreateButton($passkey[7], 176, 200, 161, 57)
$i = GUICtrlCreateButton($passkey[8], 344, 8, 161, 57)
$j = GUICtrlCreateButton($passkey[9], 344, 72, 161, 57)
$k = GUICtrlCreateButton($passkey[10], 344, 136, 161, 57)
$l = GUICtrlCreateButton($passkey[11], 344, 200, 161, 57)
$Panel = GUICtrlCreateButton("Panel Zarządzania", 520, 8, 129, 209)
$License = GUICtrlCreateLabel("Licencja dla: " & $licensekey, 13, 311, 499, 50)
$Lock = GUICtrlCreateButton("Zablokuj", 8, 272, 497, 33)
$Unlock = GUICtrlCreateButton("Odblokuj", 8, 272, 497, 33)
$Autor = GUICtrlCreateLabel("Password Manger Premium  by Bumek662 i PatrykN101", 13, 336, 443, 17)
GUICtrlSetState($Unlock,$GUI_HIDE)
GUICtrlSetState($Unlock,$GUI_DISABLE)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
Case $GUI_EVENT_CLOSE
         Exit
       case $Panel
         acp()
         exit
      case $a
         a()
      case $b
         b()
       case $c
         c()
      case $d
         d()
      case $e
         e()
      case $f
         f()
case $Lock
lock()
case $Unlock
unlock()

EndSwitch
WEnd
   ElseIf @error = 1 Then
      Exit
 run(@ScriptFullPath)
   Else
      MsgBox(0, "Błąd!", 'Ups. Złe hasło.' & @LF & 'Domyślne hasło to "123"', 2)
   EndIf
func acp()
local $FormGui = GUICreate("PMP - Konfiguracja - License to " & $licensekey, 538, 438, 232, 132)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("Nazwy przycisków", 0, 0, 249, 217)
$Label1 = GUICtrlCreateLabel("Nazwa 1", 8, 24, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Nazwa 2", 8, 56, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Nazwa 3", 8, 88, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("Nazwa 4", 8, 120, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("Nazwa 5", 8, 152, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("Nazwa 6", 8, 184, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Nazwa1 = GUICtrlCreateInput($passkey[0], 80, 24, 161, 24)
$Nazwa2 = GUICtrlCreateInput($passkey[1], 80, 56, 161, 24)
$Nazwa3 = GUICtrlCreateInput($passkey[2], 80, 88, 161, 24)
$Nazwa4 = GUICtrlCreateInput($passkey[3], 80, 120, 161, 24)
$Nazwa5 = GUICtrlCreateInput($passkey[4], 80, 152, 161, 24)
$Nazwa6 = GUICtrlCreateInput($passkey[5], 80, 184, 161, 24)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Hasla", 288, 0, 249, 217)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$LicenseSettings = GUICtrlCreateGroup("Ustawienia licencji", 24, 224, 489, 65)
GUICtrlSetFont(-1, 11, 800, 0, "Poplar Std")
$Label13 = GUICtrlCreateLabel("Licencja dla:", 32, 256, 77, 25)
$LicenseInput = GUICtrlCreateInput($licensekey, 112, 248, 385, 29)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Save = GUICtrlCreateButton("Zapisz zmiany", 152, 400, 219, 33)
$Label7 = GUICtrlCreateLabel("Haslo 1", 296, 24, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("Haslo 2", 296, 56, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("Haslo 3", 296, 88, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label11 = GUICtrlCreateLabel("Haslo 4", 296, 120, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("Haslo 5", 296, 152, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label14 = GUICtrlCreateLabel("Haslo 6", 296, 184, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Haslo1 = GUICtrlCreateInput($pass[0], 360, 24, 161, 24)
$Haslo2 = GUICtrlCreateInput($pass[1], 360, 56, 161, 24)
$Haslo3 = GUICtrlCreateInput($pass[2], 360, 88, 161, 24)
$Haslo4 = GUICtrlCreateInput($pass[3], 360, 120, 161, 24)
$Haslo5 = GUICtrlCreateInput($pass[4], 360, 152, 161, 24)
$Haslo6 = GUICtrlCreateInput($pass[5], 360, 184, 161, 24)
$Group3 = GUICtrlCreateGroup("Haslo do programu", 24, 312, 489, 65)
$Label15 = GUICtrlCreateLabel("Nowe haslo:", 32, 344, 77, 25)
$PasswordInput = GUICtrlCreateInput($filepassword, 112, 336, 385, 29)
$info = GUICtrlCreateButton("Informacje", 392, 400, 129, 33)
$Clear = GUICtrlCreateButton("Przywróć Domyślne", 8, 400, 129, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
run(@ScriptFullPath)
exit
case $Save
         $name1 = GuiCtrlRead($Nazwa1)
$name2 = GuiCtrlRead($Nazwa2)
         $name3 = GuiCtrlRead($Nazwa3)
$name4 = GuiCtrlRead($Nazwa4)
         $name5 = GuiCtrlRead($Nazwa5)
         $name6 = GuiCtrlRead($Nazwa6)
         $password1 = GuiCtrlRead($Haslo1)
         $password2 = GuiCtrlRead($Haslo2)
         $password3 = GuiCtrlRead($Haslo3)
         $password4 = GuiCtrlRead($Haslo4)
         $password5 = GuiCtrlRead($Haslo5)
         $password6 = GuiCtrlRead($Haslo6)
         $licenseto = GUICtrlRead($LicenseInput)
         $passwordfile = GUICtrlRead($PasswordInput)
IniWrite("config.passwordmanagerpro","guipass","pass1",$name1)
IniWrite("config.passwordmanagerpro","guipass","pass2",$name2)
IniWrite("config.passwordmanagerpro","guipass","pass3",$name3)
IniWrite("config.passwordmanagerpro","guipass","pass4",$name4)
IniWrite("config.passwordmanagerpro","guipass","pass5",$name5)
IniWrite("config.passwordmanagerpro","guipass","pass6",$name6)

IniWrite("config.passwordmanagerpro","password","pass1",$password1)
IniWrite("config.passwordmanagerpro","password","pass2",$password2)
IniWrite("config.passwordmanagerpro","password","pass3",$password3)
IniWrite("config.passwordmanagerpro","password","pass4",$password4)
IniWrite("config.passwordmanagerpro","password","pass5",$password5)
IniWrite("config.passwordmanagerpro","password","pass6",$password6)

IniWrite("config.passwordmanagerpro","filepassword","passwordfile",$Passwordfile)
IniWrite("config.passwordmanagerpro","LicenseSettings","LicenseTo",$licenseto)
FileSetAttrib("config.passwordmanagerpro","H")
run(@ScriptFullPath)
Exit
        case $info
msgbox(0,"Info","Autorzy: Bumek662, PatrykN101" & @LF & "Wersja: 1.4 " & @LF & "Kontakt GG: 3934134 ")
case $Clear
         GUICtrlSetData($Nazwa1,"")
GUICtrlSetData($Nazwa2,"")
GUICtrlSetData($Nazwa3,"")
GUICtrlSetData($Nazwa4,"")
GUICtrlSetData($Nazwa5,"")
GUICtrlSetData($Nazwa6,"")
GUICtrlSetData($Haslo1,"")
GUICtrlSetData($Haslo2,"")
GUICtrlSetData($Haslo3,"")
GUICtrlSetData($Haslo4,"")
GUICtrlSetData($Haslo5,"")
GUICtrlSetData($Haslo6,"")
GUICtrlSetData($PasswordInput,"123")
GUICtrlSetData($LicenseInput,"")
   EndSwitch
WEnd
EndFunc
func a()
local $Form1 = GUICreate("Hasło do: " & $passkey[0], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[0], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         GUIDelete($Form1)
       Return
      case $change
         $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
         IniWrite("config.passwordmanagerpro","password","pass1",$newpw)
         GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func b()
local $Form1 = GUICreate("Hasło do: " & $passkey[1], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[1], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         GUIDelete($Form1)
       Return
      case $change
         $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
         IniWrite("config.passwordmanagerpro","password","pass2",$newpw)
         GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func c()
local $Form1 = GUICreate("Hasło do: " & $passkey[2], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[2], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         GUIDelete($Form1)
       Return
     case $change
         $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
         IniWrite("config.passwordmanagerpro","password","pass3",$newpw)
         GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func d()
Local $Form1 = GUICreate("Hasło do: " & $passkey[3], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($passkey[3], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         GUIDelete($Form1)
       Return
case $change
         $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
         IniWrite("config.passwordmanagerpro","password","pass4",$newpw)
         GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func e()
local $Form1 = GUICreate("Hasło do: " & $passkey[4], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[4], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         GUIDelete($Form1)
       Return
     case $change
         $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",250,200)
         IniWrite("config.passwordmanagerpro","password","pass5",$newpw)
         GUICtrlSetData($input1,$newpw)
   EndSwitch
WEnd
EndFunc

func f()
local $Form1 = GUICreate("Haslo do: " & $passkey[5] , 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[5], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmień haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
         GUIDelete($Form1)
       Return
      case $change
         $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostaną zapisane po restarcie programu.", "","*",220,180)
         IniWrite("config.passwordmanagerpro","password","pass6",$newpw)
         GUICtrlSetData($input1,$newpw)




   EndSwitch
WEnd
EndFunc
func lock()
GuiCtrlSetState($a,$GUI_DISABLE)
GuiCtrlSetState($b,$GUI_DISABLE)
GuiCtrlSetState($c,$GUI_DISABLE)
GuiCtrlSetState($d,$GUI_DISABLE)
GuiCtrlSetState($e,$GUI_DISABLE)
GuiCtrlSetState($f,$GUI_DISABLE)
GuiCtrlSetState($Panel,$GUI_DISABLE)
GuiCtrlSetState($LOCK,$GUI_HIDE)
GUICtrlSetState($Unlock,$GUI_SHOW)
GuiCtrlSetState($Unlock,$GUI_ENABLE)

EndFunc
Func unlock()
  $x = InputBox("Zablokowano", "Podaj hasło do odblokowania " & @LF & 'Domyślne hasło to "123"', "","*",240,190)
   If $x = $filepassword Then
GuiCtrlSetState($a,$GUI_ENABLE)
GuiCtrlSetState($b,$GUI_ENABLE)
GuiCtrlSetState($c,$GUI_ENABLE)
GuiCtrlSetState($d,$GUI_ENABLE)
GuiCtrlSetState($e,$GUI_ENABLE)
GuiCtrlSetState($f,$GUI_ENABLE)
GuiCtrlSetState($Panel,$GUI_ENABLE)
GuiCtrlSetState($LOCK,$GUI_SHOW)
GUICtrlSetState($Unlock,$GUI_HIDE)
GuiCtrlSetState($Unlock,$GUI_DISABLE)
ElseIf @error = 1 Then
 MsgBox(0, "Błąd!", 'Ups. Złe hasło.' & @LF & 'Domyślne hasło to "123"', 3)
 unlock()
   Else
      MsgBox(0, "Błąd!", 'Ups. Złe hasło.' & @LF & 'Domyślne hasło to "123"', 3)
 unlock()
   EndIf
EndFunc
Link to comment
Share on other sites

  • Moderators

Bumek662,

And what is the problem with this code? :huh:

Because if you are expecting me to amend it to include the suggested code I suggested above, you will be waiting a long time. Do some work yourself first and come back if it does not work as expected - and then explain what is wrong. :P

M23

P.S. In future please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unneccessarily. ;)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Help reduce it?:

func acp()
local $FormGui = GUICreate("PMP - Konfiguracja - License to " & $licensekey, 538, 438, 232, 132)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("Nazwy przycisków", 0, 0, 249, 217)
$Label1 = GUICtrlCreateLabel("Nazwa 1", 8, 24, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Nazwa 2", 8, 56, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Nazwa 3", 8, 88, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("Nazwa 4", 8, 120, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("Nazwa 5", 8, 152, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("Nazwa 6", 8, 184, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Nazwa1 = GUICtrlCreateInput($passkey[0], 80, 24, 161, 24)
$Nazwa2 = GUICtrlCreateInput($passkey[1], 80, 56, 161, 24)
$Nazwa3 = GUICtrlCreateInput($passkey[2], 80, 88, 161, 24)
$Nazwa4 = GUICtrlCreateInput($passkey[3], 80, 120, 161, 24)
$Nazwa5 = GUICtrlCreateInput($passkey[4], 80, 152, 161, 24)
$Nazwa6 = GUICtrlCreateInput($passkey[5], 80, 184, 161, 24)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Hasla", 288, 0, 249, 217)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$LicenseSettings = GUICtrlCreateGroup("Ustawienia licencji", 24, 224, 489, 65)
GUICtrlSetFont(-1, 11, 800, 0, "Poplar Std")
$Label13 = GUICtrlCreateLabel("Licencja dla:", 32, 256, 77, 25)
$LicenseInput = GUICtrlCreateInput($licensekey, 112, 248, 385, 29)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Save = GUICtrlCreateButton("Zapisz zmiany", 152, 400, 219, 33)
$Label7 = GUICtrlCreateLabel("Haslo 1", 296, 24, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("Haslo 2", 296, 56, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("Haslo 3", 296, 88, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label11 = GUICtrlCreateLabel("Haslo 4", 296, 120, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("Haslo 5", 296, 152, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label14 = GUICtrlCreateLabel("Haslo 6", 296, 184, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Haslo1 = GUICtrlCreateInput($pass[0], 360, 24, 161, 24)
$Haslo2 = GUICtrlCreateInput($pass[1], 360, 56, 161, 24)
$Haslo3 = GUICtrlCreateInput($pass[2], 360, 88, 161, 24)
$Haslo4 = GUICtrlCreateInput($pass[3], 360, 120, 161, 24)
$Haslo5 = GUICtrlCreateInput($pass[4], 360, 152, 161, 24)
$Haslo6 = GUICtrlCreateInput($pass[5], 360, 184, 161, 24)
$Group3 = GUICtrlCreateGroup("Haslo do programu", 24, 312, 489, 65)
$Label15 = GUICtrlCreateLabel("Nowe haslo:", 32, 344, 77, 25)
$PasswordInput = GUICtrlCreateInput($filepassword, 112, 336, 385, 29)
$info = GUICtrlCreateButton("Informacje", 392, 400, 129, 33)
$Clear = GUICtrlCreateButton("Przywróć Domyślne", 8, 400, 129, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
      Case $GUI_EVENT_CLOSE
run(@ScriptFullPath)
exit
case $Save
         $name1 = GuiCtrlRead($Nazwa1)
$name2 = GuiCtrlRead($Nazwa2)
         $name3 = GuiCtrlRead($Nazwa3)
$name4 = GuiCtrlRead($Nazwa4)
         $name5 = GuiCtrlRead($Nazwa5)
         $name6 = GuiCtrlRead($Nazwa6)
         $password1 = GuiCtrlRead($Haslo1)
         $password2 = GuiCtrlRead($Haslo2)
         $password3 = GuiCtrlRead($Haslo3)
         $password4 = GuiCtrlRead($Haslo4)
         $password5 = GuiCtrlRead($Haslo5)
         $password6 = GuiCtrlRead($Haslo6)
         $licenseto = GUICtrlRead($LicenseInput)
         $passwordfile = GUICtrlRead($PasswordInput)
IniWrite("config.passwordmanagerpro","guipass","pass1",$name1)
IniWrite("config.passwordmanagerpro","guipass","pass2",$name2)
IniWrite("config.passwordmanagerpro","guipass","pass3",$name3)
IniWrite("config.passwordmanagerpro","guipass","pass4",$name4)
IniWrite("config.passwordmanagerpro","guipass","pass5",$name5)
IniWrite("config.passwordmanagerpro","guipass","pass6",$name6)

IniWrite("config.passwordmanagerpro","password","pass1",$password1)
IniWrite("config.passwordmanagerpro","password","pass2",$password2)
IniWrite("config.passwordmanagerpro","password","pass3",$password3)
IniWrite("config.passwordmanagerpro","password","pass4",$password4)
IniWrite("config.passwordmanagerpro","password","pass5",$password5)
IniWrite("config.passwordmanagerpro","password","pass6",$password6)

IniWrite("config.passwordmanagerpro","filepassword","passwordfile",$Passwordfile)
IniWrite("config.passwordmanagerpro","LicenseSettings","LicenseTo",$licenseto)
FileSetAttrib("config.passwordmanagerpro","H")
run(@ScriptFullPath)
Exit
        case $info
msgbox(0,"Info","Autorzy: Bumek662, PatrykN101" & @LF & "Wersja: 1.4 " & @LF & "Kontakt GG: 3934134 ")
case $Clear
         GUICtrlSetData($Nazwa1,"")
GUICtrlSetData($Nazwa2,"")
GUICtrlSetData($Nazwa3,"")
GUICtrlSetData($Nazwa4,"")
GUICtrlSetData($Nazwa5,"")
GUICtrlSetData($Nazwa6,"")
GUICtrlSetData($Haslo1,"")
GUICtrlSetData($Haslo2,"")
GUICtrlSetData($Haslo3,"")
GUICtrlSetData($Haslo4,"")
GUICtrlSetData($Haslo5,"")
GUICtrlSetData($Haslo6,"")
GUICtrlSetData($PasswordInput,"123")
GUICtrlSetData($LicenseInput,"")
   EndSwitch
WEnd
EndFunc
Link to comment
Share on other sites

Use an Array

Note that when you create a control its ControlID is returned.

Hence successive controls have successive integers

Use them in a For To Next Loop and you reduce much of your code

Hope this helps

Regards :)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Use an Array

Note that when you create a control its ControlID is returned.

Hence successive controls have successive integers

Use them in a For To Next Loop and you reduce much of your code

Hope this helps

Regards :)

I'm amateur in AutoIt and English. ;/

Link to comment
Share on other sites

Somewhat like this

62 lines of code reduced( commented out so that you could figure out the differences )

Try to understand, ask help in case of any queries

Func acp()
Local $FormGui = GUICreate("PMP - Konfiguracja - License to ", 538, 438, 232, 132), $Nazwa[6], $Haslo[6]
GUISetBkColor(0xFFFFFF)


GUICtrlCreateGroup("Nazwy przycisków", 0, 0, 249, 217) ;No point of storing in a variable when u never read a label..!
For $i = 1 To 6
GUICtrlCreateLabel("Nazwa 1", 8, 24 + (($i - 1) * 32), 68, 24) ;No point of storing in a variable when u never read a label..!
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Next
#cs
$Label2 = GUICtrlCreateLabel("Nazwa 2", 8, 56, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Nazwa 3", 8, 88, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("Nazwa 4", 8, 120, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("Nazwa 5", 8, 152, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("Nazwa 6", 8, 184, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
#ce

For $i = 1 To 6
$Nazwa[$i - 1] = GUICtrlCreateInput($passkey[$i - 1], 80, 24 + (($i - 1) * 32), 161, 24)
Next
#cs
$Nazwa2 = GUICtrlCreateInput($passkey[1], 80, 56, 161, 24)
$Nazwa3 = GUICtrlCreateInput($passkey[2], 80, 88, 161, 24)
$Nazwa4 = GUICtrlCreateInput($passkey[3], 80, 120, 161, 24)
$Nazwa5 = GUICtrlCreateInput($passkey[4], 80, 152, 161, 24)
$Nazwa6 = GUICtrlCreateInput($passkey[5], 80, 184, 161, 24)
#ce
GUICtrlCreateGroup("", -99, -99, 1, 1)


GUICtrlCreateGroup("Ustawienia licencji", 24, 224, 489, 65)
GUICtrlSetFont(-1, 11, 800, 0, "Poplar Std")

GUICtrlCreateLabel("Licencja dla:", 32, 256, 77, 25)
$LicenseInput = GUICtrlCreateInput($licensekey, 112, 248, 385, 29)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Save = GUICtrlCreateButton("Zapisz zmiany", 152, 400, 219, 33)
GUICtrlCreateLabel("Haslo 1", 296, 24, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

For $i = 1 To 6
GUICtrlCreateLabel("Haslo 2", 296, 56 + (($i - 1) * 32), 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
Next
#cs
$Label10 = GUICtrlCreateLabel("Haslo 3", 296, 88, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label11 = GUICtrlCreateLabel("Haslo 4", 296, 120, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("Haslo 5", 296, 152, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label14 = GUICtrlCreateLabel("Haslo 6", 296, 184, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
#ce

For $i = 1 To 6
$Haslo[$i - 1] = GUICtrlCreateInput($pass[$i - 1], 360, 24 + (($i - 1) * 32), 161, 24)
Next
#cs
$Haslo2 = GUICtrlCreateInput($pass[1], 360, 56, 161, 24)
$Haslo3 = GUICtrlCreateInput($pass[2], 360, 88, 161, 24)
$Haslo4 = GUICtrlCreateInput($pass[3], 360, 120, 161, 24)
$Haslo5 = GUICtrlCreateInput($pass[4], 360, 152, 161, 24)
$Haslo6 = GUICtrlCreateInput($pass[5], 360, 184, 161, 24)
#ce

GUICtrlCreateGroup("Haslo do programu", 24, 312, 489, 65)
GUICtrlCreateLabel("Nowe haslo:", 32, 344, 77, 25)
$PasswordInput = GUICtrlCreateInput($filepassword, 112, 336, 385, 29)
$info = GUICtrlCreateButton("Informacje", 392, 400, 129, 33)
$Clear = GUICtrlCreateButton("Przywróc Domyslne", 8, 400, 129, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)


GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
;~ Run(@ScriptFullPath) ;Dont understand this line.,.!
Exit
Case $Save
For $i = 1 To 6
IniWrite("config.passwordmanagerpro", "guipass", "pass" & $i, GUICtrlRead($Nazwa[$i - 1]))
Next
#cs
$name1 = GUICtrlRead($Nazwa1)
$name2 = GUICtrlRead($Nazwa2)
$name3 = GUICtrlRead($Nazwa3)
$name4 = GUICtrlRead($Nazwa4)
$name5 = GUICtrlRead($Nazwa5)
$name6 = GUICtrlRead($Nazwa6)
IniWrite("config.passwordmanagerpro", "guipass", "pass1", $name1)
IniWrite("config.passwordmanagerpro", "guipass", "pass2", $name2)
IniWrite("config.passwordmanagerpro", "guipass", "pass3", $name3)
IniWrite("config.passwordmanagerpro", "guipass", "pass4", $name4)
IniWrite("config.passwordmanagerpro", "guipass", "pass5", $name5)
IniWrite("config.passwordmanagerpro", "guipass", "pass6", $name6)
#ce

For $i = 1 To 6
IniWrite("config.passwordmanagerpro", "password", "pass" & $i, GUICtrlRead($Haslo[$i - 1]))
Next
#cs
$password1 = GUICtrlRead($Haslo1)
$password2 = GUICtrlRead($Haslo2)
$password3 = GUICtrlRead($Haslo3)
$password4 = GUICtrlRead($Haslo4)
$password5 = GUICtrlRead($Haslo5)
$password6 = GUICtrlRead($Haslo6)
IniWrite("config.passwordmanagerpro", "password", "pass1", $password1)
IniWrite("config.passwordmanagerpro", "password", "pass2", $password2)
IniWrite("config.passwordmanagerpro", "password", "pass3", $password3)
IniWrite("config.passwordmanagerpro", "password", "pass4", $password4)
IniWrite("config.passwordmanagerpro", "password", "pass5", $password5)
IniWrite("config.passwordmanagerpro", "password", "pass6", $password6)
#ce

;~ $licenseto = GUICtrlRead($LicenseInput)
IniWrite("config.passwordmanagerpro", "LicenseSettings", "LicenseTo", GUICtrlRead($LicenseInput))
;~ $passwordfile = GUICtrlRead($PasswordInput)
IniWrite("config.passwordmanagerpro", "filepassword", "passwordfile", GUICtrlRead($PasswordInput))

FileSetAttrib("config.passwordmanagerpro", "H")
;~ Run(@ScriptFullPath)
Exit
Case $info
MsgBox(0, "Info", "Autorzy: Bumek662, PatrykN101" & @LF & "Wersja: 1.4 " & @LF & "Kontakt GG: 3934134 ")
Case $Clear
For $i = 1 To 6
GUICtrlSetData($Nazwa[$i - 1], "")
GUICtrlSetData($Haslo[$i - 1], "")
Next
#cs
GUICtrlSetData($Nazwa1, "")
GUICtrlSetData($Nazwa2, "")
GUICtrlSetData($Nazwa3, "")
GUICtrlSetData($Nazwa4, "")
GUICtrlSetData($Nazwa5, "")
GUICtrlSetData($Nazwa6, "")
GUICtrlSetData($Haslo1, "")
GUICtrlSetData($Haslo2, "")
GUICtrlSetData($Haslo3, "")
GUICtrlSetData($Haslo4, "")
GUICtrlSetData($Haslo5, "")
GUICtrlSetData($Haslo6, "")
#ce
GUICtrlSetData($PasswordInput, "123")
GUICtrlSetData($LicenseInput, "")
EndSwitch
WEnd
EndFunc ;==>acp

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

  • Moderators

Bumek662,

A couple of pointers:

- 1. Learn to use loops and arrays - it can save wear and tear on your typing finger(s).

- 2. Do not waste variable names - Koda assigns every ControlID to a variable but only those are used later actually need to be stored.

This script shows how to implement these suggestions:

#include <GUIConstantsEx.au3>

; Simulate required variables
Global $licensekey = "LicenceKey", $filepassword = "FilePassWord"
Global $passkey[6] = ["Key_0", "Key_1", "Key_2", "Key_3", "Key_4", "Key_5"]
Global $pass[6] = ["Pass_0", "Pass_1", "Pass_2", "Pass_3", "Pass_4", "Pass_5"]

acp()

Func acp()

    Local $sIniFile = "config.passwordmanagerpro"

    Local $FormGui = GUICreate("PMP - Konfiguracja - License to " & $licensekey, 538, 438, 232, 132)
    GUISetBkColor(0xFFFFFF)

    GUICtrlCreateGroup("Nazwy przycisków", 0, 0, 249, 217)
    Local $aNazwa[6]
    For $i = 0 To 5
        GUICtrlCreateLabel("Nazwa " & ($i + 1), 8, ($i * 32) + 24, 68, 24)
        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
        $aNazwa[$i] = GUICtrlCreateInput($passkey[$i], 80, ($i * 32) + 24, 161, 24)
    Next

    GUICtrlCreateGroup("Hasla", 288, 0, 249, 217)
    Local $aHaslo[6]
    For $i = 0 To 5
        GUICtrlCreateLabel("Haslo " & ($i + 1), 296, ($i * 32) + 24, 61, 24)
        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
        $aHaslo[$i] = GUICtrlCreateInput($pass[$i], 360, ($i * 32) + 24, 161, 24)
    Next

    GUICtrlCreateGroup("Ustawienia licencji", 24, 224, 489, 65)
    GUICtrlSetFont(-1, 11, 800, 0, "Poplar Std")
    GUICtrlCreateLabel("Licencja dla:", 32, 256, 77, 25)
    $LicenseInput = GUICtrlCreateInput($licensekey, 112, 248, 385, 29)

    GUICtrlCreateGroup("Haslo do programu", 24, 312, 489, 65)
    GUICtrlCreateLabel("Nowe haslo:", 32, 344, 77, 25)
    $PasswordInput = GUICtrlCreateInput($filepassword, 112, 336, 385, 29)

    GUICtrlCreateGroup("", -99, -99, 1, 1)

    $Clear = GUICtrlCreateButton("Przywróc Domyslne", 8, 400, 129, 33)
    $Save = GUICtrlCreateButton("Zapisz zmiany", 152, 400, 219, 33)
    $info = GUICtrlCreateButton("Informacje", 392, 400, 129, 33)

    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Run(@ScriptFullPath)
                Exit
            Case $Save
                For $i = 0 To 5
                    IniWrite($sIniFile, "guipass", "pass" & ($i - 1), GUICtrlRead($aNazwa[$i]))
                    IniWrite($sIniFile, "password", "pass" & ($i - 1), GUICtrlRead($aHaslo[$i]))
                Next
                IniWrite($sIniFile, "filepassword", "passwordfile", GUICtrlRead($PasswordInput))
                IniWrite($sIniFile, "LicenseSettings", "LicenseTo", GUICtrlRead($LicenseInput))
                FileSetAttrib($sIniFile, "H")
                Run(@ScriptFullPath)
                Exit
            Case $info
                MsgBox(0, "Info", "Autorzy: Bumek662, PatrykN101" & @LF & "Wersja: 1.4 " & @LF & "Kontakt GG: 3934134 ")
            Case $Clear
                For $i = 0 To 5
                    GUICtrlSetData($aNazwa[$i], "")
                    GUICtrlSetData($aHaslo[$i], "")
                Next
                GUICtrlSetData($PasswordInput, "123")
                GUICtrlSetData($LicenseInput, "")
        EndSwitch
    WEnd
EndFunc   ;==>acp

Finally, learn to structure your code logically. You had controls intermingled throughout the code - keep them in logical groups and debugging becomes much easier. ;)

Zadowolony? :)

M23

[autoit]

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Does not work ;/

Fail? :

#NoTrayIcon
#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $licensekey = "LicenceKey", $filepassword = "FilePassWord"
Global $passkey[6] = ["Key_0", "Key_1", "Key_2", "Key_3", "Key_4", "Key_5"]
Global $pass[6] = ["Pass_0", "Pass_1", "Pass_2", "Pass_3", "Pass_4", "Pass_5"]
$filepassword = IniRead("config.passwordmanagerpro","filepassword","passwordfile","123")
$x = InputBox("Hasło do programu", "Podaj hasło do tego programu. " & @LF & 'Domyślne to "123"', "","*",240,190)
If $x = $filepassword Then
FileSetAttrib("config.passwordmanagerpro","H")

Global $pass[12], $passkey[12]
For $i = 0 to 11 step +1
$pass[$i] = IniRead("config.passwordmanagerpro","password","pass"&($i+1),"")
Next

For $i = 0 to 11 step +1
$passkey[$i] = IniRead("config.passwordmanagerpro","guipass","pass"&($i+1),"")
Next
$licensekey = IniRead("config.passwordmanagerpro","LicenseSettings","LicenseTo","xxx")

$PassGui = GUICreate("Password Manager Premium 1.4 - " & $licensekey, 654, 359, 200, 125)
GUISetBkColor(0xFFFFFF)
$a = GUICtrlCreateButton($passkey[0], 8, 8, 161, 57)
$b = GUICtrlCreateButton($passkey[1], 8, 72, 161, 57)
$c = GUICtrlCreateButton($passkey[2], 8, 136, 161, 57)
$d = GUICtrlCreateButton($passkey[3], 8, 200, 161, 57)
$e = GUICtrlCreateButton($passkey[4], 176, 8, 161, 57)
$f = GUICtrlCreateButton($passkey[5], 176, 72, 161, 57)
$g = GUICtrlCreateButton($passkey[6], 176, 136, 161, 57)
$h = GUICtrlCreateButton($passkey[7], 176, 200, 161, 57)
$i = GUICtrlCreateButton($passkey[8], 344, 8, 161, 57)
$j = GUICtrlCreateButton($passkey[9], 344, 72, 161, 57)
$k = GUICtrlCreateButton($passkey[10], 344, 136, 161, 57)
$l = GUICtrlCreateButton($passkey[11], 344, 200, 161, 57)
$Panel = GUICtrlCreateButton("Panel Zarządzania", 520, 8, 129, 209)
$License = GUICtrlCreateLabel("Licencja dla: " & $licensekey, 13, 311, 499, 50)
$Lock = GUICtrlCreateButton("Zablokuj", 8, 272, 497, 33)
$Unlock = GUICtrlCreateButton("Odblokuj", 8, 272, 497, 33)
$Autor = GUICtrlCreateLabel("Password Manger Premium by Bumek662 i PatrykN101", 13, 336, 443, 17)
GUICtrlSetState($Unlock,$GUI_HIDE)
GUICtrlSetState($Unlock,$GUI_DISABLE)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Panel
acp()
exit
Case $a
_Function(0)
Case $b
_Function(1)
Case $c
_Function(2)
Case $d
_Function(3)
Case $e
_Function(4)
Case $f
_Function(5)
case $Lock
lock()
case $Unlock
unlock()

EndSwitch
WEnd
ElseIf @error = 1 Then
Exit
run(@ScriptFullPath)
Else
MsgBox(0, "Błąd!", 'Ups. Złe hasło.' & @LF & 'Domyślne hasło to "123"', 2)
EndIf
Func acp()

Local $sIniFile = "config.passwordmanagerpro"

Local $FormGui = GUICreate("PMP - Konfiguracja - License to " & $licensekey, 538, 438, 232, 132)
GUISetBkColor(0xFFFFFF)

GUICtrlCreateGroup("Nazwy przycisków", 0, 0, 249, 217)
Local $aNazwa[6]
For $i = 0 To 5
GUICtrlCreateLabel("Nazwa " & ($i + 1), 8, ($i * 32) + 24, 68, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$aNazwa[$i] = GUICtrlCreateInput($passkey[$i], 80, ($i * 32) + 24, 161, 24)
Next

GUICtrlCreateGroup("Hasla", 288, 0, 249, 217)
Local $aHaslo[6]
For $i = 0 To 5
GUICtrlCreateLabel("Haslo " & ($i + 1), 296, ($i * 32) + 24, 61, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$aHaslo[$i] = GUICtrlCreateInput($pass[$i], 360, ($i * 32) + 24, 161, 24)
Next

GUICtrlCreateGroup("Ustawienia licencji", 24, 224, 489, 65)
GUICtrlSetFont(-1, 11, 800, 0, "Poplar Std")
GUICtrlCreateLabel("Licencja dla:", 32, 256, 77, 25)
$LicenseInput = GUICtrlCreateInput($licensekey, 112, 248, 385, 29)

GUICtrlCreateGroup("Haslo do programu", 24, 312, 489, 65)
GUICtrlCreateLabel("Nowe haslo:", 32, 344, 77, 25)
$PasswordInput = GUICtrlCreateInput($filepassword, 112, 336, 385, 29)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Clear = GUICtrlCreateButton("Przywróc Domyslne", 8, 400, 129, 33)
$Save = GUICtrlCreateButton("Zapisz zmiany", 152, 400, 219, 33)
$info = GUICtrlCreateButton("Informacje", 392, 400, 129, 33)

GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Run(@ScriptFullPath)
Exit
Case $Save
For $i = 0 To 5
IniWrite($sIniFile, "guipass", "pass" & ($i - 1), GUICtrlRead($aNazwa[$i]))
IniWrite($sIniFile, "password", "pass" & ($i - 1), GUICtrlRead($aHaslo[$i]))
Next
IniWrite($sIniFile, "filepassword", "passwordfile", GUICtrlRead($PasswordInput))
IniWrite($sIniFile, "LicenseSettings", "LicenseTo", GUICtrlRead($LicenseInput))
FileSetAttrib($sIniFile, "H")
Run(@ScriptFullPath)
Exit
Case $info
MsgBox(0, "Info", "Autorzy: Bumek662, PatrykN101" & @LF & "Wersja: 1.4 " & @LF & "Kontakt GG: 3934134 ")
Case $Clear
For $i = 0 To 5
GUICtrlSetData($aNazwa[$i], "")
GUICtrlSetData($aHaslo[$i], "")
Next
GUICtrlSetData($PasswordInput, "123")
GUICtrlSetData($LicenseInput, "")
EndSwitch
WEnd
EndFunc ;==>acp

Func _Function($iIndex)
Local $Form1 = GUICreate("Haslo do: " & $passkey[$iIndex], 338, 152, 192, 132)
$Input1 = GUICtrlCreateInput($pass[0], 0, 48, 337, 36)
$IsPw = GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Change = GUICtrlCreateButton("Zmien haslo", 56, 96, 201, 41)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form1)
Return
Case $Change
$newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostana zapisane po restarcie programu.", "", "*", 250, 200)
IniWrite("config.passwordmanagerpro", "password", "pass" & ($iIndex + 1), $newpw)
GUICtrlSetData($Input1, $newpw)
EndSwitch
WEnd
EndFunc ;== Funkcja pokazujaca haslo oraz mozliwosc zmiany go.

func lock()
GuiCtrlSetState($a,$GUI_DISABLE)
GuiCtrlSetState($b,$GUI_DISABLE)
GuiCtrlSetState($c,$GUI_DISABLE)
GuiCtrlSetState($d,$GUI_DISABLE)
GuiCtrlSetState($e,$GUI_DISABLE)
GuiCtrlSetState($f,$GUI_DISABLE)
GuiCtrlSetState($Panel,$GUI_DISABLE)
GuiCtrlSetState($LOCK,$GUI_HIDE)
GUICtrlSetState($Unlock,$GUI_SHOW)
GuiCtrlSetState($Unlock,$GUI_ENABLE)

EndFunc
Func unlock()
$x = InputBox("Zablokowano", "Podaj hasło do odblokowania " & @LF & 'Domyślne hasło to "123"', "","*",240,190)
If $x = $filepassword Then
GuiCtrlSetState($a,$GUI_ENABLE)
GuiCtrlSetState($b,$GUI_ENABLE)
GuiCtrlSetState($c,$GUI_ENABLE)
GuiCtrlSetState($d,$GUI_ENABLE)
GuiCtrlSetState($e,$GUI_ENABLE)
GuiCtrlSetState($f,$GUI_ENABLE)
GuiCtrlSetState($Panel,$GUI_ENABLE)
GuiCtrlSetState($LOCK,$GUI_SHOW)
GUICtrlSetState($Unlock,$GUI_HIDE)
GuiCtrlSetState($Unlock,$GUI_DISABLE)
ElseIf @error = 1 Then
MsgBox(0, "Błąd!", 'Ups. Złe hasło.' & @LF & 'Domyślne hasło to "123"', 3)
unlock()
Else
MsgBox(0, "Błąd!", 'Ups. Złe hasło.' & @LF & 'Domyślne hasło to "123"', 3)
unlock()
EndIf
EndFunc
Link to comment
Share on other sites

  • Moderators

Bumek662,

Does not work

What does not work? :huh:

Give us a chance to help you - describe what should be happening and what is not. ;)

M23

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Zadowolony?

M23 knows your language.. ;)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

  • Moderators

Bumek662,

I have gone as far as I can - I do not understand the logic behind some of your code and so I cannot tell if it is working correctly. :wacko:

Try running this script and if it does not do what you want than tell me exactly what does not work: ;)

#include <GUIConstantsEx.au3>

Global $licensekey = "LicenceKey"
Global $passkey[12], $pass[12], $aButton[12]
Global $sIniFile = "config.passwordmanagerpro.ini"

$filepassword = IniRead($sIniFile, "filepassword", "passwordfile", "123")

While 1

    $x = InputBox("Haslo do programu", "Podaj haslo do tego programu. " & @LF & 'Domyslne to "123"', "", "*", 240, 190)

    If $x = $filepassword Then

        FileSetAttrib($sIniFile, "H")

        For $i = 0 To 11
            ; We are simulating values from the ini file
            $pass[$i] = IniRead($sIniFile, "password", "pass" & ($i + 1), "Pass_" & $i)
            $passkey[$i] = IniRead($sIniFile, "guipass", "pass" & ($i + 1), "Key_" & $i)
        Next
        $licensekey = IniRead($sIniFile, "LicenseSettings", "LicenseTo", "xxx")

        $PassGui = GUICreate("Password Manager Premium 1.4 - " & $licensekey, 654, 359, 200, 125)
        GUISetBkColor(0xFFFFFF)
        For $i = 0 To 2
            For $j = 0 To 3
                $iIndex = ($i * 4) + $j
                $aButton[$iIndex] = GUICtrlCreateButton($passkey[$iIndex], ($i * 168) + 8, ($j * 64) + 8, 161, 57)
            Next
        Next

        $Panel = GUICtrlCreateButton("Panel Zarzadzania", 520, 8, 129, 209)
        GUICtrlCreateLabel("Licencja dla: " & $licensekey, 13, 311, 499, 50)
        $Lock = GUICtrlCreateButton("Zablokuj", 8, 272, 497, 33)
        GUICtrlCreateLabel("Password Manger Premium by Bumek662 i PatrykN101", 13, 336, 443, 17)

        GUISetState(@SW_SHOW)

        While 1
            $nMsg = GUIGetMsg()
            Switch $nMsg
                Case $GUI_EVENT_CLOSE
                    Exit
                Case $Panel
                    acp()
                    Exit
                Case $aButton[0] To $aButton[11]
                    $iIndex = $nMsg - $aButton[0]
                    _Function($iIndex)
                Case $Lock
                    Switch GUICtrlRead($Lock)
                        Case "Zablokuj"
                            GUICtrlSetData($Lock, "Odblokuj")
                            lock()
                        Case "Odblokuj"
                            GUICtrlSetData($Lock, "Zablokuj")
                            unlock()
                    EndSwitch
            EndSwitch
        WEnd
    ElseIf @error = 1 Then
        Exit
    Else
        MsgBox(0, "Blad!", 'Ups. Zle haslo.' & @LF & 'Domyslne haslo to "123"', 2)
    EndIf

WEnd

Func acp()

    Local $FormGui = GUICreate("PMP - Konfiguracja - License to " & $licensekey, 538, 438, 232, 132)
    GUISetBkColor(0xFFFFFF)

    GUICtrlCreateGroup("Nazwy przycisków", 0, 0, 249, 217)
    Local $aNazwa[6]
    For $i = 0 To 5
        GUICtrlCreateLabel("Nazwa " & ($i + 1), 8, ($i * 32) + 24, 68, 24)
        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
        $aNazwa[$i] = GUICtrlCreateInput($passkey[$i], 80, ($i * 32) + 24, 161, 24)
    Next

    GUICtrlCreateGroup("Hasla", 288, 0, 249, 217)
    Local $aHaslo[6]
    For $i = 0 To 5
        GUICtrlCreateLabel("Haslo " & ($i + 1), 296, ($i * 32) + 24, 61, 24)
        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
        $aHaslo[$i] = GUICtrlCreateInput($pass[$i], 360, ($i * 32) + 24, 161, 24)
    Next

    GUICtrlCreateGroup("Ustawienia licencji", 24, 224, 489, 65)
    GUICtrlSetFont(-1, 11, 800, 0, "Poplar Std")
    GUICtrlCreateLabel("Licencja dla:", 32, 256, 77, 25)
    $LicenseInput = GUICtrlCreateInput($licensekey, 112, 248, 385, 29)

    GUICtrlCreateGroup("Haslo do programu", 24, 312, 489, 65)
    GUICtrlCreateLabel("Nowe haslo:", 32, 344, 77, 25)
    $PasswordInput = GUICtrlCreateInput($filepassword, 112, 336, 385, 29)

    GUICtrlCreateGroup("", -99, -99, 1, 1)

    $Clear = GUICtrlCreateButton("Przywróc Domyslne", 8, 400, 129, 33)
    $Save = GUICtrlCreateButton("Zapisz zmiany", 152, 400, 219, 33)
    $info = GUICtrlCreateButton("Informacje", 392, 400, 129, 33)

    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Run(@ScriptFullPath)
                Exit
            Case $Save
                For $i = 0 To 5
                    IniWrite($sIniFile, "guipass", "pass" & ($i - 1), GUICtrlRead($aNazwa[$i]))
                    IniWrite($sIniFile, "password", "pass" & ($i - 1), GUICtrlRead($aHaslo[$i]))
                Next
                IniWrite($sIniFile, "filepassword", "passwordfile", GUICtrlRead($PasswordInput))
                IniWrite($sIniFile, "LicenseSettings", "LicenseTo", GUICtrlRead($LicenseInput))
                FileSetAttrib($sIniFile, "H")
                Run(@ScriptFullPath)
                Exit
            Case $info
                MsgBox(0, "Info", "Autorzy: Bumek662, PatrykN101" & @LF & "Wersja: 1.4 " & @LF & "Kontakt GG: 3934134 ")
            Case $Clear
                For $i = 0 To 5
                    GUICtrlSetData($aNazwa[$i], "")
                    GUICtrlSetData($aHaslo[$i], "")
                Next
                GUICtrlSetData($PasswordInput, "123")
                GUICtrlSetData($LicenseInput, "")
        EndSwitch
    WEnd
EndFunc   ;==>acp

Func _Function($iIndex)

    Local $Form1 = GUICreate("Haslo do: " & $passkey[$iIndex], 338, 152, 192, 132)
    $Input1 = GUICtrlCreateEdit($pass[$iIndex], 0, 48, 337, 36)
    GUICtrlCreateLabel("Twoje haslo to:", 64, 8, 183, 33)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Change = GUICtrlCreateButton("Zmien haslo", 56, 96, 201, 41)
    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                Return
            Case $Change
                $newpw = InputBox("Haslo", "Podaj tutaj swoje nowe haslo." & @LF & "Wszystkie zmiany zostana zapisane po restarcie programu.", "", "*", 250, 200)
                IniWrite($sIniFile, "password", "pass" & ($iIndex + 1), $newpw)
                GUICtrlSetData($Input1, $newpw)
        EndSwitch
    WEnd
EndFunc   ;==>_Function

Func lock()
    For $i = 0 To 11
        GUICtrlSetState($aButton[$i], $GUI_DISABLE)
    Next
    GUICtrlSetState($Panel, $GUI_DISABLE)
EndFunc   ;==>lock

Func unlock()
    While 1
        $x = InputBox("Zablokowano", "Podaj haslo do odblokowania " & @LF & 'Domyslne haslo to "123"', "", "*", 240, 190)
        If $x = $filepassword Then
            For $i = 0 To 11
                GUICtrlSetState($aButton[$i], $GUI_DISABLE)
            Next
            GUICtrlSetState($Panel, $GUI_DISABLE)
            ExitLoop
        ElseIf @error = 1 Then
            ExitLoop
        Else
            MsgBox(0, "Blad!", 'Ups. Zle haslo.' & @LF & 'Domyslne haslo to "123"', 3)
        EndIf
    WEnd
EndFunc   ;==>unlock

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Bumek662,

For heaven's sake - just tell us WHAT does not work! :mad:

Write it in Polish and use Google Translate to change it into English. Then we stand some chance of helping you - otherwise we are only really whistling in the dark. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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