1 | ;~ Note: Nothing will be deleted, so it is perfectly safe |
---|
2 | #RequireAdmin |
---|
3 | |
---|
4 | Global $HKCR_AutoItMenu = "HKEY_CLASSES_ROOT\AutoIt3Script\Shell\" |
---|
5 | Global $HKLM_Shell = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\" |
---|
6 | |
---|
7 | ; disable the loose context menu items... |
---|
8 | RegWrite($HKCR_AutoItMenu&"Compile", "LegacyDisable", "REG_SZ", "") |
---|
9 | RegWrite($HKCR_AutoItMenu&"CompileX64", "LegacyDisable", "REG_SZ", "") |
---|
10 | RegWrite($HKCR_AutoItMenu&"CompileX86", "LegacyDisable", "REG_SZ", "") |
---|
11 | RegWrite($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 |
---|
13 | RegWrite($HKCR_AutoItMenu&"Run", "LegacyDisable", "REG_SZ", "") |
---|
14 | RegWrite($HKCR_AutoItMenu&"RunX64", "LegacyDisable", "REG_SZ", "") |
---|
15 | RegWrite($HKCR_AutoItMenu&"RunX86", "LegacyDisable", "REG_SZ", "") |
---|
16 | |
---|
17 | ; create a new menu... |
---|
18 | RegWrite($HKCR_AutoItMenu&"AutoIt_Menu") |
---|
19 | RegWrite($HKCR_AutoItMenu&"AutoIt_Menu", "ICON", "REG_SZ", "C:\Program Files (x86)\AutoIt3\AutoIt3.exe") ; default file location, check if you installed it somewhere else |
---|
20 | RegWrite($HKCR_AutoItMenu&"AutoIt_Menu", "MUIVerb", "REG_SZ", "Auto-It") ; text to display |
---|
21 | RegWrite($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 | |
---|
25 | RegWrite($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") |
---|
30 | RegWrite($HKLM_Shell&"AutoIt.Compile\command", "", "REG_SZ", $value) |
---|
31 | |
---|
32 | RegWrite($HKLM_Shell&"AutoIt.Edit", "", "REG_SZ", "Edit script") ; menu-item text |
---|
33 | $value = RegRead($HKCR_AutoItMenu&"Edit\command", "") |
---|
34 | RegWrite($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 | |
---|
40 | RegWrite($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") |
---|
45 | RegWrite($HKLM_Shell&"AutoIt.Run\command", "", "REG_SZ", $value) |
---|