#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <GUIListBox.au3>
#Region ### START Koda GUI section ### Form=d:\autoit\koda_1.7.2.8_b247_2010-04-15\forms\kolodka.kxf
$aArray = IniReadSection(@ScriptDir & "\Key.ini", "PK")
If @error Then
MsgBox(4096, "", "Произошла ошибка, отсутствует INI-файл.")
Exit
Else
EndIf
$aSectionName = IniReadSectionNames(@ScriptDir & "\Tel.ini")
If @error Then
MsgBox(4096, "", "Произошла ошибка, возможно отсутствует INI-файл.")
Exit
Else
EndIf
Dim $iID[10]
Dim $aTel[250]
$k = 0
For $i = 1 To $aSectionName[0]
$aSection = IniReadSection(@ScriptDir & "\Tel.ini", $aSectionName[$i])
For $j = 0 To $aSection[0][0] - 1
$aTel[$k + $j] = $aSection[$j + 1][1]
Next
$k += $j
Next
ReDim $aTel[$k]
$aSpravka = IniReadSection(@ScriptDir & "\spravka.ini", "Tel")
If @error Then
MsgBox(4096, "", "Произошла ошибка, отсутствует INI-файл.")
Exit
Else
EndIf
;_ArrayDisplay($aSpravka)
;_SearchTel('3081')
$Form1_1 = GUICreate("Схема расположения телефонных номеров", 1077, 651, 169, 5)
$PK20 = GUICtrlCreateGroup("PK2.0 (каб.114 - Техники)", 24, 16, 209, 65)
For $i = 1 To $aArray[0][0]
$a = StringSplit($aArray[$i][1], ',')
GUICtrlCreateButton($a[1], $a[2], $a[3], $a[4], $a[5])
Next
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("PK2.1 (каб.117 - тамбур Столовая)", 24, 84, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("PK2.2 (каб.106 - напротив под потолком)", 24, 152, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("PK2.3 (каб.105 - тамбур Звукозапись)", 24, 219, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group5 = GUICtrlCreateGroup("PK2.4 (потолок пред ПК4, где стенд)", 23, 287, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("PK2.5 (каб.103 - тамбур Сауна)", 240, 16, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group6 = GUICtrlCreateGroup("PK2.6 (каб.226 - Системный администратор)", 240, 84, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group7 = GUICtrlCreateGroup("PK2.7 (каб.218 - фойе АВМ)", 240, 152, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group8 = GUICtrlCreateGroup("PK2.8 (каб.201 - пред Приемная)", 240, 220, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group9 = GUICtrlCreateGroup("PK2.9 (каб.209 - пред Передачники)", 240, 288, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group10 = GUICtrlCreateGroup("IP-ATC", 488, 8, 81, 569)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group11 = GUICtrlCreateGroup("PK3.1 (каб.216 - Бухгалтерия)", 611, 156, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group12 = GUICtrlCreateGroup('PK3.2 (каб.230 - тамбур СИ "ТВ")', 611, 228, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group13 = GUICtrlCreateGroup("PK3.3", 611, 300, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$PK4 = GUICtrlCreateGroup("PK4 (каб.232 - Рекламный отдел)", 232, 490, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$PK76 = GUICtrlCreateGroup("PK76 (Городские номера)", 608, 491, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$PK77 = GUICtrlCreateGroup("PK77 (Городские номера)", 851, 494, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$PK1 = GUICtrlCreateGroup('PK1.0 (ЭА "Кунел")', 613, 11, 209, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Linksys = GUICtrlCreateGroup("Linksys", 32, 352, 81, 281)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$font = "Times New Roman"
$iLabel = GUICtrlCreateLabel('Номер телефона:', 180, 600, 200, 17, $WS_EX_CLIENTEDGE)
GUICtrlSetFont($iLabel, 16, 400, 0, $font)
GUICtrlCreateLabel('', 335, 595, 75, 25, $WS_BORDER, $WS_EX_CLIENTEDGE) ;$aTel[$nMsg - 4]
GUICtrlSetFont(-1, 16, 400, 0, $font)
$iFind = GUICtrlCreateLabel('Поиск номера:', 680, 600, 200, 17, $WS_EX_CLIENTEDGE)
GUICtrlSetFont($iFind, 12, 700, 0, $font)
$Input = GUICtrlCreateInput('', 790, 600, 100, 17, $WS_BORDER)
GUICtrlSetState($Input, $GUI_FOCUS)
$BtnOk = GUICtrlCreateButton("OK", 900, 600, 50, 17)
GUICtrlSetState($BtnOk, $GUI_DEFBUTTON)
$List = GUICtrlCreateList("", 830, 5, 235, 480, $WS_BORDER+$WS_VSCROLL+$LBS_NOINTEGRALHEIGHT) ;, BitOR($LBS_MULTIPLESEL, $GUI_SS_DEFAULT_LIST))
For $x = 1 To Ubound($aSpravka)-1
GUICtrlSetData($List, $aSpravka[$x][1] & ' - ' & $aSpravka[$x][0])
Next
GUISetState()
#EndRegion ### END Koda GUI section ###
$iIDold = $iID
$iIDold = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case 4 To 210
For $b = 0 To Ubound($iIDold) - 1
GUICtrlSetBkColor($iIDold[$b], 0xEFEFEF)
Next
If $aTel[$nMsg - 4] <> 0 Then
_SearchTel($aTel[$nMsg - 4])
For $d = 0 To Ubound($iID) - 1
GUICtrlSetBkColor($iID[$d], 0xff0000)
Next
GUICtrlCreateLabel($aTel[$nMsg - 4], 335, 595, 75, 25, $WS_BORDER, $WS_EX_CLIENTEDGE) ;
GUICtrlSetFont(-1, 16, 400, 0, $font)
Else
EndIf
$iIDold = $iID
$nMsgOld = $nMsg
Case 249
GUICtrlSetState($Input, $GUI_FOCUS)
GUICtrlSetData($Input, '')
Case $BtnOk
$sText = GUICtrlRead($Input)
;MsgBox(0, "Результат", $sText)
For $b = 0 To Ubound($iIDold) - 1
GUICtrlSetBkColor($iIDold[$b], 0xEFEFEF)
Next
_SearchTel($sText)
If Ubound($iID) = 0 Then
MsgBox(0, "Результат", 'Нет такого номера')
Else
For $d = 0 To Ubound($iID) - 1
GUICtrlSetBkColor($iID[$d], 0xff0000)
Next
GUICtrlCreateLabel($sText, 335, 595, 75, 25, $WS_BORDER, $WS_EX_CLIENTEDGE) ;
GUICtrlSetFont(-1, 16, 400, 0, $font)
$iIDold = $iID
$nMsgOld = $nMsg
EndIf
EndSwitch
WEnd
Func _SearchTel($t)
$j = 0
ReDim $iID[10]
For $i = 0 To UBound($aTel) - 1
If $t = $aTel[$i] Then
$iID[$j] = $i + 4
$j += 1
Else
EndIf
Next
ReDim $iID[$j]
Return $iID
EndFunc