bahjat

Source code working before but no longer in operation

5 posts in this topic

I wrote a piece of source code over a year ago in AutoIT and it worked perfectly. No bugs at all! 
I then got a new laptop and yesterday i wanted to run my source code again. I ran into way too many errors, the problem is that I don't remember the language as well as i used to (I haven't used it at all). Can someone please look at my source code and point out the bugs? I think i've just forgotten to declare a function in the correct place. I'm not sure if the programming language has changed since i programmed it last time?  Any help will be appreciated. 
P.S. I will also be self teaching the language over this weekend but having a peer look at it will help too. 

#include-Once
#include <MsgBoxConstants.au3>
#include <Crypt.au3>
;~ $timer = TimerInit()
;~ $timer = TimerInit()
    ;~      MsgBox(0,   "AES    Encrypted   data",
    Global $timer
_EncryptionProcess("6bc1bee22e409f96e93d7e117393172a","603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", 256, 1) & " Time:" & TimerDiff($timer))



;****Input your message here and the key size ****


Textinput()

Func Textinput()
    ; Places the input box in the top left corner displaying the characters as they
    ; are typed.
        Global $data = InputBox("Enter your message", "Please enter your message in ASCII", "5", ""); takes in the input from the user
        MsgBox (0, "your input is", $data)
        Global $keyvalue = InputBox("Enter your key", "Enter the cipher key please", "203040", ""); takes in the input from the user
        MsgBox (0, "Your Key is", $keyvalue)
        Global $keysize = InputBox("enter the key size", "Key sizes can be 128,192 and 256","128", ""); takes in the input from the user
        MsgBox (0, "your input is", $keysize)
EndFunc


;*****ASCII to Hexadecimal conversion*****

Global $V2 = $data

$ASCIItoHEX = AscToHex($V2)
MsgBox(0,"Ascii to Hex converstion" ,$ASCIItoHEX)
Func AscToHex($varaible2)

    Global $Turn=""
    For $variable1 = 1 To StringLen($varaible2)
        If StringLen(Hex(Asc(StringMid($varaible2, $variable1,1)),2)) = 1
        Then             $Turn &=  "5" & Hex(Asc(StringMid($varaible2, $variable1, 1)))
        Else
            $Turn &=  Hex(Asc(StringMid($varaible2, $variable1, 1)),2)         EndIf
        If $variable1 <> StringLen($varaible2) Then $Turn &=  " "
    Next
    Return $Turn endFunc
;****The output value of this function is stored in the $ASCIItoHex variable*****




;*****Program that gets rid of the spaces between the numbers****


Local $NoSpace = StringReplace($ASCIItoHEX, " ", "")

MsgBox(0, "No space", $NoSpace)

;***** the variable that stores this new output is $NoSpace*****




; the input data is stored in $V2
; the output data is stored in  $turn

;~ $turn

$VariableToBeCut = $NoSpace
$ArrayForMessage = StringRegExp($VariableToBeCut, ".{1,32}", 3)

;;****Output variable is $Arrayformessage***
;~   For $ProcessingMessage = 0 To 85
    ;~      $Cut = $ArrayForMessage[$ProcessingMessage]

    ;~      MsgBox (0, "counting", $Cut)
;~   Next

Global $final

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[0], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
;;;****Program adds spaces *****
;;;***** the input variable here is $New*****
Func _hello()
$2space = $DataToBeDecrypted
$New = $2space

$AddingSpace = StringSplit($New, "")

$Final = ""

If Conversion($AddingSpace[0]) Then

    For $Spacing = 1 to $AddingSpace[0] Step 2
        $Final = $Final & $AddingSpace[$Spacing] & $AddingSpace[$Spacing+1] & " "     Next

    MsgBox(0, "Adding space to the message so it can be converted back to Hex", $Final)

Else
    MsgBox(0, "Result", "String does not contain an even number of characters.")
EndIf
EndFunc

Func Conversion($Hexadec)
    Return Mod($Hexadec, 2) = 0
EndFunc
;;;***The final value is stored in the $final variable****


;***** Hexadecimals to ASCII*****
;;***Input variable is $HexadecimaltoASCII2******

Func _Bye()
$HexadecimalToASCII2 =$final
$HexadecimalsToASCII = ChrH($HexadecimalToASCII2)
$Ascii2Hex = Sub($HexadecimalsToASCII)
$v5ar = Chr($HexadecimalsToASCII);char

