Advertisement
Guest User

Untitled

a guest
Apr 10th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 8.47 KB | None | 0 0
  1. Case "box"
  2.                 Local $lastXY = _Console_GetCursorXY()
  3.                 Switch $aWords[0]
  4.                     Case 1
  5.                         _Console_Pause("Błąd w linii: " & $iLine & ", brak 6 parametrów polecenia box - poz:x poz:y rozm:x rozm:y tytuł elementy")
  6.                         Exit
  7.                     Case 2
  8.                         _Console_Pause("Błąd w linii: " & $iLine & ", brak 5 parametrów polecenia box - poz:y rozm:x rozm:y tytuł elementy")
  9.                         Exit
  10.                     Case 3
  11.                         _Console_Pause("Błąd w linii: " & $iLine & ", brak 4 parametrów polecenia box - rozm:x rozm:y tytuł elementy")
  12.                         Exit
  13.                     Case 4
  14.                         _Console_Pause("Błąd w linii: " & $iLine & ", brak 3 parametrów polecenia box - rozm:y tytuł elementy")
  15.                         Exit
  16.                     Case 5
  17.                         _Console_Pause("Błąd w linii: " & $iLine & ", brak 2 parametrów polecenia box - tytuł elementy")
  18.                         Exit
  19.                     Case 6
  20.                         _Console_Pause("Błąd w linii: " & $iLine & ", brak 1 parametrów polecenia box - elementy")
  21.                         Exit
  22.                     Case Else
  23.                         Local $inpSet = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!@#$%^&*()[]{};:'" & '"' & ",<.>?`~-_=+\"
  24.                         Local $iCode = "", $cChar = ""
  25.                         Local $pX = $aWords[2], $pY = $aWords[3], $rX = $aWords[4], $rY = $aWords[5]
  26.                         Local $aSplit = StringSplit($aWords[7], ";"), $szTitle = $aWords[6]
  27.                         Local $element[$aSplit[0]][6], $iButtons = 0, $iInps = 0, $inpSel = 0
  28.                         Local $iMouse[3] = [0, 0, 0]
  29.                         _Console_Fill($pX, $pY, $rX, 1, "9F", " ")
  30.                         _Console_Fill($pX + _Box_Center($rX, $szTitle), $pY, StringLen(StringLeft($szTitle, $rX)), 1, "9F", $szTitle)
  31.                         _Console_Fill($pX, $pY + 1, $rX, $rY - 1, "FF", " ")
  32.                         For $iLines = 1 To $aSplit[0]
  33.                             If StringLeft($aSplit[$iLines], 2) = "##" Then
  34.                                 If _Box_ParseLine($aSplit[$iLines], "x") + StringLen(_Box_ParseLine($aSplit[$iLines], "t")) - 1 <= $rX And _Box_ParseLine($aSplit[$iLines], "y") - 1 < $rY Then
  35.                                     $iButtons += 1
  36.                                     $element[$iLines - 1][0] = "button"
  37.                                     $element[$iLines - 1][1] = $pX + _Box_ParseLine($aSplit[$iLines], "x") - 1
  38.                                     $element[$iLines - 1][2] = $pY + _Box_ParseLine($aSplit[$iLines], "y")
  39.                                     $element[$iLines - 1][3] = StringLen(_Box_ParseLine($aSplit[$iLines], "t"))
  40.                                     $element[$iLines - 1][4] = $iButtons
  41.                                     $element[$iLines - 1][5] = _Box_ParseLine($aSplit[$iLines], "t")
  42.                                     _Console_Fill($element[$iLines - 1][1], $element[$iLines - 1][2], $element[$iLines - 1][3], 1, "CF", $element[$iLines - 1][5])
  43.                                 EndIf
  44.                             EndIf
  45.                             If StringLeft($aSplit[$iLines], 2) = "!!" Then
  46.                                 If _Box_ParseLine($aSplit[$iLines], "x") + StringLen(_Box_ParseLine($aSplit[$iLines], "t")) - 1 <= $rX And _Box_ParseLine($aSplit[$iLines], "y") - 1 < $rY Then
  47.                                     $element[$iLines - 1][0] = "text"
  48.                                     $element[$iLines - 1][1] = $pX + _Box_ParseLine($aSplit[$iLines], "x") - 1
  49.                                     $element[$iLines - 1][2] = $pY + _Box_ParseLine($aSplit[$iLines], "y")
  50.                                     $element[$iLines - 1][3] = StringLen(_Box_ParseLine($aSplit[$iLines], "t"))
  51.                                     $element[$iLines - 1][4] = ""
  52.                                     $element[$iLines - 1][5] = _Box_ParseLine($aSplit[$iLines], "t")
  53.                                     _Console_Fill($element[$iLines - 1][1], $element[$iLines - 1][2], $element[$iLines - 1][3], 1, "F0", $element[$iLines - 1][5])
  54.                                 EndIf
  55.                             EndIf
  56.                             If StringLeft($aSplit[$iLines], 2) = "$$" Then
  57.                                 If _Box_ParseLine($aSplit[$iLines], "x") + _Box_ParseLine($aSplit[$iLines], "t") - 1 <= $rX And _Box_ParseLine($aSplit[$iLines], "y") - 1 < $rY Then
  58.                                     $iInps += 1
  59.                                     If Not $inpSel Then
  60.                                         $inpSel = $iLines
  61.                                     EndIf
  62.                                     $element[$iLines - 1][0] = "input"
  63.                                     $element[$iLines - 1][1] = $pX + _Box_ParseLine($aSplit[$iLines], "x") - 1
  64.                                     $element[$iLines - 1][2] = $pY + _Box_ParseLine($aSplit[$iLines], "y")
  65.                                     $element[$iLines - 1][3] = _Box_ParseLine($aSplit[$iLines], "t")
  66.                                     $element[$iLines - 1][4] = $iInps
  67.                                     $element[$iLines - 1][5] = ""
  68.                                     _Console_Fill($element[$iLines - 1][1], $element[$iLines - 1][2], $element[$iLines - 1][3], 1, "8F", " ")
  69.                                 EndIf
  70.                             EndIf
  71.                         Next
  72.                         Local $szLastE
  73.                         If $iButtons Then
  74.                             _Console_SetCursorVisible(1)
  75.                             While 1
  76.                                 If $inpSel Then _Console_GotoXY($element[$inpSel - 1][1] + StringLen($element[$inpSel - 1][5]), $element[$inpSel - 1][2])
  77.                                 $iMouse[0] = 0
  78.                                 _Console_ReadInput($CONSOLE_INPUT, $tRecord, 1)
  79.                                 Switch DllStructGetData($tRecord, "EventType")
  80.                                     Case $MOUSE_EVENT
  81.                                         Local $tMouseRecord = DllStructCreate($tagINPUT_RECORD_MOUSE, DllStructGetPtr($tRecord))
  82.                                         $iMouse[0] = DllStructGetData($tMouseRecord, "dwButtonState")
  83.                                         $iMouse[1] = DllStructGetData($tMouseRecord, "X") + 1
  84.                                         $iMouse[2] = DllStructGetData($tMouseRecord, "Y") + 1
  85.                                         For $iE = 0 To $aSplit[0] - 1
  86.                                             While $element[$iE][0] = "button" And $element[$iE][2] = $iMouse[2] And IfX($iMouse[1], $element[$iE][1], $element[$iE][1] + $element[$iE][3] - 1)
  87.                                                     _Console_Fill($element[$iE][1], $element[$iE][2], $element[$iE][3], 1, "47", $element[$iE][5])
  88.                                                 $iMouse[0] = 0
  89.                                                 _Console_ReadInput($CONSOLE_INPUT, $tRecord, 1)
  90.                                                 Switch DllStructGetData($tRecord, "EventType")
  91.                                                     Case $MOUSE_EVENT
  92.                                                         Local $tMouseRecord = DllStructCreate($tagINPUT_RECORD_MOUSE, DllStructGetPtr($tRecord))
  93.                                                         $iMouse[0] = DllStructGetData($tMouseRecord, "dwButtonState")
  94.                                                         $iMouse[1] = DllStructGetData($tMouseRecord, "X") + 1
  95.                                                         $iMouse[2] = DllStructGetData($tMouseRecord, "Y") + 1
  96.                                                     Case Else
  97.                                                         _Console_Fill($element[$iE][1], $element[$iE][2], $element[$iE][3], 1, "CF", $element[$iE][5])
  98.                                                         ExitLoop
  99.                                                 EndSwitch
  100.                                                 If $iMouse[0] Then
  101.                                                     _Console_SetCursorVisible(0)
  102.                                                     _Console_GotoXY($lastXY[0] + 1, $lastXY[1] + 1)
  103.                                                     _VariableSet("ButtonNumber", $element[$iE][4])
  104.                                                     _VariableSet("ButtonText", $element[$iE][5])
  105.                                                     If $iInps Then
  106.                                                         _VariableSet("Inputs", $iInps)
  107.                                                         For $iEs = 0 To $aSplit[0] - 1
  108.                                                             If $element[$iEs][0] = "input" Then _VariableSet("InputData" & $element[$iEs][4], $element[$iEs][5])
  109.                                                         Next
  110.                                                     EndIf
  111.                                                     Return 0
  112.                                                 EndIf
  113.                                                 If $element[$iE][0] = "button" And $element[$iE][2] = $iMouse[2] And IfX($iMouse[1], $element[$iE][1], $element[$iE][1] + $element[$iE][3] - 1) Then
  114.  
  115.                                                 Else
  116.                                                     _Console_Fill($element[$iE][1], $element[$iE][2], $element[$iE][3], 1, "CF", $element[$iE][5])
  117.                                                 EndIf
  118.                                             WEnd
  119.                                             If $element[$iE][0] = "input" And $iMouse[0] And $element[$iE][2] = $iMouse[2] And IfX($iMouse[1], $element[$iE][1], $element[$iE][1] + $element[$iE][3] - 1) Then $inpSel = $iE + 1
  120.                                         Next
  121.                                     Case $KEY_EVENT
  122.                                             $tKeyRecord = DllStructCreate($tagINPUT_RECORD_KEY, DllStructGetPtr($tRecord))
  123.                                             $bKeyDown = DllStructGetData($tKeyRecord, "bKeyDown")
  124.                                             $cChar = DllStructGetData($tKeyRecord, "UnicodeChar")
  125.                                             $iCode = DllStructGetData($tKeyRecord, "wVirtualKeyCode")
  126.                                             If $bKeyDown And $inpSel Then
  127.                                                 Switch $iCode
  128.                                                     Case 8
  129.                                                         $element[$inpSel - 1][5] = StringTrimRight($element[$inpSel - 1][5], 1)
  130.                                                     Case 32
  131.                                                         If StringLen($element[$inpSel - 1][5]) < $element[$inpSel - 1][3] Then $element[$inpSel - 1][5] &= " "
  132.                                                     Case 9
  133.                                                         For $iE = 0 To $aSplit[0] - 1
  134.                                                             If $element[$iE][0] = "input" And $element[$iE][4] = $iInps And $iE + 1 = $inpSel Then
  135.                                                                 For $iE2 = 0 To $aSplit[0] - 1
  136.                                                                     If $element[$iE2][0] = "input" Then
  137.                                                                         $inpSel = $iE2 + 1
  138.                                                                         ExitLoop 2
  139.                                                                     EndIf
  140.                                                                 Next
  141.                                                             EndIf
  142.                                                             If $element[$iE][0] = "input" And $iE + 1 > $inpSel Then
  143.                                                                 $inpSel = $iE + 1
  144.                                                                 ExitLoop
  145.                                                             EndIf
  146.                                                         Next
  147.                                                 EndSwitch
  148.                                                 If StringInStr($inpSet, $cChar) And StringLen($element[$inpSel - 1][5]) < $element[$inpSel - 1][3] Then $element[$inpSel - 1][5] &= $cChar
  149.                                                 _Console_Fill($element[$inpSel - 1][1], $element[$inpSel - 1][2], $element[$inpSel - 1][3], 1, "88", " ")
  150.                                                 _Console_Fill($element[$inpSel - 1][1], $element[$inpSel - 1][2], StringLen($element[$inpSel - 1][5]), 1, "8F", $element[$inpSel - 1][5])
  151.                                             EndIf
  152.                                 EndSwitch
  153.                             WEnd
  154.                         EndIf
  155.                 EndSwitch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement