Jump to content

Recommended Posts

Posted

A program registration number recorded programs.

Know that writing correctly or not?.

If you find a bug make?

To resolve with :)

#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>

Global Const $sdbPath = @HomeDrive&'\SerialsDataBase.txt' ;target data file.

$GUI = GUICreate("Serials Programs Record", 297, 210, 365, 300)
          GUISetBkColor(0xC0DCC0)
$Lbl1 = GUICtrlCreateLabel("Program Version name", 95, 16, 136, 17)
$Lbl2 = GUICtrlCreateLabel("Serial Number", 120, 80, 100, 17)
$Inp1 = GUICtrlCreateInput("", 24, 40, 249, 21, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN), _
          BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Inp2 = GUICtrlCreateInput("", 24, 104, 249, 21, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN), _
          BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Inp3 = GUICtrlCreateInput("", 185, 140, 90, 21, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN), _
          BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Btn1 = GUICtrlCreateButton("Save", 15, 170, 75, 25, $WS_GROUP)
            GUICtrlSetState(-1, $GUI_ENABLE)
$Btn2 = GUICtrlCreateButton("Keygen", 97, 170, 75, 25, $WS_GROUP)
            GUICtrlSetState(-1, $GUI_DISABLE)
$Btn3 = GUICtrlCreateButton("DataBase", 180, 170, 100, 25, $WS_GROUP)
$Rad1 = GUICtrlCreateRadio("Select Button", 45, 143, 85, 17)
          GUICtrlSetState(-1, $GUI_CHECKED)
$Rad2 = GUICtrlCreateRadio("", 130, 143, 20, 17)
           GUICtrlCreateLabel("Pass:", 155, 143, 30, 17)
          GUISetState(@SW_SHOW)

If Not FileExists($sdbPath) Then ;create text database and hidden file.
    _FileCreate($sdbPath)
    If Not @error Then FileSetAttrib($sdbPath, '+H')