MsgBox(0,"Hex to ASCII",$HexadecimalsToASCII)
EndFunc

Func ChrH($v8)

    Local $v5=""
    $A1 = StringSplit($v8, " ")
    For $count = 1 To $A1[0]
        $v5 &= Chr(Dec($A1[$count]))
    Next     Return $v5 endFunc


Func Sub($v8)

    Local $v9=""
    For $count = 1 To StringLen($v8)
        If StringLen(Hex(Asc(StringMid($v8, $count, 1)),2)) = 1 Then
            $v9 &=  "0" & Hex(Asc(StringMid($v8, $count, 1)))
        Else
            $v9 &=  Hex(Asc(StringMid($v8, $count, 1)),2)
        EndIf
        If $count <> StringLen($v8) Then $v9 &=  " "
    Next     Return $v9 endFunc

;*****HEXADECIMAL to ASCII*****








Func _EncryptionProcess($InputText, $GVKey, $Key = $keysize, $EncryptionNumber = 1)
        Local $LVOutput[16]
        Local $LVInput[16]
        Local $InputHex[32]
        Local $SubRoundKeyStep[240]
        Local $LV2 = 1
        Local $CheckValue
        Local $NumberOfRounds
        Local $LGVKey

        $LGVKey = $Key / 32 ;32 hexadecimals from 128 bits input
        $NumberOfRounds = $LGVKey + 6
;converts the hexadecimal to Decimal
        For $Var1 = 0 To $LGVKey * 4 - 1
                $InputHex[$Var1] = Dec(StringMid($GVKey, $LV2, 2))
                $LV2 = $LV2+ 2
        Next

        $LV2 = 1
        For $Var1 = 0 To 15
                $LVInput[$Var1] = Dec(StringMid($InputText, $LV2, 2))
                $LV2 = $LV2 + 2
        Next

        $SubRoundKeyStep = __TheyKeyExpansionStep($InputHex, $NumberOfRounds, $LGVKey)

        If $EncryptionNumber = 1 Then ;Encrypt
                $LVOutput = __Algorithm($LVInput, $SubRoundKeyStep, $NumberOfRounds) ; in this part you are going through the Algorithm function
                    ;line 259 or approximate
        ElseIf $EncryptionNumber = 0 Then ; decrypt
                $LVOutput = __DecryptionProcess($LVInput, $SubRoundKeyStep, $NumberOfRounds)
        EndIf

        For $Var1 = 0 To 15
                $CheckValue &= $LVOutput[$Var1]
        Next

        Return $CheckValue

EndFunc


Func __ValueOfTheSubstitutionBox($SubstitutionBoxNumber)
        Local $SubsitutionBoxOutput[256] = [0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F,
0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA,
0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93,
0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, 0x04,
0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2,
0x75, 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4,
0x79, 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16]
        Return $SubsitutionBoxOutput[Dec(Hex($SubstitutionBoxNumber, 2))]; making sure it is in hex a decimal allowing the language to read it
            ;it takes the input then creating a local Var and using the array of the s-box

EndFunc   ;==>__ValueOfTheSubstitutionBox


