The purpose of this script is to create/modify menus in a fly
It seems too big, but almost half of the lines are GUI definitions.
If you decide to give it a try:
This script,and the menus generated by it, were not made to stay running all the time, just set a hotkey
to call the scripts when needed.
First you must use the script to generate a specially formatted menu script.
you can do it this way:
Open an explorer window and select one or more files/folders and hit the hotkey to launch the script.
The script will copy the files to clipboard to retrieve their paths later ,then it will show a GUI, in which
you must click the "new menu" radiobox ,fill a name in the combobox "main menu" and choose the modifiers
keys if you want(if not, there is a default key setting) then hit the button "submit".The new menu will
appear.The new menu script will be saved in A_ScriptDir.
Or you can just run this script with no files selected and create a new menu,then
the only menu item will be "click to add item"...just click it.
The generated script can be edited directly from menu:
LeftShift+click an item to add new items below the clicked one.
RightShift+click an item to remove it
LeftWin+click --add a submenu
RightWin+click a submenu item to remove the whole submenu
LeftControl+click--add a separator below the clicked item
RightControl+click--remove the separator below the clicked item
click will launch item off course and you can change the modifiers keys using the GUI
Or from GUI.I wrote some "tips" inside GUI to explain its functions.
SetWorkingDir, %A_ScriptDir% ?menu_items = `/*`nmain_menu|Click to Add Item|temp_item`nmain_menu|last_item`n*/`n ?menu_mount = Menu, main_menu, Add, •TITLE`nMenu, main_menu, Add`nLoop, Read, `%A_ScriptFullPath`%`n{`n If A_LoopReadLine = ``/`*`n Continue`n IfInString, A_LoopReadLine, last_item`n Continue`n If A_LoopReadLine = *`/`n Break`n ?items = `%?items`%`%A_LoopReadLine`%``n`n StringSplit, ?line, A_LoopReadLine, |`n If ?line2 = separator`n Menu, `%?line1`%, Add`n Else If ?line3 = sm`n Menu, `%?line4`%, Add, `%?line2`%, :`%?line1`%`n Else`n Menu, `%?line1`%, Add, `%?line2`%, launch`n}`nMenu, main_menu, show`nReturn`n`n•TITLE:`n`nlaunch:`nGetKeyState, ?add_item, `%?key_add_item`%, P`nGetKeyState, ?add_sub, `%?key_add_submenu`%, P`nGetKeyState, ?add_sep, `%?key_add_separator`%, P `n ?combined = If ?add_item = D`n{`n GetKeyState, ?rem_item, `%?key_rem_item`%`n If ?rem_item = D`n {`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Remove_Item`n Run, %A_ScriptName%`n }`n Else`n {`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Insert_Item`n Run, %A_ScriptName%`n }`n Return`n}`nIf ?add_sub = D`n{`n GetKeyState, ?rem_sub, `%?key_rem_submenu`%`n If ?rem_sub = D`n {`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Remove_Submenu`n Run, %A_ScriptName%`n }`n Else`n {`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Insert_Submenu`n Run, %A_ScriptName%`n }`n Return`n}`nIf ?add_sep = D`n{`n GetKeyState, ?rem_sep, `%?key_rem_separator`%`n If ?rem_sep = D`n {`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Remove_Separator`n Run, %A_ScriptName%`n }`n Else`n {`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Insert_Separator`n Run, %A_ScriptName%`n }`n Return`n}`n ?single = GetKeyState, ?rem_item, `%?key_rem_item`%, P`nGetKeyState, ?rem_sub, `%?key_rem_submenu`%, P `nGetKeyState, ?rem_sep, `%?key_rem_separator`%, P `nIf ?add_item = D`n{`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Insert_Item`n Run, %A_ScriptName%`n Return`n}`nIf ?rem_item = D`n{`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Remove_Item`n Run, %A_ScriptName%`n Return`n}`nIf ?add_sub = D`n{`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Insert_Submenu`n Run, %A_ScriptName%`n Return`n}`nIf ?rem_sub = D`n{`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Remove_Submenu`n Run, %A_ScriptName%`n Return`n}`nIf ?add_sep = D`n{`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Insert_Separator`n Run, %A_ScriptName%`n Return`n}`nIf ?rem_sep = D`n{`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Remove_Separator`n Run, %A_ScriptName%`n Return`n}`n ?common = Else`n{`n If A_ThisMenuItem = Click to Add Item`n {`n Clipboard =`n Clipboard = `%A_ScriptFullPath`%|`%A_ThisMenu`%|`%A_ThisMenuItem`%|Insert_Item`n Run, %A_ScriptName%`n Return`n }`n Loop, Parse, ?items, ``n`n {`n IfInString, A_LoopField, `%A_ThisMenu`%|`%A_ThisMenuItem`%`n {`n StringSplit, ?line, A_LoopField, |`n Run, `%?line3`%`n Break`n }`n }`n Return`n}`n DriveGet, ?alldrives, list ?drives = Loop, parse, ?alldrives { ?drives = %?drives%%A_LoopField%:\, } StringTrimRight, ?drives, ?drives, 1 If Clipboard contains Insert_Item,Insert_Separator,Insert_Submenu,Remove_Item,Remove_Separator,Remove_Submenu { SetCapsLockState, Off StringSplit, ?Qmenu, Clipboard, | Clipboard = If ?Qmenu4 = Insert_Separator { Loop, Read, %?Qmenu1% { IfNotInString, A_LoopReadLine, %?Qmenu2%|%?Qmenu3% ?write = %?write%%A_LoopReadLine%`n Else ?write = %?write%%A_LoopReadLine%`n%?Qmenu2%|separator|%?Qmenu2%`n } Gosub, rebuilding ExitApp } If ?Qmenu4 = Remove_Item { Loop, Read, %?Qmenu1% { IfNotInString, A_LoopReadLine, %?Qmenu2%|%?Qmenu3% ?write = %?write%%A_LoopReadLine%`n Else Continue } Gosub, rebuilding ExitApp } If ?Qmenu4 = Remove_Submenu { Loop, Read, %?Qmenu1% { If ?Qmenu2 = main_menu { MsgBox, 16, , Warning. You cannot remove the main menu!!! ExitApp } IfNotInString, A_LoopReadLine, %?Qmenu2% ?write = %?write%%A_LoopReadLine%`n Else Continue } Gosub, rebuilding ExitApp } If ?Qmenu4 = Remove_Separator { ?RemSep = n Loop, Read, %?Qmenu1% { If ?RemSep = y { IfInString, A_LoopReadLine, %?Qmenu2%|separator ?RemSep = n Continue } IfInString, A_LoopReadLine, %?Qmenu2%|%?Qmenu3% { ?write = %?write%%A_LoopReadLine%`n ?RemSep = y } Else ?write = %?write%%A_LoopReadLine%`n } Gosub, rebuilding ExitApp } If ?Qmenu4 = Insert_Item { Gui, 2:Add, Button, Default x10 y50 w80 h30, &1-File(s) Gui, 2:Add, Button, x110 y50 w80 h30, &2-Folder Gui, 2:Add, Button, x210 y50 w80 h30, Cancel Gui, 2:Font, s10 w600 Gui, 2:Add, Text, x40 y10 w220 h30, Browse for files or folders? Gui, 2:Show, h90 w300, Choose files Return 2Button1-File(s): Gui, 2:Destroy FileSelectFile, ?path, 7,, Select files., All Files (*.*) Gosub, Insert_Item ExitApp 2Button2-Folder: Gui, 2:Destroy FileSelectFolder, ?path, , 3,Slect folder. Gosub, Insert_Item ExitApp 2ButtonCancel: 2GuiEscape: 2GuiClose: MsgBox, 64, , Cancelling., 1 ExitApp } If ?Qmenu4 = Insert_Submenu { Gosub, Insert_Submenu ExitApp } } Else { WinGet, ?winID, ID, A WinGetClass, ?winClass, ahk_id %?winID% If ?winClass in CabinetWClass,ExploreWClass { Clipboard = Sleep, 100 Send, ^c ClipWait, 1 StringReplace, ?clip, Clipboard, `r`n, `n, All Clipboard = Loop, Parse, ?clip, `n { If A_Index = 1 { If A_LoopField in %?drives% { ?path = %A_LoopField%`n ?create = main_menu|%A_LoopField%|%A_LoopField%`n ?is_drive = yes } Else { SplitPath, A_LoopField, ?filename, ?dir ?path = %?dir%`n%?filename%`n ?create = main_menu|%?filename%|%A_LoopField%`n } } Else { If A_LoopField in %?drives% { ?path = %?path%%A_LoopField%`n ?create = main_menu|%A_LoopField%|%A_LoopField%`n ?is_drive = yes } Else { StringSplit, ?file, A_LoopField, \ StringTrimLeft, ?filename, ?file%?file0%, 0 ?path = %?path%%?filename%`n ?create = %?create%main_menu|%?filename%|%A_LoopField%`n } } } } ?tipEMM = Choose a menu file listed in the combobox "Main menu".`nIf there is no menu click the radiobox "New menu" .To add items to a submenu inside the selected Main menu check the option "Existing submenu",for a new submenu check "New submenu".You can change the keys settings for any menu going to tab "Key settings" after selecting a menu in the combobox "Main menu". ?tipESM = Select a submenu listed in the combobox "Submenu".`nIf there is no submenu listed you can create one checking "New submenu" ?tipNMM = Enter a name for your new menu.Just type the word you want to be the menu title,the same word is also used as filename, the script will be saved with the prefix "«" ,".ahk" extension and "_" replacing spaces.`nEg:DOCUMENTS ?tipNSM = Enter a name for your new submenu.`nYou can add a submenu to the Main menu selecting "top level" in the combobox "Submenu list" or to an existent submenu selecting it in the same combobox.If there is no existent submenu the new submenu will be added to the top level of the main menu. ?tipKEY = Choose the keys you want.Most keys ( eg :A-Z and 1-0 ) may launch an menu item, so be careful.`nOption "Single keys" : this option does not need explanations.`nOption "Combined keys" : choose a key to add items and to remove items use the same(MUST be the same) key together with another that will be the modifier key.You must enter the key names using "+" as delimiter.`n`neg: add submenu-- Rcontrol , remove submenu--Rcontrol+Rwin`n add separator--Lcontrol , remove separator--Lcontrol+Lwin ?tipREAD = This script , and the menus generated by it , were not made to stay running all the time, just set a hotkey to call the scripts when needed.`n`nFirst step : You must use the script to generate a specially formatted menu file.`n`nTo create a new menu :`nOpen an explorer window and select one or more files/folders and hit the hotkey to launch the script.`nThe script will copy the files to clipboard and retrieve their paths later , then it will show a GUI , in which you must click the "New menu" radiobox , fill a name in the combobox "main menu" and choose the modifiers keys if you want(if not the default key setting will be used) then hit the button "submit".`nThe new menu will be launched.All new scripts are saved in "WorkingDir".`nYou can also run this script with no files selected , in this case the only menu item will be "click to add item" , you can click it to...add items)`nThe generated menu can be edited in several ways.`n`nDirectly from menu :`nLeftShift+click an item to add new items below the clicked one.`nRightShift+click an item to remove it`nLeftWin+click --add a submenu`nRightWin+click a submenu item to remove the whole submenu`nLeftControl+click--add a separator below the clicked item`nRightControl+click--remove the separator below the clicked item`nclick will... launch item (You can change the modifiers keys using the GUI)`n`nFrom GUI :`nwell,you can click everywhere to see what happens...`njust be carefull with the button "submit". ?menulist = Loop, «*.ahk { ?menulist = %?menulist%%A_LoopFileName%| } Gui, Add, Tab, x2 y5 w413 h280, Menu Definition||Key settings|--------READ-ME FIRST------- Gui, Font, s10 Gui, Add, Edit, vTip xp+8 yp+30 w395 h90, %?tipEMM% Gui, font Gui, Add, GroupBox, vGr1 xp yp+100 w230 h140, Define wich menu Gui, Add, Text, vMaintext xp+15 yp+15, Main menu Gui, Add, ComboBox, gMain vMain xp yp+15 w200, Select one||%?menulist% Gui, Add, Text, Disabled vSubtext xp yp+25, Submenu list Gui, Add, ComboBox, Disabled vSub xp yp+15 w200, Select one|| Gui, Add, Text, Disabled vSub2text xp yp+25, New submenu Gui, Add, ComboBox, Disabled vSub2 xp yp+15 w200, Enter new submenu name|| Gui, Add, GroupBox, vGr2 x250 y135 w155 h100, Add files to... Gui, Add, Radio, Checked gRadio1 vRadio1 xp+15 yp+20, Existing menu Gui, Add, Radio, gRadio2 vRadio2 xp yp+20, New menu Gui, Add, Checkbox, Disabled gCheck1 vCheck1 xp yp+20, Existing submenu Gui, Add, Checkbox, gCheck2 vCheck2 xp yp+20, New submenu Gui, Add, Button, xp-15 yp+30 w70 h30, Cancel Gui, Add, Button, Default vBsbmt xp+80 yp w75 h30, Submit Gui, Tab, 2 Gui, Add, GroupBox, vGr3 x10 y175 w395 h100, Modifiers keys Gui, Add, Text, vTe1 xp+15 yp+15, Add item Gui, Add, Edit, vEd1 xp yp+15 w112 h20, Lshift Gui, Add, Text, vTe2 xp yp+25, Remove item Gui, Add, Edit, vEd2 xp yp+15 w112 h20, Rshift Gui, Add, Text, vTe3 xp+127 yp-55, Add submenu Gui, Add, Edit, vEd3 xp yp+15 w112 h20, Lwin Gui, Add, Text, vTe4 xp yp+25, Remove submenu Gui, Add, Edit, vEd4 xp yp+15 w112 h20, Rwin Gui, Add, Text, vTe5 xp+127 yp-55, Add separator Gui, Add, Edit, vEd5 xp yp+15 w112 h20, Lcontrol Gui, Add, Text, vTe6 xp yp+25, Remove separator Gui, Add, Edit, vEd6 xp yp+15 w112 h20, Rcontrol Gui, Add, Radio, Checked gRadio3 vRadio3 x20 y155, Single keys Gui, Add, Radio, gRadio4 vRadio4 xp+125 y155, Combined keys Gui, Add, Button, xp+103 yp-4, Change-selected-menu-hotkeys Gui, Font, s10 Gui, Add, Edit, vTip2 x10 y35 w395 h110, %?tipKEY% Gui, Tab, 3 Gui, Add, Edit, x10 y35 w395 h235, %?tipREAD% Gui,Font Gui, Show, w415, Menu tool Return GuiEscape: GuiClose: ButtonCancel: MsgBox, 64, ,Cancelling., 1 ExitApp Main: GuiControlGet, ?ver, , Main ?num = 1 ?subnum = ?submenulist = Loop, Read, %?ver% { If A_LoopReadLine = */ Break IfNotInString, A_LoopReadLine, |sm| Continue Else { StringSplit, ?submenu, A_LoopReadLine, | If ?num = 1 { ?subnum = %A_LoopReadLine%`n ?submenulist = |%?submenu2%|| ?num ++ } Else { ?subnum = %?subnum%%A_LoopReadLine% ?submenulist = %?submenulist%%?submenu2%| ?num ++ } } } If ?submenulist = { GuiControl, , Sub, |there is no submenu|| GuiControl, Disable, Sub GuiControl, Disable, Subtext GuiControl, Disable, Check1 } Else { GuiControl, Enable, Sub GuiControl, Enable, Subtext GuiControl, Enable, Check1 GuiControl, , Sub, %?submenulist% } Return Check1: GuiControlGet, ?chk1, , Check1 GuiControlGet, ?rad1, , Radio1 If ?chk1 = 1 { GuiControl, Enable, Sub GuiControl, Enable, Subtext GuiControl, , Tip, %?tipESM% GuiControl, , Sub, %?submenulist%top level } If ?chk1 = 0 { GuiControl, Disable, Sub GuiControl, Disable, Subtext If ?rad1 = 1 GuiControl, , Tip, %?tipEMM% Else GuiControl, , Tip, %?tipNMM% } Return Check2: GuiControlGet, ?chk2, , Check2 GuiControlGet, ?rad1, , Radio1 If ?chk2 = 1 { GuiControl, Enable, Sub2 GuiControl, Enable, Sub2text GuiControl, , Tip, %?tipNSM% } If ?chk2 = 0 { GuiControl, Disable, Sub2 GuiControl, Disable, Sub2text If ?rad1 = 1 GuiControl, , Tip, %?tipEMM% Else GuiControl, , Tip, %?tipNMM% } Return Radio1: GuiControl, Enable, Check1 GuiControl, Enable, Check2 GuiControl, , Main, |Select one||%?menulist% GuiControl, , Tip, %?tipEMM% Return Radio2: GuiControl, , Check1, 0 GuiControl, , Check2, 0 GuiControl, Disable, Sub GuiControl, Disable, Sub2 GuiControl, Disable, Check1 GuiControl, Disable, Check2 GuiControl, , Tip, %?tipNMM% GuiControl, , Main, |Enter menu name|| Return Radio3: GuiControl, , Ed1, Lshift GuiControl, , Ed2, Rshift GuiControl, , Ed3, Lwin GuiControl, , Ed4, Rwin GuiControl, , Ed5, Lcontrol GuiControl, , Ed6, Rcontrol Return Radio4: GuiControl, , Ed1, Lshift GuiControl, , Ed2, Lshift+Lwin GuiControl, , Ed3, capslock GuiControl, , Ed4, capslock+Lwin GuiControl, , Ed5, Lcontrol GuiControl, , Ed6, Lcontrol+Lwin Return ButtonChange-selected-menu-hotkeys: Gui, Submit, NoHide If Radio4 = 1 { StringSplit, Ed2rem, Ed2, + Ed2 = %Ed2rem2% StringSplit, Ed4rem, Ed4, + Ed4 = %Ed4rem2% StringSplit, Ed6rem, Ed6, + Ed6 = %Ed6rem2% } If Main contains Select one,Enter menu name { MsgBox, No menu script selected!! Return } ?new_keys = ?key_add_item = %Ed1%`n?key_rem_item = %Ed2%`n?key_add_submenu = %Ed3%`n?key_rem_submenu = %Ed4%`n?key_add_separator = %Ed5%`n?key_rem_separator = %Ed6%`n MsgBox, 33, Are you sure?, File to edit:`n%Main%`n`nNew keys:`n%?new_keys% IfMsgBox, Cancel { MsgBox, 64, ,Cancelling., 1 Return } Gosub, Change_keys Return ButtonSubmit: GuiControlGet, ?verver, , Main If ?verver contains Select one,Enter menu name { MsgBox, No main menu selected!! Return } Gui, Submit ?via_gui = yes ?Qmenu1 = %Main% ?Qmenu3 = last_item If Radio1 = 1 { If Check2 = 0 { If Check1 = 0 ?Qmenu2 = main_menu Else If Check1 = 1 { Loop, Parse, ?subnum, `n { IfInString, A_LoopField, %Sub% { StringSplit, ?Qsubmenu, A_LoopField, | ?Qmenu2 = %?Qsubmenu1% } } } Gosub, Insert_Item ExitApp } Else If Check2 = 1 { ?Qmenu2 = sub_menu%?num% If Check1 = 0 ?upper_menu = main_menu Else { If Sub contains no submenu,top level,Select one ?upper_menu = main_menu Else Loop, Parse, ?subnum, `n { IfInString, A_LoopField, %Sub% { StringSplit, ?Qsubmenu, A_LoopField, | ?upper_menu = %?Qsubmenu1% } } } Gosub, Insert_Submenu ExitApp } } Else If Radio2 = 1 { ?new_menu = yes ?Qmenu2 = main_menu ?Qmenu3 = null Gosub, create_menu If ?try_again = yes { Gui, Show Return } Else ExitApp } } Insert_Item: If ?path = { MsgBox, 64, ,Cancelling. No items to add., 1 ExitApp } Gosub, define_items Loop, Read, %?Qmenu1% { IfInString, A_LoopReadLine, %?Qmenu2%|%?Qmenu3% { If ?Qmenu3 = Click to Add Item ?write = %?write%%?items% Else If ?Qmenu3 = last_item ?write = %?write%%?items%%A_LoopReadLine%`n Else ?write = %?write%%A_LoopReadLine%`n%?items% } Else ?write = %?write%%A_LoopReadLine%`n } Gosub, rebuilding Return Insert_Submenu: If ?via_gui <> yes InputBox, ?sub_name, New submenu, Enter a name for your new submenu., ,300, 130 If ErrorLevel <> 0 { MsgBox, 64, ,Cancelling., 1 ExitApp } Gosub, define_items ?num = 1 Loop, Read, %?Qmenu1% { IfInString, A_LoopReadLine, sub_menu%?num% ?num++ If A_LoopReadLine = */ { If ?via_gui <> yes ?write = %?write%%?Qmenu2%|separator|sub_menu%?num%`nsub_menu%?num%|Click to Add Item|temp_item`nsub_menu%?num%|last_item`nsub_menu%?num%|%?sub_name%|sm|%?Qmenu2%`n%A_LoopReadLine%`n Else { If ?items = ?write = %?write%%?upper_menu%|separator|sub_menu%?num%`nsub_menu%?num%|Click to Add Item|temp_item`nsub_menu%?num%|last_item`nsub_menu%?num%|%Sub2%|sm|%?upper_menu%`n%A_LoopReadLine%`n Else ?write = %?write%%?upper_menu%|separator|sub_menu%?num%`n%?items%sub_menu%?num%|last_item`nsub_menu%?num%|%Sub2%|sm|%?upper_menu%`n%A_LoopReadLine%`n } } Else ?write = %?write%%A_LoopReadLine%`n } Gosub, rebuilding Return create_menu: ?settings = SetWorkingDir, %A_ScriptDir%`n?items =`n?key_add_item = %Ed1%`n?key_rem_item = %Ed2%`n?key_add_submenu = %Ed3%`n?key_rem_submenu = %Ed4%`n?key_add_separator = %Ed5%`n?key_rem_separator = %Ed6%`n StringReplace, Main, Main, %A_SPACE%, _, All IfExist, «%Main%.ahk { MsgBox, 49,Paused...,File «%Main%.ahk already exists.`nRetry?. IfMsgBox, Cancel ExitApp IfMsgBox, Ok ?try_again = yes Return } Loop, Parse, ?menu_items, `n { IfInString, A_LoopField, Click to Add Item { If ?create = ?write = %?write%%A_LoopField%`n Else ?write = %?write%%?create% } Else ?write = %?write%%A_LoopField%`n } ?write = %?write%%?settings% StringReplace, ?menu_mount, ?menu_mount, •TITLE, %Main%, All ?write = %?write%%?menu_mount% If Radio3 = 1 ?write = %?write%%?single% Else ?write = %?write%%?combined% ?write = %?write%%?common% FileAppend, %?write%, «%Main%.ahk Run, «%Main%.ahk Return Change_keys: StringTrimLeft, ?menu_title, Main, 1 StringTrimRight, ?menu_title, ?menu_title, 4 ?change = yes ?write = Loop, Read, %Main% { IfInString, A_LoopReadLine, ?key_ Continue Else IfInString, A_LoopReadLine, Add, %?menu_title% { ?write = %?write%%?new_keys% Break } Else ?write = %?write%%A_LoopReadLine%`n } StringReplace, ?menu_mount, ?menu_mount, •TITLE, %?menu_title%, All ?write = %?write%%?menu_mount% If Radio4 = 1 ?write = %?write%%?combined% Else ?write = %?write%%?single% ?write = %?write%%?common% FileDelete, %Main% FileAppend, %?write%, %Main% Return define_items: IfInString, ?path, `n { ?teste = multi StringTrimRight, ?path, ?path, 1 } IfNotInString, ?path, `n ?teste = mono ?items = Loop, Parse, ?path, `n { If A_Index = 1 { If ?teste = multi If ?is_drive = yes ?items = %?Qmenu2%|%A_LoopField%|%A_LoopField%`n Else ?dir = %A_LoopField%\ If ?teste = mono { IfInString, A_LoopField, %?Qmenu3% { MsgBox, 16, Ignoring Item, Item: "%A_LoopField%"`nthis item already exists in this menu., 2 ExitApp } Else { SplitPath, A_LoopField, ?filename If ?filename = ?is_drive = yes If ?is_drive = yes ?items = %?Qmenu2%|%A_LoopField%|%A_LoopField%`n Else ?items = %?Qmenu2%|%?filename%|%A_LoopField%`n Break } } } Else { IfInString, A_LoopField, %?Qmenu3% { MsgBox, 16, Ignoring Item, Item: "%A_LoopField%"`nthis item already exists in this menu., 2 Continue } Else If ?is_drive = yes ?items = %?items%%?Qmenu2%|%A_LoopField%|%A_LoopField%`n Else ?items = %?items%%?Qmenu2%|%A_LoopField%|%?dir%%A_LoopField%`n } } Return rebuilding: FileDelete, %?Qmenu1% FileAppend, %?write%, %?Qmenu1% Run, %?Qmenu1% ReturnSorry for my poor English :oops: I hope you understand what I wrote,
the portuguese version is much clearer...