Ticket #3742: Place AutoIt shell context menu items inside menu.au3

File Place AutoIt shell context menu items inside menu.au3, 2.6 KB (added by anonymous, 4 years ago)

script file with same content as mentioned in my comment

Line 
1;~ Note: Nothing will be deleted, so it is perfectly safe
2#RequireAdmin
3
4Global $HKCR_AutoItMenu = "HKEY_CLASSES_ROOT\AutoIt3Script\Shell\"
5Global $HKLM_Shell = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\"
6
7; disable the loose context menu items...
8RegWrite($HKCR_AutoItMenu&"Compile", "LegacyDisable", "REG_SZ", "")
9RegWrite($HKCR_AutoItMenu&"CompileX64", "LegacyDisable", "REG_SZ", "")
10RegWrite($HKCR_AutoItMenu&"CompileX86", "LegacyDisable", "REG_SZ", "")
11RegWrite($HKCR_AutoItMenu&"Edit", "LegacyDisable", "REG_SZ", "")
12;~ RegWrite($HKCR_AutoItMenu&"Open", "LegacyDisable", "REG_SZ", "") ; don't want to disable this one, because that will break the ShellOpen of a .au3 file ; same as either Edit or Run action, depending on your personal settings
13RegWrite($HKCR_AutoItMenu&"Run", "LegacyDisable", "REG_SZ", "")
14RegWrite($HKCR_AutoItMenu&"RunX64", "LegacyDisable", "REG_SZ", "")
15RegWrite($HKCR_AutoItMenu&"RunX86", "LegacyDisable", "REG_SZ", "")
16
17; create a new menu...
18RegWrite($HKCR_AutoItMenu&"AutoIt_Menu")
19RegWrite($HKCR_AutoItMenu&"AutoIt_Menu", "ICON", "REG_SZ", "C:\Program Files (x86)\AutoIt3\AutoIt3.exe") ; default file location, check if you installed it somewhere else
20RegWrite($HKCR_AutoItMenu&"AutoIt_Menu", "MUIVerb", "REG_SZ", "Auto-It") ; text to display
21RegWrite($HKCR_AutoItMenu&"AutoIt_Menu", "SubCommands", "REG_SZ", "AutoIt.Compile;AutoIt.Edit;AutoIt.Run") ; create new commands that will be registered later
22
23; register the new commands, copy default values...
24
25RegWrite($HKLM_Shell&"AutoIt.Compile", "", "REG_SZ", "Compile script") ; menu-item text
26; choose the one you want to use:
27$value = RegRead($HKCR_AutoItMenu&"Compile\command", "")
28;~ $value = RegRead($HKCR_AutoItMenu&"CompileX64", "command")
29;~ $value = RegRead($HKCR_AutoItMenu&"CompileX86", "command")
30RegWrite($HKLM_Shell&"AutoIt.Compile\command", "", "REG_SZ", $value)
31
32RegWrite($HKLM_Shell&"AutoIt.Edit", "", "REG_SZ", "Edit script") ; menu-item text
33$value = RegRead($HKCR_AutoItMenu&"Edit\command", "")
34RegWrite($HKLM_Shell&"AutoIt.Edit\command", "", "REG_SZ", $value)
35
36; this one won't be used if you did not disable the default context menu item
37;~ $value = RegRead($HKCR_AutoItMenu&"Open", "command")
38;~ RegWrite($HKLM_Shell&"AutoIt.Open\command", "", "REG_SZ", $value)
39
40RegWrite($HKLM_Shell&"AutoIt.Run", "", "REG_SZ", "Run script") ; menu-item text
41; choose the one you want to use:
42$value = RegRead($HKCR_AutoItMenu&"Run\command", "")
43;~ $value = RegRead($HKCR_AutoItMenu&"RunX64", "command")
44;~ $value = RegRead($HKCR_AutoItMenu&"RunX86", "command")
45RegWrite($HKLM_Shell&"AutoIt.Run\command", "", "REG_SZ", $value)