Func __TheyKeyExpansionStep($InputHex, $NumberOfRounds, $LGVKey) ;theese Vars define are defining the major parts of the things. How many rounds and how big the key needs to be
        Local $Var1
        Local $LV6
        Local $SubRoundKeyStep[240]
        Local $LV3[4]
        Local $TheRconFunction[255] = [0x8D, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4, 0xB3, 0x7D, 0xFA, 0xEF, 0xC5, 0x91, 0x39, 0x72, 0xE4, 0xD3, 0xBD, 0x61, 0xC2, 0x9F, 0x25, 0x4A, 0x94, 0x33, 0x66, 0xCC, 0x83, 0x1D, 0x3A, 0x74, 0xE8, 0xCB, 0x8D, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4, 0xB3, 0x7D,
0xFA, 0xEF, 0xC5, 0x91, 0x39, 0x72, 0xE4, 0xD3, 0xBD, 0x61, 0xC2, 0x9F, 0x25, 0x4A, 0x94, 0x33, 0x66, 0xCC, 0x83, 0x1D, 0x3A, 0x74, 0xE8, 0xCB, 0x8D, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E,
0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4, 0xB3, 0x7D, 0xFA, 0xEF, 0xC5, 0x91, 0x39, 0x72, 0xE4, 0xD3, 0xBD, 0x61, 0xC2, 0x9F, 0x25, 0x4A, 0x94, 0x33, 0x66, 0xCC, 0x83, 0x1D, 0x3A, 0x74, 0xE8, 0xCB, 0x8D, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4, 0xB3, 0x7D, 0xFA, 0xEF, 0xC5, 0x91, 0x39, 0x72, 0xE4, 0xD3, 0xBD, 0x61, 0xC2, 0x9F, 0x25, 0x4A, 0x94, 0x33, 0x66, 0xCC, 0x83, 0x1D, 0x3A, 0x74, 0xE8, 0xCB, 0x8D, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4, 0xB3, 0x7D, 0xFA, 0xEF, 0xC5, 0x91, 0x39, 0x72, 0xE4, 0xD3, 0xBD, 0x61, 0xC2, 0x9F, 0x25, 0x4A, 0x94, 0x33, 0x66, 0xCC, 0x83, 0x1D, 0x3A, 0x74, 0xE8, 0xCB]

        For $Var1 = 0 To $LGVKey - 1
                $SubRoundKeyStep[$Var1 * 4] = $InputHex[$Var1 * 4]
                $SubRoundKeyStep[$Var1 * 4 + 1] = $InputHex[$Var1 * 4 + 1]
                $SubRoundKeyStep[$Var1 * 4 + 2] = $InputHex[$Var1 * 4 + 2]                 $SubRoundKeyStep[$Var1 * 4 + 3] = $InputHex[$Var1 * 4 + 3]
        Next
        While $Var1 < (4 * ($NumberOfRounds + 1))
                For $LV2 = 0 To 3
                        $LV3[$LV2] = $SubRoundKeyStep[($Var1 - 1) * 4 + $LV2]
                Next
                If Mod($Var1, $LGVKey) = 0 Then
                        $LV6 = $LV3[0]
                        $LV3[0] = $LV3[1]
                        $LV3[1] = $LV3[2]
                        $LV3[2] = $LV3[3]
                        $LV3[3] = $LV6
                        $LV3[0] = __ValueOfTheSubstitutionBox($LV3[0])
                        $LV3[1] = __ValueOfTheSubstitutionBox($LV3[1])
                        $LV3[2] = __ValueOfTheSubstitutionBox($LV3[2])
                        $LV3[3] = __ValueOfTheSubstitutionBox($LV3[3])
                        $LV3[0] = BitXOR($LV3[0], $TheRconFunction[$Var1 / $LGVKey])
                ElseIf $LGVKey > 6 And Mod($Var1, $LGVKey) = 4 Then
                        $LV3[0] = __ValueOfTheSubstitutionBox($LV3[0])
                        $LV3[1] = __ValueOfTheSubstitutionBox($LV3[1])
                        $LV3[2] = __ValueOfTheSubstitutionBox($LV3[2])                         $LV3[3] = __ValueOfTheSubstitutionBox($LV3[3])
                EndIf

                $SubRoundKeyStep[$Var1 * 4 + 0] = BitXOR($SubRoundKeyStep[($Var1 -
$LGVKey) * 4 + 0], $LV3[0])
                $SubRoundKeyStep[$Var1 * 4 + 1] = BitXOR($SubRoundKeyStep[($Var1 -
$LGVKey) * 4 + 1], $LV3[1])
                $SubRoundKeyStep[$Var1 * 4 + 2] = BitXOR($SubRoundKeyStep[($Var1 -
$LGVKey) * 4 + 2], $LV3[2])
                $SubRoundKeyStep[$Var1 * 4 + 3] = BitXOR($SubRoundKeyStep[($Var1 - $LGVKey) * 4 + 3], $LV3[3])
                $Var1 = $Var1 + 1
        WEnd
Return $SubRoundKeyStep
EndFunc   ;==>__TheyKeyExpansionStep
Func __TheAddRoundKeyStep($LV9, $SubRoundKeyStep, $CurrentState) ; The add round key step
        For $Var1 = 0 To 3
                For $LV2 = 0 To 3
                        $CurrentState[$LV2][$Var1]  =   BitXOR($CurrentState[$LV2][$Var1], $SubRoundKeyStep[$LV9 * 4 * 4 + $Var1 * 4 + $LV2])
                Next
        Next
; It takes the currect state value and BitXOR it with the the round key
; the multiplication and addition process figures out what number it is
; the $LV9 Step is needed
        Return $CurrentState
