Jump to content

_GUICtrlMenu_Recent() - Create a recent menu to add previously opened files or other text items to.


Recommended Posts

Posted (edited)

_GUICtrlMenu_Recent() is for those that enjoy using GUICtrlCreateMenu() and would love to have the ability to have a "Recent" menu list with little to no fuss at all. The UDF contains only 7 functions and due to the design of the UDF, reading the recent menu item that was chosen is very easy indeed. Try the Example provided to get an idea of how it works.

Any suggestions or improvements then please post below. Thanks.

Example:

2gt1yqw.png

UDF:

#include-once

; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7
; #INDEX# =======================================================================================================================
; Title .........: _GUICtrlMenu_Recent_
; AutoIt Version : v3.3.12.0 or higher
; Language ......: English
; Description ...: Create a recent menu to add previously opened files or other text items to.
; Author(s) .....: guinness
; ===============================================================================================================================

; #INCLUDES# =========================================================================================================
#include <WinAPI.au3>

; #GLOBAL VARIABLES# =================================================================================================
Global Const $RECENTMENU_GUID = '051F0003-4E0A-4E4B-8B1A-113B16972254'
Global Const $RECENTMENU = 0
Global Const $RECENTMENU_STARTINDEX = 1
Global Enum $RECENTMENU_CAPACITY, $RECENTMENU_ID, $RECENTMENU_INDEX, $RECENTMENU_MENUID, $RECENTMENU_MAX
Global Enum $RECENTMENU_CONTROLID, $RECENTMENU_FILEPATH, $RECENTMENU_SHORTPATH

; #CURRENT# =====================================================================================================================
; _GUICtrlMenu_RecentAdd: Add an item to the recent menu that was created by _GUICtrlMenu_RecentCreate().
; _GUICtrlMenu_RecentCapacity: Change the total number of items to be displayed in the recent menu.
; _GUICtrlMenu_RecentCreate: Create a recent menu that is added to an existing menu created by GUICtrlCreateMenu().
; _GUICtrlMenu_RecentDelete: Delete an item in the recent menu that was created by _GUICtrlMenu_RecentCreate().
; _GUICtrlMenu_RecentDestroy: Destroy the handle created by _GUICtrlMenu_RecentCreate().
; _GUICtrlMenu_RecentIsInMenu: Search if a filepath or text is currently in the menu list.
; _GUICtrlMenu_RecentSelected: Retrieve the text of a selected menu item and delete from the menu list.
; ===============================================================================================================================

; #INTERNAL_USE_ONLY#============================================================================================================
; __GUICtrlMenu_RecentDelete
; ===============================================================================================================================

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlMenu_RecentAdd
; Description ...: Add an item to the recent menu that was created by _GUICtrlMenu_RecentCreate().
; Syntax ........: _GUICtrlMenu_RecentAdd(ByRef $aRecentMenu, $sText)
; Parameters ....: $aRecentMenu         - $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY]
;                  $sText               - Text to be added to the recent menu.
;                  $bShortText          - [optional] Display the text as short text e.g. 'C:\Example...\Test.au3'. Default is False.
; Return values .: Success - ControlID from GUICtrlCreateMenuItem().
;                  Failure - 0 and sets @error to non-zero.
; Author ........: guinness
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlMenu_RecentAdd(ByRef $aRecentMenu, $sText, $bShortText = False)
    Local $iError = 1, $iReturn = 0
    If __GUICtrlMenu_IsAPI($aRecentMenu) Then
        _GUICtrlMenu_RecentIsInMenu($aRecentMenu, $sText)
        __GUICtrlMenu_RecentDelete($aRecentMenu, @extended)

        If $aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX] = $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY] Then
            __GUICtrlMenu_RecentDelete($aRecentMenu, $RECENTMENU_STARTINDEX)
        EndIf

        Local $sShortText = $sText
        If IsBool($bShortText) And $bShortText Then
            $sShortText = StringRegExpReplace($sText, '(^.{3,11}\\|.{11})(.*)(\\.{6,27}|.{27})$', '\1...\3') ; Thanks to AZJIO for the regular expression.
        EndIf

        $aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX] += 1
        $aRecentMenu[$aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX]][$RECENTMENU_CONTROLID] = GUICtrlCreateMenuItem($sShortText, $aRecentMenu[$RECENTMENU][$RECENTMENU_MENUID], 0)
        $aRecentMenu[$aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX]][$RECENTMENU_FILEPATH] = $sText
        $aRecentMenu[$aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX]][$RECENTMENU_SHORTPATH] = $sShortText
        $iReturn = $aRecentMenu[$aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX]][$RECENTMENU_CONTROLID]
        $iError = (($iReturn > 0) ? 1 : 0)
    EndIf
    Return SetError($iError, 0, $iReturn)
EndFunc   ;==>_GUICtrlMenu_RecentAdd

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlMenu_RecentCapacity
; Description ...: Change the total number of items to be displayed in the recent menu.
; Syntax ........: _GUICtrlMenu_RecentCapacity(ByRef $aRecentMenu, $iCapacity)
; Parameters ....: $aRecentMenu         - [in/out] Handle created by _GUICtrlMenu_RecentCreate().
;                  $iCapacity           - Maximum total number of recent menu items to be displayed. If this is exceeded then old values will be overwritten.
; Return values .: Success - True
;                  Failure - False
; Author ........: guinness
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlMenu_RecentCapacity(ByRef $aRecentMenu, $iCapacity)
    Local $bReturn = False
    If __GUICtrlMenu_IsAPI($aRecentMenu) Then
        $iCapacity = Int($iCapacity)
        If $iCapacity >= $RECENTMENU_STARTINDEX And $iCapacity <> $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY] Then
            $bReturn = True
            If $iCapacity < $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY] Then
                For $i = $RECENTMENU_STARTINDEX To ($aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX] - $iCapacity)
                    GUICtrlDelete($aRecentMenu[$i][$RECENTMENU_CONTROLID])
                Next

                Local $iIndex = ($aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX] - $iCapacity) + 1
                For $i = $RECENTMENU_STARTINDEX To $iCapacity
                    For $j = 0 To $RECENTMENU_MAX - 1
                        $aRecentMenu[$i][$j] = $aRecentMenu[$iIndex][$j]
                    Next
                    $iIndex += 1
                Next
                $aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX] = $iCapacity
            EndIf

            $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY] = $iCapacity
            ReDim $aRecentMenu[$aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY] + $RECENTMENU_STARTINDEX][$RECENTMENU_MAX]
        EndIf
    EndIf
    Return $bReturn
EndFunc   ;==>_GUICtrlMenu_RecentCapacity

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlMenu_RecentCreate
; Description ...: Create a recent menu that is added to an existing menu created by GUICtrlCreateMenu().
; Syntax ........: _GUICtrlMenu_RecentCreate($iCapacity, $iMenu, $sTitle)
; Parameters ....: $iCapacity           - Maximum total number of recent menu items to be displayed. If this is exceeded then old values will be overwritten.
;                  $iMenu               - Existing menu id created by GUICtrlCreateMenu().
;                  $sTitle              - Title of the recent menu.
; Return values .: Success - Handle to be passed to the recent menu functions.
;                  Failure - None
; Author ........: guinness
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlMenu_RecentCreate($iCapacity, $iMenu, $sTitle)
    If $iCapacity = Default Or Int($iCapacity) <= 0 Then
        $iCapacity = 10
    EndIf
    Local $aRecentMenu[$iCapacity + $RECENTMENU_STARTINDEX][$RECENTMENU_MAX]
    $aRecentMenu[$RECENTMENU][$RECENTMENU_ID] = $RECENTMENU_GUID

    $aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX] = 0 ; Index of next item.
    $aRecentMenu[$RECENTMENU][$RECENTMENU_MENUID] = (($iMenu > 0) ? GUICtrlCreateMenu($sTitle, $iMenu) : GUICtrlCreateMenu($sTitle))
    $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY] = $iCapacity ; Total number of rows.
    Return $aRecentMenu
EndFunc   ;==>_GUICtrlMenu_RecentCreate

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlMenu_RecentDelete
; Description ...: Delete an item in the recent menu that was created by _GUICtrlMenu_RecentCreate().
; Syntax ........: _GUICtrlMenu_RecentDelete(ByRef $aRecentMenu, $vIndex)
; Parameters ....: $aRecentMenu         - [in/out] Handle created by _GUICtrlMenu_RecentCreate().
;                  $vIndex              - Value to be deleted. This can either be an integer of the handle index (see _GUICtrlMenu_RecentIsInMenu() and remarks)
;                                         or a string value of the item.
; Return values .: Success - True
;                  Failure - False
; Author ........: guinness
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlMenu_RecentDelete(ByRef $aRecentMenu, $vIndex)
    Local $bReturn = False
    If __GUICtrlMenu_IsAPI($aRecentMenu) Then
        If IsString($vIndex) Then
            _GUICtrlMenu_RecentIsInMenu($aRecentMenu, $vIndex)
            $vIndex = @extended
        EndIf
        $bReturn = __GUICtrlMenu_RecentDelete($aRecentMenu, $vIndex)
    EndIf
    Return $bReturn
EndFunc   ;==>_GUICtrlMenu_RecentDelete

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlMenu_RecentDestroy
; Description ...: Destroy the handle created by _GUICtrlMenu_RecentCreate().
; Syntax ........: _GUICtrlMenu_RecentDestroy(ByRef $aRecentMenu)
; Parameters ....: $aRecentMenu         - [in/out] Handle created by _GUICtrlMenu_RecentCreate().
; Return values .: Success - True
;                  Failure - False
; Author ........: guinness
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlMenu_RecentDestroy(ByRef $aRecentMenu)
    Local $bReturn = False
    If __GUICtrlMenu_IsAPI($aRecentMenu) Then
        $bReturn = True
        For $i = $RECENTMENU_STARTINDEX To $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY]
            GUICtrlDelete($aRecentMenu[$i][$RECENTMENU_CONTROLID])
        Next
    EndIf
    $aRecentMenu = 0
    Return $bReturn
EndFunc   ;==>_GUICtrlMenu_RecentDestroy

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlMenu_RecentIsInMenu
; Description ...: Search if a filepath or text is currently in the menu list.
; Syntax ........: _GUICtrlMenu_RecentIsInMenu(ByRef $aRecentMenu, $sText)
; Parameters ....: $aRecentMenu         - [in/out] Handle created by _GUICtrlMenu_RecentCreate().
;                  $sText               - Text to search for. This is a case-sensitive search.
; Return values .: Success - True and sets @extended to the index position of the text.
;                  Failure - False and sets @extended to zero.
; Author ........: guinness
; Remarks .......: @extended is set to the index position in the handle. This is useful if using GUICtrlMenu_RecentDelete().
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlMenu_RecentIsInMenu(ByRef $aRecentMenu, $sText)
    Local $bReturn = False, _
            $iExtended = 0
    If __GUICtrlMenu_IsAPI($aRecentMenu) Then
        For $i = $RECENTMENU_STARTINDEX To $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY]
            If ($sText == $aRecentMenu[$i][$RECENTMENU_FILEPATH]) Or ($sText == $aRecentMenu[$i][$RECENTMENU_SHORTPATH]) Then
                $bReturn = True
                $iExtended = $i
                ExitLoop
            EndIf
        Next
    EndIf
    Return SetExtended($iExtended, $bReturn)
EndFunc   ;==>_GUICtrlMenu_RecentIsInMenu

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlMenu_RecentSelected
; Description ...: Retrieve the text of a selected menu item and delete from the menu list.
; Syntax ........: _GUICtrlMenu_RecentSelected(ByRef $aRecentMenu, $iMsg)
; Parameters ....: $aRecentMenu         - [in/out] Handle created by _GUICtrlMenu_RecentCreate()..
;                  $iMsg                - Message id returned by GUIGetMsg().
; Return values .: Success - Text of the selected menu.
;                  Failure - Null and sets @error to non-zero.
; Author ........: guinness
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlMenu_RecentSelected(ByRef $aRecentMenu, $iMsg)
    Local $iError = 1, _
            $sReturn = Null
    If $iMsg > 0 And __GUICtrlMenu_IsAPI($aRecentMenu) Then
        For $i = $RECENTMENU_STARTINDEX To $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY]
            If $iMsg = $aRecentMenu[$i][$RECENTMENU_CONTROLID] Then
                $iError = 0
                $sReturn = $aRecentMenu[$i][$RECENTMENU_FILEPATH]
                __GUICtrlMenu_RecentDelete($aRecentMenu, $i)
                ExitLoop
            EndIf
        Next
    EndIf

    Return SetError($iError, 0, $sReturn)