EndIf

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Btn3
            Local $word = 'xxxxx'
            Local $pass = GUICtrlRead($Inp3)
            If $pass = '' Then
                MsgBox(0, "", "Please enter the code in the box.")  ;password database security
            ElseIf $pass <> $word Then
                MsgBox(48, "", "The password is incorrect .. try again.")
                GUICtrlSetData($Inp3, '')
            Else
                ShellExecute($sdbPath)
                While 1
                    If WinWaitClose("SerialsDataBase.txt") Then
                        GUICtrlSetData($Inp3, '')
                        ExitLoop
                    EndIf
                WEnd
            EndIf
        Case $Rad1
            GUICtrlSetStyle($Inp2, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
            GUICtrlSetState($Btn2, $GUI_DISABLE)
            GUICtrlSetState($Btn1, $GUI_ENABLE)
            GUICtrlSetData($Inp1, '')
            GUICtrlSetData($Inp2, '')  ;button switched
        Case $Rad2
            GUICtrlSetStyle($Inp2,BitOR($ES_AUTOHSCROLL,$ES_READONLY))
            GUICtrlSetState($Btn1, $GUI_DISABLE)
            GUICtrlSetState($Btn2, $GUI_ENABLE)
            GUICtrlSetData($Inp1, '')
            GUICtrlSetData($Inp2, '')
        Case $Btn1 ;save button
            If GUICtrlRead($Inp1) = '' Then
                MsgBox(0, "", "Please indicate program name and version in the box.")
                ContinueLoop
            ElseIf GUICtrlRead($Inp2) = '' Then
                MsgBox(0, "", "Please register for the program number in the box.")
                ContinueLoop
            Else
                $readInp = GUICtrlRead($Inp1)
                $readdb = FileOpen($sdbPath, 0)
                $retlinedb1 = FileReadLine($readdb, 1)
                If $retlinedb1 = $readInp Then
                    _messagedatachecked()
                    ContinueLoop
                Else
                    $retlinedb3 = FileReadLine($readdb, 3)
                If $retlinedb3 = $readInp Then
                    _messagedatachecked()
                    ContinueLoop
                Else
                    $retlinedb5 = FileReadLine($readdb, 5)  ;same as file checked.
                If $retlinedb5 = $readInp Then
                    _messagedatachecked()
                    ContinueLoop
                Else
                    $retlinedb7 = FileReadLine($readdb, 7)
                If $retlinedb7 = $readInp Then
                    _messagedatachecked()
                    ContinueLoop
                Else
                    $retlinedb9 = FileReadLine($readdb, 9)
                If $retlinedb9 = $readInp Then
                    _messagedatachecked()
                    ContinueLoop
                EndIf
                EndIf
                EndIf
                EndIf
                EndIf
            EndIf
            $program = GUICtrlRead($Inp1)
            $serial = GUICtrlRead($Inp2)
            $readdb = FileOpen($sdbPath, 1)
            $retpro = FileWrite($readdb, $program&@CRLF)
            $retser = FileWrite($readdb, $serial&@CRLF)
            If $retpro = 1 And $retser = 1 Then
            MsgBox(64, "", "Recorded successfully.")
                GUICtrlSetData($Inp1, '')
                GUICtrlSetData($Inp2, '')
            FileClose($readdb)
            Else
                MsgBox(48, "Error!", "Cannot save record.. try again.")
            EndIf
        Case $Btn2 ;keygen button
            If GUICtrlRead($Inp1) = '' Then
                MsgBox(0, "", "Please indicate program name and version in the box only.")
            Else
                $program = GUICtrlRead($Inp1)
                $readdb = FileOpen($sdbPath, 0)
                $readlinedb1 = FileReadLine($readdb, 1)
                If $readlinedb1 = $program Then
                    $readlinedb2 = FileReadLine($readdb, 2)
                    If GUICtrlSetData($Inp2, $readlinedb2) Then
                        FileClose($readdb)
                        ContinueLoop
                    EndIf
                Else
                    $readlinedb3 = FileReadLine($readdb, 3)
                If $readlinedb3 = $program Then
                    $readlinedb4 = FileReadLine($readdb, 4)
                    If GUICtrlSetData($Inp2, $readlinedb4) Then
                        FileClose($readdb)
                        ContinueLoop
                    EndIf
                Else
                    $readlinedb5 = FileReadLine($readdb, 5)
                If $readlinedb5 = $program Then
                    $readlinedb6 = FileReadLine($readdb, 6)
                    If GUICtrlSetData($Inp2, $readlinedb6) Then
                        FileClose($readdb)
                        ContinueLoop
                    EndIf
                Else
                    $readlinedb7 = FileReadLine($readdb, 7)
                If $readlinedb7 = $program Then
                    $readlinedb8 = FileReadLine($readdb, 8)
                    If GUICtrlSetData($Inp2, $readlinedb8) Then
                        FileClose($readdb)
                        ContinueLoop
                    EndIf
                Else
                    $readlinedb9 = FileReadLine($readdb, 9)
                If $readlinedb9 = $program Then
                    $readlinedb10 = FileReadLine($readdb, 10)
                    If GUICtrlSetData($Inp2, $readlinedb10) Then
                        FileClose($readdb)
                        ContinueLoop
                    EndIf
                EndIf
                EndIf
                EndIf
                EndIf
                EndIf
                _nodatatmessage()
            EndIf
    EndSwitch
WEnd

Func _messagedatachecked()
    MsgBox(0, "", "Has the same name, please change the new.")
    GUICtrlSetData($Inp1, '')
    GUICtrlSetData($Inp2, '')
EndFunc

 _nodatatmessage()
Func _nodatatmessage()
    MsgBox(0, "", "No name in database.")
    GUICtrlSetData($Inp1, '')
    GUICtrlSetData($Inp2, '')
EndFunc
Posted

wakillon

This program can be recorded only 5 applications only

If you need to save more than this. You need to be developed. :)

Posted

wakillon

This program can be recorded only 5 applications only

If you need to save more than this. You need to be developed. :)

No problem, i am already very developed ! Posted Image

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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...