EndFunc   ;==>__TheAddRoundKeyStep
Func __SubBytes($CurrentState)
        For $Var1 = 0 To 3
                For $LV2 = 0 To 3
                            $CurrentState[$Var1][$LV2]  =
__ValueOfTheSubstitutionBox($CurrentState[$Var1][$LV2])
                Next
        Next

        Return $CurrentState
EndFunc   ;==>__SubBytes
Func __InvSubBytes($CurrentState)
        For $Var1 = 0 To 3 ;4loops
                For $LV2 = 0 To 3
                            $CurrentState[$Var1][$LV2]  =
__ValueOfTheInvertSubstitutionBox($CurrentState[$Var1][$LV2]); this is calling another function which is the get S-BOX value function
                            ;the long line is this function
                Next
        Next

        Return $CurrentState
EndFunc   ;



Func __TheShiftRowStep($CurrentState)

        Local $LV3


        $LV3 = $CurrentState[1][0]
        $CurrentState[1][0] = $CurrentState[1][1]
        $CurrentState[1][1] = $CurrentState[1][2]
        $CurrentState[1][2] = $CurrentState[1][3]
        $CurrentState[1][3] = $LV3
$LV3 = $CurrentState[2][0]
$CurrentState[2][0] = $CurrentState[2][2]
$CurrentState[2][2] = $LV3
        $LV3 = $CurrentState[2][1]
        $CurrentState[2][1] = $CurrentState[2][3]
        $CurrentState[2][3] = $LV3
        $LV3 = $CurrentState[3][0]
        $CurrentState[3][0] = $CurrentState[3][3]
        $CurrentState[3][3] = $CurrentState[3][2]
        $CurrentState[3][2] = $CurrentState[3][1]
        $CurrentState[3][1] = $LV3

        Return $CurrentState
EndFunc
Func __TheInverseShiftRowSetp($CurrentState)
        Local $LV3

        $LV3 = $CurrentState[1][3]
        $CurrentState[1][3] = $CurrentState[1][2]
        $CurrentState[1][2] = $CurrentState[1][1]
        $CurrentState[1][1] = $CurrentState[1][0]
        $CurrentState[1][0] = $LV3
        $LV3 = $CurrentState[2][0]
        $CurrentState[2][0] = $CurrentState[2][2] $CurrentState[2][2] = $LV3
$LV3 = $CurrentState[2][1]
$CurrentState[2][1] = $CurrentState[2][3]
        $CurrentState[2][3] = $LV3
        $LV3 = $CurrentState[3][0]
        $CurrentState[3][0] = $CurrentState[3][1]
        $CurrentState[3][1] = $CurrentState[3][2]         $CurrentState[3][2] = $CurrentState[3][3]
        $CurrentState[3][3] = $LV3

        Return $CurrentState
EndFunc   ;==>__TheInverseShiftRowSetp
Func __factor($LVMultiplication)
        Return BitXOR(BitShift($LVMultiplication, -1), (BitAND(BitShift($LVMultiplication,
7), 1) * 0x1B)); this function is used in the Mix Column step
            ; the 0x1B is a hexadecimal number
EndFunc   ;==>__factor
Func __Multiplication($LVMultiplication, $LVMultiplication2)
        Return BitXOR((BitAND($LVMultiplication2, 1) * $LVMultiplication), (BitAND(BitShift($LVMultiplication2, 1), 1) * __factor($LVMultiplication)),
(BitAND(BitShift($LVMultiplication2, 2), 1) * __factor(__factor($LVMultiplication))),
    (BitAND(BitShift($LVMultiplication2,    3),     1)  *
__factor(__factor(__factor($LVMultiplication)))), (BitAND(BitShift($LVMultiplication2, 4),
1) * __factor(__factor(__factor(__factor($LVMultiplication))))))
EndFunc   ;==>__Multiplication
Func __TheMixColumnStep($CurrentState); the input that is used
Local $LV5p ; your temporrary Vars
Local $LV5
Local $LVMixColumnT

        For $Var1 = 0 To 3; You have your 4 loops here (4 columns)
                $LVMixColumnT = $CurrentState[0][$Var1]
                    $LV5p   =   BitXOR($CurrentState[0][$Var1],     $CurrentState[1][$Var1],
$CurrentState[2][$Var1], $CurrentState[3][$Var1])
                $LV5 = BitXOR($CurrentState[0][$Var1], $CurrentState[1][$Var1])
                $LV5 = __factor($LV5) ; this is calling the _Factor function
                $CurrentState[0][$Var1]     =   BitXOR($CurrentState[0][$Var1],     BitXOR($LV5, $LV5p))
                $LV5 = BitXOR($CurrentState[1][$Var1], $CurrentState[2][$Var1])
                $LV5 = __factor($LV5)
                $CurrentState[1][$Var1]     =   BitXOR($CurrentState[1][$Var1],     BitXOR($LV5, $LV5p))
                $LV5 = BitXOR($CurrentState[2][$Var1], $CurrentState[3][$Var1])
                $LV5 = __factor($LV5)
                $CurrentState[2][$Var1]     =   BitXOR($CurrentState[2][$Var1],     BitXOR($LV5, $LV5p))
                $LV5 = BitXOR($CurrentState[3][$Var1], $LVMixColumnT)
                $LV5 = __factor($LV5)
                $CurrentState[3][$Var1]     =   BitXOR($CurrentState[3][$Var1],     BitXOR($LV5, $LV5p))
        Next