EndFunc   ;==>_GUICtrlMenu_RecentSelected

; #INTERNAL_USE_ONLY#============================================================================================================
Func __GUICtrlMenu_RecentDelete(ByRef $aRecentMenu, $iIndex)
    Local $bReturn = False
    If $iIndex >= $RECENTMENU_STARTINDEX And $iIndex <= $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY] And GUICtrlDelete($aRecentMenu[$iIndex][$RECENTMENU_CONTROLID]) Then
        $bReturn = True
        Local $iSwap = 0
        For $i = $iIndex To $aRecentMenu[$RECENTMENU][$RECENTMENU_CAPACITY] - 1
            For $j = 0 To $RECENTMENU_MAX - 1
                $iSwap = $i + 1
                $aRecentMenu[$i][$j] = $aRecentMenu[$iSwap][$j]
                $aRecentMenu[$iSwap][$j] = Null
            Next
        Next
        $aRecentMenu[$RECENTMENU][$RECENTMENU_INDEX] -= 1
    EndIf
    Return $bReturn
EndFunc   ;==>__GUICtrlMenu_RecentDelete

Func __GUICtrlMenu_IsAPI(ByRef $aRecentMenu)
    Return UBound($aRecentMenu, $UBOUND_COLUMNS) = $RECENTMENU_MAX And $aRecentMenu[$RECENTMENU][$RECENTMENU_ID] = $RECENTMENU_GUID
EndFunc   ;==>__GUICtrlMenu_IsAPI

Example 1:

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

#include '_GUICtrlMenu_Recent.au3'

Example()

Func Example()
    Local $hGUI = GUICreate('_GUICtrlMenu_Recent() Example', 300, 200)

    Local $iFileMenu = GUICtrlCreateMenu('&File')
    Local $iOpen = GUICtrlCreateMenuItem('Open', $iFileMenu)
    GUICtrlSetState($iOpen, $GUI_DEFBUTTON)

    ; Create a recent menu with a maximum of 5 displayed items.
    Local $hRecentMenu = _GUICtrlMenu_RecentCreate(5, $iFileMenu, 'Recent Files')

    GUICtrlCreateMenuItem('', $iFileMenu) ; Seperator Line.
    GUICtrlCreateMenuItem('Save', $iFileMenu)
    GUICtrlSetState(-1, $GUI_DISABLE)

    Local $iExit = GUICtrlCreateMenuItem('Exit', $iFileMenu)
    Local $iOpenFile = GUICtrlCreateButton('Open File', 5, 10, 85, 25)
    Local $iIncreaseItems = GUICtrlCreateButton('Increase Recent List', 5, 35, 115, 25)

    GUISetState(@SW_SHOW, $hGUI)

    ; Add the current script to the recent menu.
    _GUICtrlMenu_RecentAdd($hRecentMenu, @ScriptFullPath, True)

    Local $iMsg = 0, _
            $sFilePath = ''
    While 1
        $iMsg = GUIGetMsg()
        Switch $iMsg
            Case $GUI_EVENT_CLOSE, $iExit
                ExitLoop

            Case $iOpenFile, $iOpen
                $sFilePath = FileOpenDialog('Choose File...', @ScriptDir, 'All (*.*)')
                If Not @error Then
                    ; Check whether or not the filepath is currently in the recent menu. If it isn't then add to the recent menu.
                    If Not _GUICtrlMenu_RecentIsInMenu($hRecentMenu, $sFilePath) Then
                        ; If the button or open menu items are selected then add a filepath to the recent menu.
                        _GUICtrlMenu_RecentAdd($hRecentMenu, $sFilePath, True) ; Display the text as short text.
                    EndIf
                EndIf

            Case $iIncreaseItems
                ; Increase the capacity to 20 items instead of the previous 5.
                If _GUICtrlMenu_RecentCapacity($hRecentMenu, 20) Then
                    MsgBox($MB_SYSTEMMODAL, '', 'The recent menu list was increased to a maximum of 20 items.', 0, $hGUI)
                Else
                    MsgBox($MB_SYSTEMMODAL, '', 'The recent menu list wasn''t increased to a maximum of 20 items. An error occurred.', 0, $hGUI)
                EndIf

            Case Else
                ; Check if the message id returned by GUIGetMsg() is present in the recent menu list.
                $sFilePath = _GUICtrlMenu_RecentSelected($hRecentMenu, $iMsg)
                If Not @error Then
                    MsgBox($MB_SYSTEMMODAL, '', 'The recent menu was selected and the following item was chosen' & @CRLF & _
                            @CRLF & _
                            $sFilePath, 0, $hGUI)
                EndIf

        EndSwitch
    WEnd

    ; Destroy the recent menu.
    _GUICtrlMenu_RecentDestroy($hRecentMenu)
    GUIDelete($hGUI)
