Выкладываю свою библиотеку для облегчения работы со списками MRU (Most Recently Used) в AutoIt. Скачать можно
здесь.
Пример 1.
Код:
#Include <MRU.au3>
const $RegKey = 'HKLM\SOFTWARE\Test\MRU'
local $i, $Mru, $Array
$Mru = _MRU_Create()
_MRU_AddItem($Mru, 'Item 4')
_MRU_AddItem($Mru, 'Item 3')
_MRU_AddItem($Mru, 'Item 2')
_MRU_AddItem($Mru, 'Item 1')
MsgBox(0, '', _MRU_GetAsString($Mru, '|'))
_MRU_SetSize($Mru, 2)
$Array = _MRU_GetAsArray($Mru)
for $i = 1 to $Array[0]
MsgBox(0, '', $Array[$i])
next
_MRU_RegWrite($Mru, $RegKey)
_MRU_Release($Mru)
Пример 2.
Код:
#Include <GUIComboBox.au3>
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
#Include <MRU.au3>
const $RegKey = 'HKLM\SOFTWARE\Test\MRU'
local $ButtonOk, $Combo, $Msg, $Mru
$Mru = _MRU_Create($RegKey)
GUICreate('Test', 400, 88)
$Combo = GUICtrlCreateCombo('', 20, 20, 360, 21)
GUICtrlSetData(-1, _MRU_GetAsString($Mru, '|'), _MRU_GetItem($Mru, 1))
$ButtonOk = GUICtrlCreateButton('OK', 165, 58, 70, 21)
GUISetState()
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
do
$Msg = GUIGetMsg()
if $Msg = $ButtonOk then
_MRU_AddItem($Mru, GUICtrlRead($Combo))
_MRU_RegWrite($Mru)
endif
until ($Msg = $ButtonOk) or ($Msg = $GUI_EVENT_CLOSE)
_MRU_Release($Mru)
func WM_COMMAND($hWnd, $msgID, $wParam, $lParam)
switch $lParam
case GUICtrlGetHandle($Combo)
if BitShift($wParam, 0x10) = $CBN_EDITCHANGE then
_GUICtrlComboBox_AutoComplete($Combo)
endif
case else
endswitch
return $GUI_RUNDEFMSG
endfunc; WM_COMMAND