Return $CurrentState
EndFunc   ;==>__TheMixColumnStep

Func __Algorithm($LVInput, $SubRoundKeyStep, $NumberOfRounds)
        ;$NumberOfRounds states the number of rounds
        ;$SubRoundKeyStep uses the round function
        ;$LVInput is the Var for the input

        Local $LVOutput[16]
        Local $CurrentState[4][4]

        For $Var1 = 0 To 3
                For $LV2 = 0 To 3
                        $CurrentState[$LV2][$Var1] = $LVInput[$Var1 * 4 + $LV2]
      ;This part is the 2 dimensinal array; this part is the one dimensional array
      ; this converts the input from a 1 dimensional array to a 2 dimenasional

                    Next
        Next

        $CurrentState = __TheAddRoundKeyStep(0, $SubRoundKeyStep, $CurrentState)
;the add round key step
        For $LV9 = 1 To $NumberOfRounds - 1
                $CurrentState = __SubBytes($CurrentState); these things are calling upon the functions to undergo their process in order
                $CurrentState = __TheShiftRowStep($CurrentState)
                $CurrentState = __TheMixColumnStep($CurrentState)
                $CurrentState = __TheAddRoundKeyStep($LV9, $SubRoundKeyStep, $CurrentState)
        ; the 9 rounds of the Subbytes, shiftroyws, mix columns and add round key step
            Next

        $CurrentState = __SubBytes($CurrentState)
        $CurrentState = __TheShiftRowStep($CurrentState)
        $CurrentState = __TheAddRoundKeyStep($NumberOfRounds, $SubRoundKeyStep, $CurrentState)
; this is the final round which does not include the mix column step
        For $Var1 = 0 To 3
                For $LV2 = 0 To 3
                        $LVOutput[$Var1 * 4 + $LV2] = Hex($CurrentState[$LV2][$Var1], 2)
                Next
        Next

        Return $LVOutput
EndFunc
Func __DecryptionProcess($LVInput, $SubRoundKeyStep, $NumberOfRounds)

        Local $LVOutput[16]
        Local $CurrentState[4][4]

        For $Var1 = 0 To 3
                For $LV2 = 0 To 3
                        $CurrentState[$LV2][$Var1] = $LVInput[$Var1 * 4 + $LV2]
                Next
        Next

        $CurrentState = __TheAddRoundKeyStep($NumberOfRounds, $SubRoundKeyStep, $CurrentState)

        For $LV9 = $NumberOfRounds - 1 To 1 Step -1
                $CurrentState = __TheInverseShiftRowSetp($CurrentState)
                $CurrentState = __InvSubBytes($CurrentState)
                $CurrentState = __TheAddRoundKeyStep($LV9, $SubRoundKeyStep, $CurrentState)
                $CurrentState = __InvTheMixColumnStep($CurrentState)
        Next

        $CurrentState = __TheInverseShiftRowSetp($CurrentState)
        $CurrentState = __InvSubBytes($CurrentState)
        $CurrentState = __TheAddRoundKeyStep(0, $SubRoundKeyStep, $CurrentState)

        For $Var1 = 0 To 3
                For $LV2 = 0 To 3
                        $LVOutput[$Var1 * 4 + $LV2] = Hex($CurrentState[$LV2][$Var1], 2)
                Next
        Next

        Return $LVOutput