EndFunc   ;==>Example

All of the above has been included in a ZIP file.  GUICtrlMenu_Recent.zip

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

  • 1 year later...
Posted

This UDF has been re-written entirely from scratch and does away with the ugly Global variable that was being used to store the relevant information. I've opted for passing an array to the appropriate functions as a reference, so very little knowledge is required to know what is going on behind the scenes. Please see the example for more details on how to use this UDF. Thanks.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted

1. Look at _GUICtrlMenu_RecentCreate and the parameter $iTotal to set the number of items.

2. Thanks, see the original post for the addition. The function _GUICtrlMenu_RecentAdd has an additional boolean parameter for short text.

To all,

I have updated the UDF with the addition suggested by AZJIO to use short text e.g. 'C:Example...Test.au3' instead of the full path. Please see the original post for more details.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted

OK I will add an additional function later on today, something like _GUICtrlMenu_RecentParams(ByRef $aAPI, $iTotal, $fClearSelected = True) to adjust the size of the recent list and whether or not to clear the items upon selection.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted

OK AZJIO,

I have added the function _GUICtrlMenu_RecentTotal and updated the example with this new addition. I also fixed a pretty huge bug that would cause the UDF to crash, due to me not paying attention! Please see the original post for more details.

If this isn't what you are looking for could you explain more concisely please. Thanks.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted (edited)

$iMenuEntry = 0 - does not work properly.

For example, it was the last 15 files. Set 4 recent file, 11 list entries should be removed.

Items have to be shifted down

_GUICtrlMenu_RecentIsInMenu do inside _GUICtrlMenu_RecentAdd

Edited by AZJIO
Posted (edited)

$iMenuEntry = 0 - does not work properly.

For example, it was the last 15 files. Set 4 recent file, 11 list entries should be removed.

Items have to be shifted down

OK, this has now been fixed. I had to completely re-think my approach to this UDF.

Note: I have removed the $iMenuEntry as I found it pointless to be included.

_GUICtrlMenu_RecentIsInMenu do inside _GUICtrlMenu_RecentAdd

I won't do this for the simple fact that not everyone will use this for files, they could use it for data or something similar and I want to give a lot of control to the end user. Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

  • 2 weeks later...
Posted

I won't do this for the simple fact that not everyone will use this for files, they could use it for data or something similar and I want to give a lot of control to the end user.

I can sort of see your point, but I fail to come up with a situation where you'd want two identical menu entries for a "recent" list.

The other thing that is extremely important IMO is that an item opened either from the recent menu or via another method should be moved to the top of the recent items list, so just not adding if it's already there isn't enough, the item needs to be either added to the top with the bottom item popped off, or moved to the top if it already exists...

I was starting work on code to store and manage a recent files list in the registry when I figured I'd check to see if I was reinventing the wheel, I guess I'll continue as I think I prefer the recent items right in the File menu (like SciTE does it) rather than a sub menu.

By far, the worst four letter word (swear word) out there has to be USER
Posted

xrxca,

Neither can I, but I really don't want to limit the UDF for the user who might as they may use it as a timeline.

I will also have a look at your request in adding it to the top of the list instead.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted (edited)

Updated the UDF by moving the recently added option to the top instead of the bottom. I took your advice xrxca with regards to moving a previously added item to the top if re-selected.

Oh and it wasn't that difficult. In GUICtrlCreateMenuItem set the menu entry to 0.

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted

Thanks for sharing!

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted

Thanks TheSaint.

AZJIO & xrxca,

If you could report whether the additions are what you and/or work then that would be much appreciated.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted

I suppose I could make it a user function.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted

I've updated the UDF by adding _GUICtrlMenu_RecentDelete to the list of user functions. See the original post for more details.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted

I fixed a bug _GUICtrlMenu_RecentTotal when the size was less than the current total. I also updated the example too.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...