Jump to content
bahjat

Source code working before but no longer in operation

Recommended Posts

bahjat

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
Melba23

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
bahjat
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
TheDcoder
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

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) mean to do that to anybody!!!

3fHNZJ.gif

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

Share this post


Link to post
Share on other sites
SadBunny
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

    • ufukreis1212
      By ufukreis1212
      Hello, I am new members. Help me please. I want vbs convert to au3 .
      This vbs code : 
      'deneme Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem") strOSArch = GetObject("winmgmts:root\cimv2:Win32_OperatingSystem=@").OSArchitecture Set objNetwork = CreateObject("Wscript.Network") Set wshShell = CreateObject( "WScript.Shell" ) strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) Set oShell = WScript.CreateObject("WScript.Shell") proc_arch = oShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%") Set oEnv = oShell.Environment("SYSTEM") strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colMB = objWMIService.ExecQuery("Select * from Win32_BaseBoard") Set colCSes = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colProcessors = objWMIService.ExecQuery("Select * from Win32_Processor") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItemsx = objWMIService.ExecQuery( _ "SELECT * FROM Win32_VideoController",,48) '------------------------------------------------------------------- Set obj = GetObject("winmgmts:").InstancesOf("Win32_PhysicalMemory") i = 1 For Each obj2 In obj memTmp1 = obj2.capacity / 1024 / 1024 TotalRam = TotalRam + memTmp1 i = i +1 Next '-------------------------------------------------------------------- Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") Set colItems = objWMIService.ExecQuery("Select Architecture from Win32_Processor") For Each objItem in colItems if objItem.Architecture = 0 then strArchitecture = "x86" end if if objItem.Architecture = 9 then strArchitecture = "x64" end if next '-------------------------------------------------------------------- strComputer = "." ' Local computer strMemory = "" i = 1 set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory") For Each objItem In colItems if strMemory <> "" then strMemory = strMemory & vbcrlf strMemory = strMemory & "Bank" & i & " : " & (objItem.Capacity /1024 /1024) & " Mb" i = i + 1 Next installedModules = i - 1 Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray") For Each objItem in colItems totalSlots = objItem.MemoryDevices Next '---------------------------------------------------------------------- Set objWMISvc = GetObject( "winmgmts:\\.\root\cimv2" ) Set colItems = objWMISvc.ExecQuery( "Select * from Win32_ComputerSystem" ) For Each objItem in colItems strComputerDomain = objItem.Domain Next for each System in SystemSet For Each objItem in colItemsx For Each objProcessor in colProcessors For Each bbType In colMB MbVendor = bbType.Manufacturer MbModel = bbType.Product MsgBox "İşletim Sistemi : " & System.Caption & vbNewLine & _ "İşletim Sistemi Versionu : " & + System.Version & vbNewLine & _ "Windows Mimari Yapısı: " & strOSArch & vbNewLine & _ "Kullanıcı isminiz: " & objNetwork.UserName & vbNewLine & _ "Bilgisayar ismi: " & strComputerName & vbNewLine & _ "Çalışma Grubu: " & strComputerDomain & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Anakart: " & MbVendor & " " & "[" & MbModel & "]" & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Grafik Kartı: " & objItem.Caption & vbNewLine & _ "Driver Version: " & objItem.DriverVersion & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "İşlemci Üreticisi: " & objProcessor.Manufacturer & vbNewLine & _ "İşlemci İsmi: " & objProcessor.Name & vbNewLine & _ "CPU Mimarisi: " & strArchitecture & vbNewLine & _ "İşlemci Çekirdek sayısı: " & oEnv("NUMBER_OF_PROCESSORS") & vbNewLine & _ "--------------------------------------" & vbNewLine & _ "Toplam RAM: " & TotalRam & " MB" & vbNewLine & _ "Toplam Slot: " & totalSlots & vbNewLine & _ "Boş Slot: " & (totalSlots - installedModules) & vbNewLine & _ "Ramlerin bulunduğu slotlar:" & vbcrlf & strMemory,0,"deneme" Next Next Next Next please help me , thanks.
    • JuanFelipe
      By JuanFelipe
       
      Hello friends, I have a query, it happens that I have a matrix nxn, the first column of this contains each cell a number with 21 digits, when I pass this matrix to Excel I obviously write that number as 1,10016E + 20, I solved it by adding a * at the end of each cell, but I want it to be written as a text so that I do not have to remove that *, I searched in Google but could not find an effective solution, thanks in advance. 
    • Puls3
      By Puls3
      Hi, This is my first post on the AutoIt Forums, I most of the time was able to get help from this community by merely searching though google and have been able to solve hundreds of problems this way, though in this case I was incapable of finding a solution to my problem. I am quite confident that it is a user error (And my fault) but I haven't been able to determine what I did wrong, any and all help would be greatly appreciated! I have uploaded my whole script pardon passwords to provide as much information as possible.
      I declared a global array at the top of the script and am having issues when I try to set it's value, and I fail to understand why.
      Error Message:
      "D:\Projects\AutoIt\Arena\Base.au3" (270) : ==> Subscript used on non-accessible variable.:
      $ExpMax[$i] = IniRead($TempSavePath, "Combatant" & $i, "ExpMax", $ExpMax[0])
      $ExpMax^ ERROR
      ConsoleWrite Log:
      Ran.
      Checking launch parameters.
      No launch parameters.
      Initiating load.
      Checking for save file.
      Save file not found.
      Load canceled.
      Loading or creating Combatant 1
      Base.au3
    • RamDemon
      By RamDemon
      Hi,
      Did anyone tried to  use Redis  with AutoIT as store DB ?
       Redis <-- more about it
      Mladen
    • nooneclose
      By nooneclose
      Hey. I'm working on a new project and was wondering if there is a better way to "update" my Column E array. 
      Here is my code: 
      Local $nI  = 0                                                            ;Creates a name index of 0: nI = Name index Local $nII = 1                                                            ;Creates a name index of 1 for second loop: nII = Name Index 2 For    $iN = 0 To $IndexRows Step 1                                       ;Checks the roster for any names that appear twice      For $iN2 = 0 To $IndexRows Step 1          if $d_Names[$nI] == $d_Names[$nII] And $d_Names[$nII] <> "" Then              Local $timeSheetName = _ArraySearch($e_Names, $d_Names[$nI], 0, 0, 0, 0, 1)              ;MsgBox($MB_SYSTEMMODAL, "Found it", $d_Names[$nI] & " In column E on Row " & $timeSheetName)              Local $eI  = $timeSheetName + 1              ;ConsoleWrite($timeSheetName & @CRLF)              ;ConsoleWrite($eI & @CRLF)              ;ConsoleWrite(@CRLF)              _Excel_RangeInsert($OpenWorkbook.ActiveSheet, "E" & $eI & ":F" & $eI, $xlShiftDown)                                                                          ;Inserts a empty cell in columns E and F.              _Excel_RangeWrite($OpenWorkbook, $OpenWorkbook.ActiveSheet, $d_Names[$nII], "E" & $eI)                                                                         ;Fills the empty cell in columns E with the doubled name              $aArray_Index = 2                                           ;Array element counter              For $Index = 2 To $IndexRows Step 1                        ;Loops through every row in the Excel file unto no rows are found or a null row is found                  $Array_Value_E = _Excel_RangeRead($OpenWorkbook, Default, "E"&$Index)                  $e_names[$aArray_Index] = $Array_Value_E                ;While the code loops every value in column E is stored in the E array (updating the array)                  $aArray_Index += 1              Next              ExitLoop          EndIf      Next      $nI  += 1      $nII += 1 Next Basically, It checks a roster for people whose name appears twice then inserts a new "row" for that person because they work in two different departments.
      I have to find that name however in Column E if two appear in column D. My code works but I think it is not as efficient as it could be. 
      Any ideas on how to improve the "update" for my array?
      (once it finds the double names in Column D it then searches for that name by going name by name in the Column E array and once it finds it inserts a new row. However, the E array doesn't have that new row stored in it so I have to "update" the array to properly find the next name)
      Any and all tips would be greatly appreciated. 
       
      NOTE: Just assume I'm opening the excel file properly please do not add that code in, it only complicates your answer. 
×