EndFunc
Func __InvTheMixColumnStep($CurrentState)
        Local $Var1
        Local $LVMixColumn1
        Local $LVMixColumn2
        Local $LVMixColumn3         Local $LVMixColumn4

        For $Var1 = 0 To 3
                $LVMixColumn1 = $CurrentState[0][$Var1]
                $LVMixColumn2 = $CurrentState[1][$Var1]
                $LVMixColumn3 = $CurrentState[2][$Var1]                 $LVMixColumn4 = $CurrentState[3][$Var1]

                $CurrentState[0][$Var1] = BitXOR(__Multiplication($LVMixColumn1, 0x0e), __Multiplication($LVMixColumn2,     0x0b),  __Multiplication($LVMixColumn3,     0x0d), __Multiplication($LVMixColumn4, 0x09))
                $CurrentState[1][$Var1] = BitXOR(__Multiplication($LVMixColumn1, 0x09), __Multiplication($LVMixColumn2, 0x0e), __Multiplication($LVMixColumn3, 0x0b),
__Multiplication($LVMixColumn4, 0x0d))
                $CurrentState[2][$Var1] = BitXOR(__Multiplication($LVMixColumn1, 0x0d), __Multiplication($LVMixColumn2,     0x09),  __Multiplication($LVMixColumn3,     0x0e), __Multiplication($LVMixColumn4, 0x0b))
                $CurrentState[3][$Var1] = BitXOR(__Multiplication($LVMixColumn1, 0x0b), __Multiplication($LVMixColumn2,     0x0d),  __Multiplication($LVMixColumn3,     0x09), __Multiplication($LVMixColumn4, 0x0e))
        Next

        Return $CurrentState
EndFunc

Func __ValueOfTheInvertSubstitutionBox($SubstitutionBoxNumber)
        Local $LVSubsitutionBox[256] = [0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38,
0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57,
0xA7, 0x8D, 0x9D, 0x84, 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4,
0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5,
0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0,
0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77,
0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D]
        Return $LVSubsitutionBox[Dec(Hex($SubstitutionBoxNumber, 2))]
EndFunc   ;==>__ValueOfTheInvertSubstitutionBox


$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[1], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)


$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[2], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)


$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[3], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[4], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[5], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)


$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[6], $keyvalue, $keysize, 1) MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[7], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[8], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[9], $keyvalue, $keysize, 1) MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[10], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[11], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)



$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[12], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[13], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)


$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[14], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[15], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[16], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[17], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[18], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[19], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[20], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[21], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[22], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[23], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[24], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[25], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[26], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[27], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)


$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[28], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[29], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[30], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[31], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[32], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[33], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[34], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[35], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)

MsgBox (0, "Entire message", $data)

$DataToBeEncrypted=_EncryptionProcess($ArrayForMessage[36], $keyvalue, $keysize, 1)
MsgBox(0, "Encrypted data", $DataToBeEncrypted)
$DataToBeDecrypted =_EncryptionProcess($DataToBeEncrypted, $keyvalue , $keysize, 0)
MsgBox(0, "Decrypted data", $DataToBeDecrypted)
_hello()
_Bye()
MsgBox (0, "Entire message", $data)

 

Share this post


Link to post
Share on other sites



bahjat,

The only syntax problems I can see in that script are:

  • A few lines where a @CRLF has been removed
  • A few lines where a @CRLF has been inserted
  • Some very long array definitions and longish function parameter lists which need to be reformatted with line continuation characters

I suggest you try and deal with them yourself rather than expect others to do it for you. Just run <Syntax Check> from within SciTE <Tools> menu and fix the errors as they appear - it will not take long.

M23

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
6 minutes ago, Melba23 said:

bahjat,

The only syntax problems I can see in that script are:

  • A few lines where a @CRLF has been removed
  • A few lines where a @CRLF has been inserted
  • Some very long array definitions and longish function parameter lists which need to be reformatted with line continuation characters

I suggest you try and deal with them yourself rather than expect others to do it for you. Just run <Syntax Check> from within SciTE <Tools> menu and fix the errors as they appear - it will not take long.

M23

 

Thanks for your reply, I have pulled up some youtube tutorials currently and am trying to jog my memory. 

Does the @CRLF you are talking about refer to the line breaks? If so i deleted a few because they was giving me some syntax errors. I know in C++ this isn't a problem but i wasn't sure about AutoIT. 

And the syntax for AuotIT is still the same as it was a year ago correct? 

Thanks in advance 

Share this post


Link to post
Share on other sites
11 minutes ago, bahjat said:

And the syntax for AuotIT is still the same as it was a year ago correct? 

