diff --git a/ReadMe.md b/ReadMe.md index 394ad60..52ce512 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,7 +1,7 @@ -# AHK Command Picker Description +# AHK Command Picker description -An AutoHotkey (AHK) script that allows you to easily call AHK functions and run other AHK scripts. -(Requires [AutoHotkey_L][AutoHotkeyWebsiteUrl]). +An [AutoHotkey][AutoHotkeyWebsiteUrl] (AHK) script that allows you to easily call AHK functions and run other AHK scripts. +(Requires [AutoHotkey v1.1][AutoHotkeyDownloadPageUrl] to be installed). Instead of having to remember what hotkey maps to each of your AHK scripts (as you could have hundreds), this displays a list of Commands in a light-weight GUI that allows you to quickly and easily run your scripts. Simply type part of the command name and hit enter to run your script. @@ -9,20 +9,37 @@ You can also provide parameters to your commands, allowing you to change the fun For more reasons to use this with your AHK scripts, see [Why Use AHK Command Picker][WhyUseAhkCommandPickerPage]. -## 🚀 How To Use AHK Command Picker +## 🚀 How to use AHK Command Picker Start by [downloading the latest release][DownloadLatestReleaseUrl]. To launch AHK Command Picker run the `AHKCommandPicker.ahk` script. Press the `Caps Lock` key to bring up the AHK Command Picker GUI. -From there just type the name of the command that you want to run and hit enter to run it. -You can still toggle Caps Lock on and off by pressing `Shift`+`Caps Lock`. +From there, just type the name of the Command that you want to run and hit Enter to run it. -To add your own commands to AHK Command Picker, see [the documentation][DocumentationPage]. +Note: You can still toggle Caps Lock on and off by pressing `Shift`+`Caps Lock`. + +### ✍ Adding your own Commands, hotkeys, and hotstrings + +AHK Command Picker comes with many Commands out of the box, but the real power comes from adding your own Commands, hotkeys, and hotstrings. + +- `UserCommands\MyCommands.ahk`: Add your own Commands here. +- `UserCommands\MyHotkeys.ahk`: Add your own hotkeys and hotstrings here. + +You can use AHK Command Picker to open these files for editing by running the `EditMyCommands` and `EditMyHotkeys` Commands. +After you have modified a file, run the `ReloadAHKScript` Command to apply your changes. + +For more information, see [the documentation][DocumentationPage]. + +### Additional tidbits You will likely want to [have AHKCommandPicker start automatically when you log into Windows][AutomaticallyStartAtLogin]. -## 🖼 Screen Shots +### Upgrading versions + +If you are upgrading from v1 to v2, see [the migration guide][MigrateFromV1ToV2Page]. + +## 🖼 Screenshots All commands: @@ -62,7 +79,7 @@ See [the Contributing page](docs/Contributing.md) for more details. ## 📃 Changelog -See what's changed in the application over time by viewing [the changelog](docs/Changelog.md). +See what's changed in the application over time by viewing [the Changelog](docs/Changelog.md). ## 💳 Donate @@ -71,7 +88,8 @@ Buy me a pastry 🍰 for providing this script open source and for free 🙂 [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D7PW6YBWNDLXW) -[AutoHotkeyWebsiteUrl]: http://www.autohotkey.com +[AutoHotkeyWebsiteUrl]: https://www.autohotkey.com +[AutoHotkeyDownloadPageUrl]: https://www.autohotkey.com/download/ [AhkCommandPickerInUnder2MinutesYouTubeUrl]: https://www.youtube.com/watch?v=gevnQAwYLAg,type=youtube [AhkCommandPickerInUnder2MinutesYouTubeImageUrl]: https://img.youtube.com/vi/gevnQAwYLAg/0.jpg @@ -87,6 +105,7 @@ Buy me a pastry 🍰 for providing this script open source and for free 🙂 [WhyUseAhkCommandPickerPage]: docs/WhyUseAhkCommandPicker.md [DocumentationPage]: docs/DocumentationHomePage.md [AutomaticallyStartAtLogin]: docs/TipsAndTricks.md#have-ahk-command-picker-automatically-start-when-you-log-into-windows +[MigrateFromV1ToV2Page]: docs/MigrateFromV1ToV2.md [AllCommandsImage]: docs/Images/AHKCommandPicker-AllCommands.png [FilteredCommandsImage]: docs/Images/AHKCommandPicker-FilteredCommands.png diff --git a/docs/AddingMultipleCommandsAtOnce.md b/docs/AddingMultipleCommandsAtOnce.md index 460bbc7..5ede049 100644 --- a/docs/AddingMultipleCommandsAtOnce.md +++ b/docs/AddingMultipleCommandsAtOnce.md @@ -2,7 +2,8 @@ This is an alternative to [Using Preset Parameters][UsingCommandsWithParametersPage] -So even though you can have your commands show a preset list of parameters, you may instead want each command-parameter combination show up as its own command. So essentially instead of getting this with using preset parameters: +So even though you can have your commands show a preset list of parameters, you may instead want each command-parameter combination show up as its own command. +So essentially instead of getting this with using preset parameters: ![Using Preset Parameters][UsingPresetParametersImage] @@ -12,7 +13,8 @@ You would prefer to have this instead: Where each command-parameter combination shows up in the base list of commands; that is, the user does not have to type in some other command plus a comma to see the list of that command's preset parameters. -Maybe you don't like having to press the comma (,) key after typing the command name, or maybe you just prefer to see ALL of your options without hiding any of them as parameters. Of course we could accomplish this by adding a command for each command-parameter combination one by one, like so: +Maybe you don't like having to press the comma (`,`) key after typing the command name, or maybe you just prefer to see ALL of your options without hiding any of them as parameters. +Of course we could accomplish this by adding a command for each command-parameter combination one by one, like so: ```AutoHotkey AddCommand("ExploreCDrive", "Explore C:\") @@ -32,7 +34,8 @@ ExploreProgramFiles() But as you can see, even on this very basic and simple operation, there is a lot of very similar code and code duplication happening, and it would take a while to write all of it out. -To help alleviate this tedious repetition you can use the `AddCommands()` or `AddCommandsWithPrePostfix()` functions. Here are their prototypes: +To help alleviate this tedious repetition you can use the `AddCommands()` or `AddCommandsWithPrePostfix()` functions. +Here are their prototypes: ```AutoHotkey AddCommands(functionName, descriptionOfWhatFunctionDoes = "", commandList = "") @@ -40,11 +43,14 @@ AddCommands(functionName, descriptionOfWhatFunctionDoes = "", commandList = "") AddCommandsWithPrePostfix(functionName, descriptionOfWhatFunctionDoes = "", commandList = "", prefix = "", postfix = "") ``` -These both call the `AddNamedCommand()` function for each command in the commandList. Each command in the list will call the given functionName, supplying the command's specific value as a parameter to the function. +These both call the `AddNamedCommand()` function for each command in the commandList. +Each command in the list will call the given functionName, supplying the command's specific value as a parameter to the function. -* `commandList` = The commands to show up in the picker that will call the function, separated with a comma. Separate the command name that appears in the picker and the value to pass to the function with a pipe character (|). If no pipe character is provided, the given value will be both shown in the picker and passed to the function. -* `prefix` = The prefix to add to the beginning of all the command names in the commandList. -* `postfix` = The postfix to add to the end of all the command names in the commandList. +- `commandList`: The commands to show up in the picker that will call the function, separated with a comma. + Separate the command name that appears in the picker and the value to pass to the function with a pipe character (`|`). + If no pipe character is provided, the given value will be both shown in the picker and passed to the function. +- `prefix`: The prefix to add to the beginning of all the command names in the commandList. +- `postfix`: The postfix to add to the end of all the command names in the commandList. So to use the `AddCommands()` function to get the same type of look that you would get from manually adding each command individually you could do: @@ -66,29 +72,41 @@ ExploreDirectory(directoriesToOpen = "") } ``` -Here we used the same technique as in the [Preset Parameters][UsingCommandsWithParametersPage] documentation to build a comma-separated list of directories to add. We also used the exact same `ExploreDirectory()` function. The only thing different here is that we used the `AddCommands()` function, which will essentially loop through each command in the commandList (i.e. the directories variable above) and call `AddCommand()` for you, passing in "ExploreDirectory" as the function to call and "Open directory" as the user-friendly description. +Here we used the same technique as in the [Preset Parameters][UsingCommandsWithParametersPage] documentation to build a comma-separated list of directories to add. +We also used the exact same _ExploreDirectory()_ function. +The only thing different here is that we used the `AddCommands()` function, which will essentially loop through each command in the commandList (i.e. the _directories_ variable above) and call `AddCommand()` for you, passing in "ExploreDirectory" as the function to call and "Open directory" as the user-friendly description. One more time, this is what the result might look like if we added many more directories and had some other commands defined: ![Using Many Commands][UsingManyCommandsImage] -Notice that you no longer need to type "ExploreDirectory," to see the list of directories to explore; they are listed along-side all of the other commands. For example, you could now just type "C Drive" to open `C:\`. +Notice that you no longer need to type "ExploreDirectory," to see the list of directories to explore; they are listed along-side all of the other commands. +For example, you could now just type "C Drive" to open _C:\\_. ## Prepend Command Names -So that's nice, but what if you want to group all of these related commands that essentially do the same operation. That's what the `AddCommandsWithPrePostfix()` function is for. To prepend all of our "ExploreDirectory" commands with the letter "e", we could have used: +So that's nice, but what if you want to group all of these related commands that essentially do the same operation. +That's what the `AddCommandsWithPrePostfix()` function is for. +To prepend all of our "ExploreDirectory" commands with the letter "e", we could have used: ```AutoHotkey AddCommandsWithPrePostfix("ExploreDirectory", "Open directory", directories, "e") ``` -Here we specified that all of these commands should have a prefix of "e" (and we omitted the postfix parameter, which is essentially the same as saying don't add a postfix). So in the GUI, this is what our list might now look like: +Here we specified that all of these commands should have a prefix of "e" (and we omitted the postfix parameter, which is essentially the same as saying don't add a postfix). +So in the GUI, this is what our list might now look like: ![Using many commands with prefix][UsingManyCommandsWithPrefixImage] -Note the "e" at the beginning of our commands that call ExploreDirectory(). +Note the "e" at the beginning of our commands that call _ExploreDirectory()_. + +## Next Steps + +Proceed to the [Tips and Tricks][TipsAndTricksPage] page, or return to [the table of contents][DocumentationTableOfContents]. +[DocumentationTableOfContents]: DocumentationHomePage.md +[TipsAndTricksPage]: TipsAndTricks.md [UsingCommandsWithParametersPage]: UsingCommandsWithParameters.md [UsingPresetParametersImage]: Images/UsingPresetParameters.png [UsingManyCommandsImage]: Images/UsingManyCommands.png diff --git a/docs/BestPractices.md b/docs/BestPractices.md index b20623f..7cc9fa3 100644 --- a/docs/BestPractices.md +++ b/docs/BestPractices.md @@ -1,7 +1,30 @@ # Best Practices -* Do not edit the `AhkCommandPicker.ahk`, `CommandScriptsToInclude.ahk`, `Commands\DefaultCommands.ahk`, and `Commands\DefaultHotkeys.ahk` files, as they may be updated when new versions of AHK Command Picker are released, so you may run into conflicts (or lose your customizations) when updating these files. +## Use multiple files to organize your commands -* While you could dump all of your commands into the `Commands\MyCommands.ahk` file, that file may soon become large and unwieldy. You will likely want to create some new .ahk files in the Commands folder and `#Include` the new files in the `MyCommands.ahk` file. Maybe try to keep them logically separated, such as putting commands you typically use at work in a `Commands\Work.ahk` file, and home ones in `Commands\Home.ahk`. However you want to organize them is up to you. +While you could dump all of your commands into the `UserCommands\MyCommands.ahk` file, that file may soon become large and unwieldy. +You may instead want to create new .ahk files in the `UserCommands` folder and `#Include` them from the `UserCommands\MyCommands.ahk` file. +For example, put commands you typically use at work in a `UserCommands\Work.ahk` file, and home ones in `UserCommands\Home.ahk`. +However you want to organize them is up to you, but new files should always be created in the `UserCommands` directory. -* One important thing to note is that whenever a `hotkey` is encountered, any commands that may have been defined after it will not be processed and added to the AHK Command Picker's list of commands. So it is important that all hotkeys and hotstrings be declared **AFTER** all commands. This is why it is crucial that hotkeys and hotstrings are defined from the MyHotkeys.ahk file. +## Do not add Hotkeys int the Command files + +One important thing to note is that whenever a `hotkey` (e.g. _^j::_) or `hotstring` (e.g. _::btw::by the way_) is encountered, any commands that may have been defined after it will not be processed and added to the AHK Command Picker's list of commands. +So it is important that all hotkeys and hotstrings be declared **AFTER** all commands. +**To do this, ensure that hotkeys and hotstrings are defined or `#Include`d in the `UserCommands\MyHotkeys.ahk` file.** + +## Do not edit the Default Commands + +Do not edit the `AhkCommandPicker.ahk` file or any files in the `DefaultCommands` directory, as they may be updated when new versions of AHK Command Picker are released, so you may run into conflicts (or lose your customizations) when updating these files. +Only edit the `UserCommands\MyCommands.ahk` and `UserCommands\MyHotkeys.ahk` files, as well as any other files you create in the `UserCommands` directory. + +## Next Steps + +That's it. +Congrats! +You've read all of the documentation! 🎉👏 + +Return to [the table of contents][DocumentationTableOfContents]. + + +[DocumentationTableOfContents]: DocumentationHomePage.md diff --git a/docs/Changelog.md b/docs/Changelog.md index fb6fb0a..2ad157d 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -2,24 +2,43 @@ This page is a list of _notable_ changes made in each version. -## vNext +## v2.0.1 - February 28, 2023 + +### App Features: -- Updated file structure to make updating to new versions easier down the road. -- Added support for Outlook 2016. -- Add commands for creating an Outlook appointment and opening the Outlook calendar. +- Updated file structure to separate User Commands from the built-in Default Commands to make updating to new versions easier in the future (BREAKING CHANGE). +- Add examples to the `MyCommands.ahk` and `MyHotkeys.ahk` files to help new users get started faster. Fixes: - Fix issue where the wrong command is sometimes selected when typing quickly ([GitHub issue #3](https://github.com/deadlydog/AHKCommandPicker/issues/3)). -- Make Outlook commands more resilient. -Breaking changes: +Breaking changes ([see the v1 to v2 migration guide](MigrateFromV1ToV2.md)): - Removed the `CommandScriptsToInclude.ahk` file. If you had added lines to that file to include other scripts, you will need to move those include statements to the `MyCommands.ahk` file. -- Changed Default Hotkey for moving a window from Alt+MouseDrag to LeftWin+MouseDrag. +- Moved the `MyCommands.ahk` and `MyHotkeys.ahk` files to the `UserCommands` directory. + If you had customized the `MyCommands.ahk` or `MyHotkeys.ahk` files, you will need to copy their contents into the new equivalent files in the `UserCommands` directory. + If you had added lines to include other scripts, you will need to update the include statement's directory path from `Commands` to `UserCommands`. + +### Default Commands + +Features: + +- Added support for Outlook 2016. +- Added commands for creating an Outlook appointment and opening the Outlook calendar. +- Added `ExploreMyDocuments` and `ExploreDesktop` Commands. + +Fixes: + +- Make Outlook commands more resilient. + +Breaking changes: + +- Renamed Commands `eMyComputer` to `ExploreMyComputer`, `eRecycleBin` to `ExploreRecycleBin`, and `eC` to `ExploreCDrive`. +- Changed the Default Hotkey for moving a window with your mouse by grabbing it anywhere (not just the title bar) from `Alt`+`MouseDrag` to `LeftWin`+`MouseDrag`. ## v1.3.2 - May 4, 2016 @@ -34,6 +53,14 @@ Features: - Renamed General.ahk to DefaultCommands.ahk and GeneralHotKeys.ahk to DefaultHotkeys.ahk. - Added new MyCommands.ahk and MyHotkeys.ahk files, and associated EditMyCommands and EditMyHotkeys commands, to help new users get started faster. +## v1.3.0 - November 24, 2013 + +Features: + +- Added new setting to have Escape key kill all current Commands and reload script (i.e. panic kill). + Escape key only has an effect if a command is currently running. +- Added Sleep timer to allow hotkeys and hotstrings to still be processed when in a long-running loop in a user's command. + ## CodePlex to GitHub migration This project was originally created in January 2012 using TFVC (Team Foundation Version Control) and hosted on CodePlex, which is now defunct. diff --git a/docs/Contributing.md b/docs/Contributing.md index a9e0859..ad0443f 100644 --- a/docs/Contributing.md +++ b/docs/Contributing.md @@ -11,7 +11,3 @@ If you open an issue, please: - any error messages - log output or files - screenshots, gifs, or videos - -## Why is it like this? - -If you are curious why something is the way it is, it may be documented in the [Architecture Decision Records](/docs/ArchitectureDecisionRecords/ArchitectureDecisionRecords.md). diff --git a/docs/DocumentationHomePage.md b/docs/DocumentationHomePage.md index 4854339..272614e 100644 --- a/docs/DocumentationHomePage.md +++ b/docs/DocumentationHomePage.md @@ -1,21 +1,17 @@ # Documentation Table Of Contents -AHK Command Picker requires [AutoHotkey_L][AutoHotkeyWebsiteUrl] to be installed, as it uses features that are only available in this version of AutoHotkey. +AHK Command Picker requires [AutoHotkey v1.1][AutoHotkeyDownloadPageUrl] (AutoHotkey_L) to be installed, as it uses features that are only available in this version of AutoHotkey. 1. [Getting Started With AHK Command Picker][GettingStartedPage] - 1. [Using Commands With Parameters][UsingCommandsWithParametersPage] - 1. [Adding Multiple Commands At Once][AddingMultipleCommandsAtOncePage] - 1. [Tips and Tricks][TipsAndTricksPage] - 1. [Best Practices][BestPracticesPage] -[AutoHotkeyWebsiteUrl]: http://www.autohotkey.com -[GettingStartedPage]: GettingStarted.md -[UsingCommandsWithParametersPage]: UsingCommandsWithParameters.md [AddingMultipleCommandsAtOncePage]: AddingMultipleCommandsAtOnce.md +[AutoHotkeyDownloadPageUrl]: https://www.autohotkey.com/download/ [BestPracticesPage]: BestPractices.md +[GettingStartedPage]: GettingStarted.md [TipsAndTricksPage]: TipsAndTricks.md +[UsingCommandsWithParametersPage]: UsingCommandsWithParameters.md diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index a83674f..c805d08 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -4,17 +4,22 @@ To launch AHK Command Picker run the `AHKCommandPicker.ahk` script. -Once the AHKCommandPicker.ahk script is running, press the `Caps Lock` key to bring up the AHK Command Picker GUI. From there just type the name of the command that you want to run, and hit enter to run it. +Once the AHKCommandPicker.ahk script is running, press the `Caps Lock` key to bring up the AHK Command Picker GUI. +From there just type the name of the command that you want to run, and hit enter to run it. If you want to turn Caps Lock on, use `Shift` + `Caps Lock` to toggle it on and off. ## Adding New Commands -Open the `Commands\MyCommands.ahk` file for editing; this can be done quickly by using CapsLock to open the AHK Command Picker and running the `EditMyCommands` command. From here you can either write your custom commands directly in MyCommands.ahk, or create a new ahk file and `#Include` its path in MyCommands.ahk, or a mix of the two approaches. +Open the `UserCommands\MyCommands.ahk` file for editing; this can be done quickly by using `Caps Lock` to open the AHK Command Picker and running the `EditMyCommands` command. +From here you can either write your custom commands directly in `MyCommands.ahk`, or create a new ahk file and `#Include` its path in `MyCommands.ahk`, or a mix of the two approaches. -A `Command` is simply a function pointer (i.e. delegate) and collection of parameters. So when you run a command it simply calls a function that you've defined, and optionally passes parameters to that function. +A `Command` is simply a function pointer (i.e. delegate) and collection of parameters. +So when you run a command it simply calls a function that you've defined, and optionally passes parameters to that function. -There are 2 different (but similar) functions that may be used to add a command to the AHK Command Picker: `AddCommand()` and `AddNamedCommand()`. Both of these functions have optional parameters. Here are the function prototypes, and descriptions of each parameter: +There are 2 different (but similar) functions that may be used to add a command to the AHK Command Picker: `AddCommand()` and `AddNamedCommand()`. +Both of these functions have optional parameters. +Here are the function prototypes, and descriptions of each parameter: ```AutoHotkey AddCommand(functionName, descriptionOfWhatFunctionDoes = "", parameterList = "", defaultParameterValue = "") @@ -22,11 +27,13 @@ AddCommand(functionName, descriptionOfWhatFunctionDoes = "", parameterList = "", AddNamedCommand(commandName, functionName, descriptionOfWhatFunctionDoes = "", parameterList = "", defaultParameterValue = "") ``` -* `commandName` = The name of the command to appear in the Command Picker. -* `functionName` = The function to call when this command is selected to run. Unless the AddNamedCommand() function is used, this will also be the name of the command that appears in the Command Picker. -* `descriptionOfWhatFunctionDoes` = A user-friendly message that will appear in the Command Picker telling what the command does. -* `parameterList` = A pre-set list of parameters to choose from in the Command Picker when this command is selected. Parameter values should be separated by a comma, and if you would like your parameter to show a different name in the GUI, separate the name from the value with a pipe character (|) (e.g. "Name1|Value1, Value2, Name3|Value3"). -* `defaultParameterValue` = The parameter value that will be passed to the function when no other parameter is given. +- `commandName`: The name of the command to appear in the Command Picker. +- `functionName`: The function to call when this command is selected to run. + Unless the `AddNamedCommand()` function is used, this will also be the name of the command that appears in the Command Picker. +- `descriptionOfWhatFunctionDoes`: A user-friendly message that will appear in the Command Picker telling what the command does. +- `parameterList`: A pre-set list of parameters to choose from in the Command Picker when this command is selected. + Parameter values should be separated by a comma, and if you would like your parameter to show a different name in the GUI, separate the name from the value with a pipe character (`|`) (e.g. "Name1|Value1, Value2, Name3|Value3"). +- `defaultParameterValue`: The parameter value that will be passed to the function when no other parameter is given. For example, to create a command to explore the C drive, you could use: @@ -38,7 +45,8 @@ ExploreCDrive() } ``` -Here you can see that the command specifies that the _ExploreCDrive_ function should be called when this command runs, and that the command's user-friendly description is "Explore C:\\". Next it actually defines the _ExploreCDrive_ function and what it should do. +Here you can see the command specifies that the _ExploreCDrive_ function should be called when this command runs, and that the command's user-friendly description is "Explore C:\\". +Next it actually defines the _ExploreCDrive_ function and what it should do. If we wanted to leave the function name as _ExploreCDrive_, but have it show up in the Command Picker as _Open C_, we would use the `AddNamedCommand()` function as follows: @@ -50,15 +58,36 @@ ExploreCDrive() } ``` -## Where To Create Hotkeys +## Reload AHK Command Picker to apply changes -Hotkeys and hotstrings should be added to the `Commands\MyHotkeys.ahk` file; this file can be opened for editing by using CapsLock to open the AHK Command Picker and running the `EditMyHotkeys` command. From here you can either write your custom hotkeys and hotstrings directly in MyHotkeys.ahk, or create a new ahk file and `#Include` it's path in MyHotkeys.ahk, or a mix of the two approaches. +Anytime you edit one of the script files to add or modify a Command, hotkey, or hotstring, the changes will not be applied in AHK Command Picker until you reload it. -**Any commands defined after a hotkey or hotstring will not show up in the AHK Command Picker**. This is why it is vital that hotkeys and hotstrings are created in the MyHotkeys.ahk file, since MyCommands.ahk is included before MyHotkeys.ahk. +To reload AHK Command Picker, simply press `Caps Lock` to open the AHK Command Picker GUI, and run the `ReloadAHKScript` Command. + +Alternatively, you can reload the script like you would any other AHK script by right-clicking on the AHK Command Picker icon in the system tray and selecting `Reload This Script`. + +If you receive an error message when trying to reload the script, it is likely because you have a syntax error in one of your script files, such as having two functions with the same name. + +## Where To Create Hotkeys and Hotstrings + +Both `hotkeys` (e.g. _^j::_) and `hotstrings` (e.g. _::btw::by the way_) should be added to (or referenced from) the `UserCommands\MyHotkeys.ahk` file. +The `MyHotkeys.ahk` file can be opened for editing by using `Caps Lock` to open the AHK Command Picker and running the `EditMyHotkeys` command. +From here you can either write your custom hotkeys and hotstrings directly in `MyHotkeys.ahk`, or create a new ahk file in the `UserCommands` directory and `#Include` it's path in `MyHotkeys.ahk`, or a mix of the two approaches. + +This is an example of the code you would add to the `UserCommands\MyHotkeys.ahk` file to include the `UserCommands\WorkRelatedHotkeys.ahk` file: + +```AutoHotkey +#Include %A_ScriptDir%\UserCommands\WorkRelatedHotkeys.ahk +``` + +**Any commands defined after a hotkey or hotstring will not show up in the AHK Command Picker**. +So if you add a hotkey or hotstring to the `MyCommands.ahk` file, then none of your custom commands will show up in the AHK Command Picker. +This is why it is vital that hotkeys and hotstrings are defined or `#Include`d in the `UserCommands\MyHotkeys.ahk` file, since `MyCommands.ahk` is included before `MyHotkeys.ahk`. ## How To Convert An Existing Hotkey Into a Command -Typically most of your existing AHK scripts are bound to a hotkey so that you can quickly launch them using a keyboard shortcut. For example, you might have the following hotkey to open up _C:\SomeFolder_ whenever the _Windows Key_ + _Z_ is pressed: +Typically existing AHK scripts are bound to a hotkey so that you can quickly launch them using a keyboard shortcut. +For example, you might have the following hotkey to open up _C:\SomeFolder_ whenever the _Windows Key_ + _Z_ is pressed: ```AutoHotkey #z:: @@ -76,7 +105,9 @@ OpenSomeFolder() } ``` -If you still wanted to have the hotkey, be sure you define it in the MyHotkeys.ahk file. You could leave the code as-is, but it would be better practice to have it call the new function to avoid duplicate code. So you could change it to: +If you still wanted to have the hotkey, be sure you define it in the `UserCommands\MyHotkeys.ahk` file. +You could leave the code as-is, but it would be better practice to have it call the new function to avoid duplicate code. +So you could change it to: ```AutoHotkey #z:: @@ -88,5 +119,13 @@ Typically your AHK scripts/hotkeys are probably more than one line long, but thi ## Additional Info -* The commands to include in AHK Command Picker are defined in the `CommandScriptsToInclude.ahk` file; this file includes the `MyCommands.ahk` and `MyHotkeys.ahk` files. -* All of the out-of-the-box commands are provided in the `Commands\DefaultCommands.ahk` file; feel free to look at it for examples. +All of the out-of-the-box commands and hotkeys are provided in the `DefaultCommands\DefaultCommands.ahk` and `DefaultCommands\DefaultHotkeys.ahk` files respectively; feel free to look at them for examples. +Editing them is not recommended, as any changes you make may be overwritten when they are updated in future versions. + +## Next Steps + +Proceed to the [Using Commands With Parameters][UsingCommandsWithParametersPage] page, or return to [the table of contents][DocumentationTableOfContents]. + + +[DocumentationTableOfContents]: DocumentationHomePage.md +[UsingCommandsWithParametersPage]: UsingCommandsWithParameters.md diff --git a/docs/MigrateFromV1ToV2.md b/docs/MigrateFromV1ToV2.md new file mode 100644 index 0000000..dad6ee1 --- /dev/null +++ b/docs/MigrateFromV1ToV2.md @@ -0,0 +1,34 @@ +# Migrating from AHK Command Picker v1 to v2 + +There were some breaking changes made in v2, so if you are upgrading from v1 to v2, you will need to make the following changes. + +## Script files location changed + +In v1 all command scripts were placed in a `Commands` directory. +In v2 we have separated the built-in default commands from the user commands to make updating to new versions easier in the future. +The built-in default commands are now located in the `DefaultCommands` directory, and these should not be modified. +All user commands should now be placed in the `UserCommands` directory. + +The `CommandScriptsToInclude.ahk` file was also removed in v2; instead those include statements should be moved to the `MyCommands.ahk` and `MyHotkeys.ahk` files. + +To migrate your customizations from v1 to v2: + +1. Copy the contents of your `Commands\MyCommands.ahk` file to the new `UserCommands\MyCommands.ahk` file. +1. Copy the contents of your `Commands\MyHotkeys.ahk` file to the new `UserCommands\MyHotkeys.ahk` file. +1. Copy any additional scripts you had in the `Commands` directory to the `UserCommands` directory. +1. If you had added `#Include` statements to the `CommandScriptsToInclude.ahk` file, you will need to move those include statement lines to: + - `UserCommands\MyCommands.ahk`: For including scripts containing Commands. + - `UserCommands\MyHotkeys.ahk`: For including scripts containing hotkeys and hotstrings. +1. If you were using the `#Include` command to reference other scripts, you will need to update the path of the included script to use the `UserCommands` directory instead of the `Commands` directory. + So for every ahk script that is now in the `UserCommands` directory, you will want to find `\Commands\` and replace it with `\UserCommands\`. + e.g. + + ```AutoHotkey + #Include %A_ScriptDir%\Commands\WorkRelatedCommands.ahk + ``` + + Should be changed to: + + ```AutoHotkey + #Include %A_ScriptDir%\UserCommands\WorkRelatedCommands.ahk + ``` diff --git a/docs/TipsAndTricks.md b/docs/TipsAndTricks.md index 09588e5..b32ac45 100644 --- a/docs/TipsAndTricks.md +++ b/docs/TipsAndTricks.md @@ -2,7 +2,9 @@ ## How To Reference The Currently Active Window -If you try to reference the currently active window to perform a command on it (e.g. using _WinActive("A")_), you will instead get a reference to the AHK Command Picker window since it was the last one opened (in order for you to run the command). Instead you need to use the `_cpAciveWindowID` global variable. Here is an example of creating a command to use this global variable to close the currently active window: +If you try to reference the currently active window to perform a command on it (e.g. using _WinActive("A")_), you will instead get a reference to the AHK Command Picker window since it was the last one opened (in order for you to run the command). +Instead you need to use the `_cpAciveWindowID` global variable. +Here is an example of creating a command to use this global variable to close the currently active window: ```AutoHotkey AddCommand("CloseWindow", "Closes the currently active window") @@ -12,11 +14,12 @@ CloseWindow() } ``` -In this example you can see that the global variable `_cpActiveWindowID` contains the AHK ID of the window that was active before the AHK Command Picker window was opened. Use this variable whenever you need to reference the last active window from a AHK Command Picker command. +In this example you can see that the global variable `_cpActiveWindowID` contains the AHK ID of the window that was active before the AHK Command Picker window was opened. +Use this variable whenever you need to reference the last active window from a AHK Command Picker command. ## How To Send A Virtual Escape Key Press Without Reloading The Script -If you have the `Allow the Escape key to kill all currently running commands` setting enabled, but need one of your commands to send an Escape key press to a window (e.g. SendInput, {Esc}), then use: +If you have the `Allow the Escape key to kill all currently running commands` setting enabled, but need one of your commands to send an Escape key press to a window (e.g. _SendInput, {Esc}_), then use: ```AutoHotkey _cpDisableEscapeKeyScriptReloadUntilAllCommandsComplete := true ; Prevent Escape key from reloading the script. @@ -26,13 +29,15 @@ _cpDisableEscapeKeyScriptReloadUntilAllCommandsComplete := false ; Allow Escape This will prevent the virtual Escape key press from reloading the script, and then will re-enable the Escape key press to kill currently running commands again. -If you just use __cpDisableEscapeKeyScriptReloadUntilAllCommandsComplete := true_, but never set it back to false, it will automatically be set back to false once there are no longer any commands running. Keep in mind though, the Escape key will not be able to kill any running commands until this happens. +If you just use `_cpDisableEscapeKeyScriptReloadUntilAllCommandsComplete := true`, but never set it back to false, it will automatically be set back to false once there are no longer any commands running. +Keep in mind though, the Escape key will not be able to kill any running commands until this happens. ## Reporting Errors Or Extra Information From A Command -After a command runs, its name and description are displayed for a short period to give the user confirmation that the actions were indeed performed. If a command returns some text, this text will also be displayed. +After a command runs, its name and description are displayed for a short period to give the user confirmation that the actions were indeed performed. +If a command returns some text, this text will also be displayed. -For example, if we wanted our _ExploreDirectory_ command to tell us which directories it is opening, we could add the line "return %directories%" to the bottom of the _ExploreDirectory()_ function, like so: +For example, if we wanted our _ExploreDirectory_ command to tell us which directories it is opening, we could add the line "return Opening %directoriesToOpen%" to the bottom of the _ExploreDirectory()_ function, like so: ```AutoHotkey ExploreDirectory(directoriesToOpen = "") @@ -65,11 +70,20 @@ That's it; the script will now launch whenever you (or any user depending which In order to launch the AHK Command Picker GUI when an application running as administrator has focus (such as the Control Panel or Windows Explorer / File Explorer, in Windows 8), either the [AutoHotkey executable will need to be signed][BlogShowingHowToSignAutoHotkeyUrl] (preferred method), or the `AHKCommandPicker.ahk` script will also need to be running as an administrator. -You can check out [my blog post][BlogShowingHowToHaveAutoHotkeyStartAsAdminAtStartupUrl] to see how to have the script automatically run as an administrator at login. If you want to run the script as an admin, but don't want it to automatically start when you log into Windows, you can simply right-click on the `AHKCommandPicker.ahk` file and choose Run As Admin. However, it will likely be more convenient for you to create a shortcut to that file, place the shortcut somewhere easily accessible (such as on your desktop), and set the shortcut properties to always launch the script as an admin. Part of [my other blog post][BlogShowingHowToHaveAutoHotkeyInteractWithAdminWindowsUrl] contains similar instructions and a screenshot on how to do this. +You can check out [my blog post][BlogShowingHowToHaveAutoHotkeyStartAsAdminAtStartupUrl] to see how to have the script automatically run as an administrator at login. +If you want to run the script as an admin, but don't want it to automatically start when you log into Windows, you can simply right-click on the `AHKCommandPicker.ahk` file and choose Run As Admin. +However, it will likely be more convenient for you to create a shortcut to that file, place the shortcut somewhere easily accessible (such as on your desktop), and set the shortcut properties to always launch the script as an admin. +Part of [my other blog post][BlogShowingHowToHaveAutoHotkeyInteractWithAdminWindowsUrl] contains similar instructions and a screenshot on how to do this. + +## Next Steps + +Proceed to the [Best Practices][BestPracticesPage] page, or return to [the table of contents][DocumentationTableOfContents]. +[BestPracticesPage]: BestPractices.md [BlogShowingHowToSignAutoHotkeyUrl]: http://blog.danskingdom.com/get-autohotkey-to-interact-with-admin-windows-without-running-ahk-script-as-admin/ [BlogShowingHowToHaveAutoHotkeyStartAsAdminAtStartupUrl]: http://blog.danskingdom.com/get-autohotkey-script-to-run-as-admin-at-startup/ [BlogShowingHowToHaveAutoHotkeyInteractWithAdminWindowsUrl]: http://blog.danskingdom.com/autohotkey-cannot-interact-with-windows-8-windowsor-can-it/ +[DocumentationTableOfContents]: DocumentationHomePage.md [RunWindowWithShellStartupImage]: Images/RunWindowWithShellStartup.png [UsersStartupDirectoryWithShortcutImage]: Images/UsersStartupDirectoryWithShortcut.png diff --git a/docs/UsingCommandsWithParameters.md b/docs/UsingCommandsWithParameters.md index da65649..d144aff 100644 --- a/docs/UsingCommandsWithParameters.md +++ b/docs/UsingCommandsWithParameters.md @@ -1,8 +1,9 @@ # Using Parameters With Your Commands -You may also configure your commands to take optional parameters. To do this, simply define that your function takes in an optional string parameter. +You may also configure your commands to take optional parameters. +To do this, simply define that your function takes in an optional string parameter. -For example, we could re-write the _ExploreCDrive_ Command and Function to open any directory path that is passed in as a parameter like so: +For example, we could re-write the _ExploreCDrive_ Command and function to open any directory path that is passed in as a parameter like so: ```AutoHotkey AddCommand("ExploreDirectory", "Opens the directory supplied in the parameters", "", "C:\") @@ -12,7 +13,8 @@ ExploreDirectory(directoryToOpen = "") } ``` -Notice that after the `functionName` and `descriptionOfWhatFunctionDoes` parameters, we supply an empty string for the `parameterList` and "C:\" for the `defaultParameterValue`. Technically both of these parameters are optional, but in this case we want to provide a default parameter value in case the user does not supply a parameter when selecting to run this Command; in this example if no parameters are supplied then "C:\" will be passed into the function and will be opened. +Notice that after the `functionName` and `descriptionOfWhatFunctionDoes` parameters, we supply an empty string for the `parameterList` and "C:\" for the `defaultParameterValue`. +Technically both of these parameters are optional, but in this case we want to provide a default parameter value in case the user does not supply a parameter when selecting to run this Command; in this example if no parameters are supplied then "C:\" will be passed into the function and will be opened. Because AHK Command Picker supports passing multiple parameters into a command, we would probably want to re-write our function to support opening each directory path that is passed in like so: @@ -28,28 +30,30 @@ ExploreDirectory(directoriesToOpen = "") } ``` -Now the function will loop over each directory path that is passed in and open each of them up. +Here we added a loop that will iterate over each directory path in the comma-separated value (CSV) list of directories that is passed in, and open each one up. -In addition to supporting multiple parameters, you may have preset parameters for your commands as well; this is what the `parameterList` parameter is used for, and allows preset parameters to show up in the AHK Command Picker GUI. For example, to have "C:\" and "C:\MyDir" show up in the GUI when the user is entering parameter values, you could use: +In addition to supporting multiple parameters, you may have preset parameters for your commands as well; this is what the `parameterList` parameter is used for, and allows preset parameters to show up in the AHK Command Picker GUI. +For example, to have "C:\" and "C:\MyDir" show up in the GUI when the user is entering parameter values, you could use: ```AutoHotkey AddCommand("ExploreDirectory", "Opens the directory supplied in the parameters", "C:\,C:\MyDir", "C:\") ``` -You can also give user-friendly names to the preset parameter values as well that will show up in the GUI instead of the actual value passed into the function; simply separate the `Name` from the `Value` with a pipe character (|). For example, we could give user-friendly names to these preset parameters by using: +You can also give user-friendly names to the preset parameter values as well that will show up in the GUI instead of the actual value passed into the function; simply separate the `Name` from the `Value` with a pipe character (`|`). +For example, we could give user-friendly names to these preset parameters by using: ```AutoHotkey AddCommand("ExploreDirectory", "Opens the directory supplied in the parameters", "C Drive|C:\,My Directory|C:\MyDir", "C:\") ``` -If you want to have a long list of preset parameters, you may want to consider storing the list in a variable and passing that variable into the AddCommand() function, like so: +If you want to have a long list of preset parameters, you may want to consider storing the list in a variable and passing that variable into the `AddCommand()` function, like so: ```AutoHotkey directories = "C Drive|C:\,My Directory|C:\MyDir,Other Directory|C:\Other,C:\Some\Other\Directory,Program Files|C:\Program Files" AddCommand("ExploreDirectory", "Opens the directory supplied in the parameters", directories, "C:\") ``` -The `UtilityFunctions.ahk` file provided by AHK Command Picker (and included by default at the top of `CommandScriptsToInclude.ahk`) provides a function to help make building these long lists of parameters easier and more readable: +The `DefaultCommands\UtilityFunctions.ahk` file provided by AHK Command Picker (and included by default) provides a `AddParameterToString` function to help make building these long lists of parameters easier and more readable: ```AutoHotkey // Add all of our preset parameters to the directories variable, which will actually be a comma-separated string list. @@ -67,11 +71,22 @@ Here is an example of what the GUI might look like if we had added many more dir ## Passing Parameters Into The Selected Command From The GUI -When using the GUI to select a command to run, you can pass a parameter to the selected command to run by placing a comma (,) after the name of the command to run and then typing in the parameter value. If any preset parameters have been defined for the command then they will show up in the GUI list. You may pass multiple parameters into the command by using a comma-separated list; that is, every comma specifies that the following text is a new parameter value. +When using the GUI to select a command to run, you can pass a parameter to the selected command to run by placing a comma (`,`) after the name of the command to run and then typing in the parameter value. +If any preset parameters have been defined for the command then they will show up in the GUI list. +You may pass multiple parameters into the command by using a comma-separated list; that is, every comma specifies that the following text is a new parameter value. -Going back to our _ExploreDirectory_ command we defined above, you could have it open the C:\SomeDir directory by typing "ExploreDirectory, C:\SomeDir". You could also have it open many directories by passing in a comma separated list, such as "ExploreDirectory, C:\SomeDirectory, C:\Some\Other\Directory", or if the command has a preset parameter with a user-friendly name, you can use that too. From the example above, we could type, "ExploreDirectory, My Directory, C Drive, C:\Some\Other\Directory". +Going back to our _ExploreDirectory_ command we defined above, you could have it open the _C:\SomeDir_ directory by typing "ExploreDirectory, C:\SomeDir". +You could also have it open many directories by passing in a comma separated list, such as "ExploreDirectory, C:\SomeDirectory, C:\Some\Other\Directory", or if the command has a preset parameter with a user-friendly name, you can use that too. +From the example above, we could type, "ExploreDirectory, My Directory, C Drive, C:\Some\Other\Directory". -Note too that you do not have to type in the entire command and parameter name; only enough so that it gets selected in the list box. So in the above example you might be able to simply type, "Ex, MyD, CD, C:\Some" to open all of those same directories. +Note too that you do not have to type in the entire command and parameter name; only enough so that it gets selected in the list box. +So in the above example you might be able to simply type, "Ex, MyD, CD, C:\Some" to open all of those same directories. + +## Next Steps + +Proceed to the [Adding Multiple Commands At Once][AddingMultipleCommandsAtOncePage] page, or return to [the table of contents][DocumentationTableOfContents]. +[AddingMultipleCommandsAtOncePage]: AddingMultipleCommandsAtOnce.md +[DocumentationTableOfContents]: DocumentationHomePage.md [UsingPresetParametersImage]: Images/UsingPresetParameters.png diff --git a/docs/WhyUseAhkCommandPicker.md b/docs/WhyUseAhkCommandPicker.md index a44219e..0d4d688 100644 --- a/docs/WhyUseAhkCommandPicker.md +++ b/docs/WhyUseAhkCommandPicker.md @@ -1,20 +1,21 @@ # Why Use AHK Command Picker -AutoHotkey is such a powerful language and can be used to do so many things. Because of this you will likely have many AHK scripts/hotkeys to accomplish a variety of different tasks, some that you use frequently and others not so frequently. +AutoHotkey is such a powerful language and can be used to do so many things. +Because of this you will likely have many AHK scripts/hotkeys to accomplish a variety of different tasks, some that you use frequently and others not so frequently. -AHK Command Picker solves the following AHK problems: +AHK Command Picker solves the following problems: -* Trying to remember which hotkeys (i.e. key combinations) are used to launch which scripts (e.g. "Which script does Win+A launch again?"). -* Trying to find new hotkeys that aren't already used by other applications (e.g. "I hit Ctrl+N to open a new tab in my application, but it launched one of my scripts as well. Oops"). -* Accidentally launching scripts by unintentionally hitting a hotkey key combination (e.g. "My fingers weren't on home-row as I thought they were", or "My son came over and mashed a bunch of keys"). +- Trying to remember which hotkeys (i.e. key combinations) are used to launch which scripts (e.g. "Which script does Win+A launch again?"). +- Trying to find new hotkeys that aren't already used by other applications (e.g. "I hit Ctrl+N to open a new tab in my application, but it launched one of my scripts as well. Oops"). +- Accidentally launching scripts by unintentionally hitting a hotkey key combination (e.g. "My fingers weren't on home-row as I thought they were", or "My cat walked across the keyboard"). AHK Command Picker also allows you to: -* Browse your list of commands (i.e. functions / scripts), each with an optional user-friendly description. -* Easily provide parameters to your commands, which can be used to alter a command's functionality. - * You can also provide preset parameter values that get shown in the command picker. -* Still execute your AHK code very quickly by [CamelCase][CamelCaseExplanationUrl] filtering the commands and preset parameters as you type. -* Automate more tasks. +- Browse your list of commands (i.e. functions / scripts), each with an optional user-friendly description. +- Easily provide parameters to your commands, which can be used to alter a command's functionality. + - You can also provide preset parameter values that get shown in the command picker. +- Still execute your AHK code very quickly by [CamelCase][CamelCaseExplanationUrl] filtering the commands and preset parameters as you type. +- Automate more tasks. If you are trying to determine if something is worth taking the time to automate, [consult this handy chart][XkcdComicAboutDeterminingIfSomethingIsWorthAutomatingUrl]. diff --git a/src/AHKCommandPicker.ahk b/src/AHKCommandPicker.ahk index 3b86a24..b8c2cb4 100644 --- a/src/AHKCommandPicker.ahk +++ b/src/AHKCommandPicker.ahk @@ -4,6 +4,8 @@ IDEAS: - Make it easy for users to install and update AHK Command Picker without losing their customization commands/hotkeys. - This is the main factor to consider for v2.0. - Have an installer perhaps, along with a checkbox to automatically run the script at startup. + - This could be done as it's own AHK script that prompts for the install location and to start at Startup or not. +- Allow DefaultCommands and DefaultHotkeys to be excluded using the Settings in the GUI. - Make the AddCommandsFromVariable a standard thing so it's easy for people to add apps, directories, and websites to launch. - Dark mode. Ideally use Windows system default. @@ -18,6 +20,7 @@ IDEAS: ; Use the two following commands to debug a script. ;ListVars ;Pause +;OutputDebug, % TEXT #SingleInstance force ; Make it so only one instance of this script can run at a time (and reload the script if another instance of it tries to run). #NoEnv ; Avoid checking empty variables to see if they are environment variables (better performance). @@ -159,7 +162,7 @@ DummyCommand(parameters = "") AddCommand("EditMyCommands", "Opens the MyCommands.ahk script for editing in the default editor, or notepad.") EditMyCommands() { - filePath = %A_ScriptDir%\Commands\MyCommands.ahk + filePath = %A_ScriptDir%\UserCommands\MyCommands.ahk Run, edit %filePath%,,UseErrorLevel if (%ErrorLevel% = ERROR) Run, "notepad" "%filePath%" @@ -168,29 +171,29 @@ EditMyCommands() AddCommand("EditMyHotkeys", "Opens the MyHotkeys.ahk script for editing in the default editor, or notepad.") EditMyHotkeys() { - filePath = %A_ScriptDir%\Commands\MyHotkeys.ahk + filePath = %A_ScriptDir%\UserCommands\MyHotkeys.ahk Run, edit %filePath%,,UseErrorLevel if (%ErrorLevel% = ERROR) Run, "notepad" "%filePath%" } ;---------------------------------------------------------- -; Include our utility functions used by some of the Commands first. +; Include our utility functions used by some of the Default Commands first. ;---------------------------------------------------------- -#Include %A_ScriptDir%\Commands\UtilityFunctions.ahk +#Include %A_ScriptDir%\DefaultCommands\UtilityFunctions.ahk ;---------------------------------------------------------- ; Include the files with the Commands we want to include in the picker. ;---------------------------------------------------------- -#Include %A_ScriptDir%\Commands\DefaultCommands.ahk -#Include %A_ScriptDir%\Commands\MyCommands.ahk +#Include %A_ScriptDir%\DefaultCommands\DefaultCommands.ahk +#Include %A_ScriptDir%\UserCommands\MyCommands.ahk ;---------------------------------------------------------- ; Include any files containing HotKeys/HotStrings last, as any AddCommand functions defined after ; a HotKey/HotString won't be loaded at startup, and hence, won't show up in the Command Picker list. ;---------------------------------------------------------- -#Include %A_ScriptDir%\Commands\DefaultHotkeys.ahk -#Include %A_ScriptDir%\Commands\MyHotkeys.ahk +#Include %A_ScriptDir%\DefaultCommands\DefaultHotkeys.ahk +#Include %A_ScriptDir%\UserCommands\MyHotkeys.ahk ;========================================================== ; Hotkey to launch the Command Picker window. diff --git a/src/Commands/MyCommands.ahk b/src/Commands/MyCommands.ahk deleted file mode 100644 index 9c4f395..0000000 --- a/src/Commands/MyCommands.ahk +++ /dev/null @@ -1,7 +0,0 @@ -; =============================================== -; Add your custom Commands to this file. -; If you want to break your commands up over multiple files, simply include a reference to them here. -; e.g. #Include %A_ScriptDir%\Commands\MyWorkRelatedCommands.ahk ; MyWorkRelatedCommands.ahk should be in the Commands directory along with this MyCommands.ahk file. -; =============================================== - -; #Include %A_ScriptDir%\Commands\MyWorkRelatedCommands.ahk diff --git a/src/Commands/MyHotkeys.ahk b/src/Commands/MyHotkeys.ahk deleted file mode 100644 index b3db2be..0000000 --- a/src/Commands/MyHotkeys.ahk +++ /dev/null @@ -1,7 +0,0 @@ -; =============================================== -; Add your custom Hotkeys to this file. -; If you want to break your commands up over multiple files, simply include a reference to them here. -; e.g. #Include MyWorkRelatedHotkeys.ahk ; MyWorkRelatedHotkeys.ahk should be in the Commands directory along with this MyHotkeys.ahk file. -; =============================================== - -; #Include %A_ScriptDir%\Commands\MyWorkRelatedHotkeys.ahk diff --git a/src/Commands/DefaultCommands.ahk b/src/DefaultCommands/DefaultCommands.ahk similarity index 95% rename from src/Commands/DefaultCommands.ahk rename to src/DefaultCommands/DefaultCommands.ahk index 0cf071f..53b59db 100644 --- a/src/Commands/DefaultCommands.ahk +++ b/src/DefaultCommands/DefaultCommands.ahk @@ -31,20 +31,32 @@ PCRestart() Run, shutdown.exe -r -t 00 } -AddCommand("eMyComputer", "Explore My Computer") -eMyComputer() +AddCommand("ExploreMyComputer", "Explore My Computer") +ExploreMyComputer() { - Run, ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ; Opens the "My Computer" folder. + Run, ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ; Opens the "My Computer" folder. } -AddCommand("eRecycleBin", "Explore the Recycle Bin") -eRecycleBin() +AddCommand("ExploreRecycleBin", "Explore the Recycle Bin") +ExploreRecycleBin() { - Run, ::{645ff040-5081-101b-9f08-00aa002f954e} ; Opens the Recycle Bin. + Run, ::{645ff040-5081-101b-9f08-00aa002f954e} ; Opens the Recycle Bin. } -AddCommand("eC", "Explore C:\") -eC() +AddCommand("ExploreMyDocuments", "Explore the user's My Documents folder.") +ExploreMyDocuments() +{ + Run, explore %A_MyDocuments% +} + +AddCommand("ExploreDesktop", "Explore the user's Desktop folder.") +ExploreDesktop() +{ + Run, explore %A_Desktop% +} + +AddCommand("ExploreCDrive", "Explore C:\") +ExploreCDrive() { Run, explore C:\ } diff --git a/src/Commands/DefaultHotkeys.ahk b/src/DefaultCommands/DefaultHotkeys.ahk similarity index 100% rename from src/Commands/DefaultHotkeys.ahk rename to src/DefaultCommands/DefaultHotkeys.ahk diff --git a/src/Commands/UtilityFunctions.ahk b/src/DefaultCommands/UtilityFunctions.ahk similarity index 100% rename from src/Commands/UtilityFunctions.ahk rename to src/DefaultCommands/UtilityFunctions.ahk diff --git a/src/UserCommands/MyCommands.ahk b/src/UserCommands/MyCommands.ahk new file mode 100644 index 0000000..4e5cedc --- /dev/null +++ b/src/UserCommands/MyCommands.ahk @@ -0,0 +1,25 @@ +; =============================================== +; Add your custom Commands to this file. +; If you want to break your commands up over multiple files, simply include a reference to them here. +; e.g. #Include %A_ScriptDir%\UserCommands\WorkRelatedCommands.ahk +; WorkRelatedCommands.ahk should be in the UserCommands directory along with this MyCommands.ahk file. +; +; After modifying this file (or any included files), run the `ReloadAHKScript` Command to apply the changes. +; =============================================== + +; Example of including another script that contains Commands. +;#Include %A_ScriptDir%\UserCommands\WorkRelatedCommands.ahk + +; Example of creating a command that does not take any parameters. Feel free to delete this. +AddCommand("DisplayLoggedInUser", "Displays the username of the logged in user.") +DisplayLoggedInUser() +{ + MsgBox, % "You are logged in as: " . A_UserName +} + +; Example of creating a command that takes a parameter. Feel free to delete this. +AddCommand("DisplayMessage", "Displays a message box.", "These, are, preset, parameter, values", "Default parameter value") +DisplayMessage(message) +{ + MsgBox % "Parameter passed in was: " . message +} diff --git a/src/UserCommands/MyHotkeys.ahk b/src/UserCommands/MyHotkeys.ahk new file mode 100644 index 0000000..1759710 --- /dev/null +++ b/src/UserCommands/MyHotkeys.ahk @@ -0,0 +1,17 @@ +; =============================================== +; Add your custom Hotkeys to this file. +; If you want to break your commands up over multiple files, simply include a reference to them here. +; e.g. #Include %A_ScriptDir%\UserCommands\WorkRelatedHotkeys.ahk +; WorkRelatedHotkeys.ahk should be in the UserCommands directory along with this MyHotkeys.ahk file. +; +; After modifying this file (or any included files), run the `ReloadAHKScript` Command to apply the changes. +; =============================================== + +; Example of including another script that contains hotkeys and/or hotstrings. +;#Include %A_ScriptDir%\UserCommands\WorkRelatedHotkeys.ahk + +; Example hotkey. Press Windows Key + O to see the message box. Feel free to delete this. +;#o::MsgBox, You pressed the Windows Key + O + +; Example hotstring. When you type "btw" it will be replaced with "by the way". Feel free to delete this. +;::btw:by the way