I think it is... Yes, I started it a year ago if I remember correctly.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
4 hours ago, bahjat said:

Does the @CRLF you are talking about refer to the line breaks? If so i deleted a few because they was giving me some syntax errors. I know in C++ this isn't a problem but i wasn't sure about AutoIT. 

Yes, @CRLF is a macro that stands for the combination of two ascii characters: carriage return (13) and line feed (10), which is the default line ending under Windows. This is not a problem in C++ and also not in AutoIt. If it gives you syntax errors you should probably look into why, instead of simply deleting stuff as that is pretty much just troubleshooting using the whack-a-mole method :) 

 

4 hours ago, bahjat said:

And the syntax for AuotIT is still the same as it was a year ago correct? 

That depends which version you were using a year ago. But all in all it really doesn't matter, you probably should update your code to work with the latest version anyway :) 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
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

  • Similar Content

    • Viki
      By Viki
      This is my first time here so please dont bombard me that what a silly question I am asking!!
      I have 500 rows (A1:A500) in a spreadsheet and I just want to copy one by one row and then paste into another application and then press enter, loop should repeat this until finishes all 500 rows.
      I have looked at clipget(), clip(put() but dont know how to select next row in next turn. I also looked at Array to store but again no luck. Can some guide me please..
    • DineshPawar
      By DineshPawar
      0down votefavorite   In my current project, Excel macro open AutoIt script using a function Call Shell("location of autoit script").
      For proper functioning of AutoIt script it's need to be close parent Excel workbook, so this closing Excel action is written in AutoIt script itself.
      But as soon as AutoIt script close parent Excel workbook then script get pause and it do nothing.
      How open the AutoIt script from Excel workbook and after that parent Workbook get close?
    • AndroidZero
      By AndroidZero
      I want to animate transparent GIFs on my gui.
      I searched, read and tested a lot UDFs
      At the end none fits to me
      I wrote my own animated function, but its flickering sometimes just for a miliseconds but still doesnt looks good.

       
      Below is my code for Testing and also the GIF images you need for it.
      GUIChangeImage() is the Animation Function.
      CODE:
      ;************FOR GATHER HTML SOURCE CODE********************** #include <IE.au3> #include <InetConstants.au3> ;************FOR GUI*********** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIFiles.au3> ;**********FOR BUTTON ********** #include <ButtonConstants.au3> #include <StaticConstants.au3> ;**********FOR STRINGS ********** #include <StringConstants.au3> #include <String.au3> ;**********FOR COMBOBOX ********** #include <StringConstants.au3> #include <EditConstants.au3> #include <GuiEdit.au3> #include <GuiComboBox.au3> ;**********FOR FONTS ********** #include <FontConstants.au3> ;**********FOR GIF ANIMATION ********** #include <GIFAnimation.au3> ;**********FOR PROCESS ********** #include <Process.au3> #include <SendMessage.au3> #include <GDIPlus.au3> #include <WinAPIDiag.au3> Opt("GUIOnEventMode",1) Global Const $SC_DRAGMOVE = 0xF012 Global $hGUIAccountCreator Global $graphics_path = @ScriptDir & "\graphics" Global $fontSize_TextBody = 8.5, $fontName_TextBody = "", $fontWeight_TextBody = $FW_BOLD, $fontColor_TextBody = 0x5A2800 GUI_open_AccountCreator() Func GUI_open_AccountCreator() Global $hGUIAccountCreator = GUICreate("Tibia Account Creator - SubZero", 350, 400, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Close_AccountCreator") GUICtrlCreatePic($graphics_path & "\WindowAccountCreator.gif", 0, 0, 350, 400) GUICtrlSetState(-1, $GUI_DISABLE) ;********* GUI CONTROLS (LABELS,INPUTS,COMBOBOXES) ********************************************************************** GUICtrlCreateLabel(" Create New Account", 25,47,103,14,$SS_CENTERIMAGE) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0xFFFFFF) GUICtrlCreateLabel("Account Name:",30,75,75,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0x5A2800) Global $inptBox_Acc = GUICtrlCreateInput("",130,75,150,20) GUICtrlCreateLabel("Email Adress:",30,100,70,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0x5A2800) Global $inptBox_Email = GUICtrlCreateInput("",130,100,150,20) GUICtrlCreateLabel("Password:",30,125,55,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0x5A2800) Global $inptBox_Passwd = GUICtrlCreateInput("",130,125,150,20,$ES_PASSWORD) GUICtrlSetData($inptBox_Passwd, "") GUICtrlCreateLabel("Character Name:",30,170,83,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,0x5A2800) Global $inptBox_CharName = GUICtrlCreateInput("",130,170,150,20) GUICtrlCreateLabel("Sex:",30,195,23,14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,$fontSize_TextBody,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,$fontColor_TextBody) Global $comboBox_sex = GUICtrlCreateCombo("",130,195,150,20,$CBS_DROPDOWNLIST) ;LoadSexIntoComboBox() GUICtrlCreateLabel("World Location:",30,240,77) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,$fontSize_TextBody,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetFont(-1,8,$fontWeight_TextBody,0,$fontName_TextBody,1) GUICtrlSetColor(-1,$fontColor_TextBody) Global $comboBox_world = GUICtrlCreateCombo("",130,240,150,20,BitOr($CBS_DROPDOWNLIST, $WS_VSCROLL)) ;LoadWorldsIntoComboBox() Global $label_status = GUICtrlCreateLabel("",20,360,200,30) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;********* GUI CONTROLS (LABELS,INPUTS,COMBOBOXES) ********************************************************************** ;********* CONTROL PICS ********************************************************************** Global $btn_randAccName = GUICtrlCreatePic($graphics_path & "\Die_Static.gif", 280, 75, 26, 26) GUICtrlSetTip($btn_randAccName, "Generate a random account name") GUICtrlSetCursor($btn_randAccName,0) ;GUICtrlSetOnEvent($btn_randAccName,"GenerateRandomAccName") GUICtrlSetOnEvent($btn_randAccName,"GUIChangeImage") Global $btn_x = GUICtrlCreatePic("", 315, 5, 40, 36) GUICtrlSetTip($btn_x, "Close") GUICtrlSetCursor($btn_x,0) GUICtrlSetOnEvent($btn_x,"GUI_Close_AccountCreator") Global $btn_donate = GUICtrlCreatePic("", 112, 313, 126, 47) GUICtrlSetTip($btn_donate, "Donate") GUICtrlSetCursor($btn_donate,0) ;GUICtrlSetOnEvent($btn_donate,"Donate") ;********* CONTROL PICS ********************************************************************** ;********* GDI+ DRAW ********************************************************************** _GDIPlus_Startup() Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\X_Tic-Tac-Toe_Token.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_x, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Static.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\btn_donateCC_LG.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_donate, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _GDIPlus_Shutdown() ;********* GDI+ DRAW ********************************************************************** _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) GUISetIcon(@ScriptDir & "\TibiaInfo.ico") GUISetState(@SW_SHOW, $hGUIAccountCreator) WinSetOnTop($hGUIAccountCreator,"",1) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") EndFunc Func GUIChangeImage() _GDIPlus_Startup() GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Frame2.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) Sleep(100) GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Frame3.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) Sleep(100) GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Frame4.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) Sleep(100) GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Frame5.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) Sleep(100) GUICtrlDelete($btn_randAccName) Local $btn_randAccName = GUICtrlCreatePic("", 280, 75, 26, 26) GUICtrlSetCursor($btn_randAccName,0) GUICtrlSetOnEvent($btn_randAccName,"GUIChangeImage") Local $hImg = _GDIPlus_ImageLoadFromFile($graphics_path & "\Die_Static.gif") Local $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImg) _WinAPI_DeleteObject(GUICtrlSendMsg($btn_randAccName, 0x0172, $IMAGE_BITMAP, $hHBMP)) _GDIPlus_ImageDispose($hImg) _WinAPI_SetLayeredWindowAttributes($hGUIAccountCreator, 0x26f50b) _GDIPlus_Shutdown() EndFunc Func GUI_Close_AccountCreator() Exit EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUIAccountCreator, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc While 1 Sleep(10) WEnd  
      IMAGES:
       
       








    • ur
      By ur
      I am maintaining all the reusable code in a separate file as library.au3.
      In that file I have referenced some dependent files using fileinstall, so that they will be extracted when necessary.
       
      Problem is, if I use a function in the library.au3 in another script which doesn't require this dependent file, as I am including the whole file using include tag, it is embedding that file also.
      Is there any way to exclude that.
       
    • GAM
      By GAM
      Am trying to execute perl script from autoit script but its not running. Th command that I have given is...
      $rootDir = automation Run("cmd.exe /" & "C:\" & $rootDir & "\updatesource.pl") Can someone help please!