AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Autohotkey rapidclick11/4/2022 Once exiting the loop all of the relevant files have beenĪdded to the menu MainMenu, but they need to be added to QuickLinks as a submenu. (the category folder name) is used as the menu name rather than The MENU command is almost identical to the command in the first loop except that MainMenu (Read Only), and S (System) parameters must be separated by commas with These types of files are included in the new menu, a conditional IF (ifĪ_LoopFileAttrib contains H,R,S) is included to skip those files byĬommand which skips the loop to the next file/folder. AUTOHOTKEY RAPIDCLICK WINDOWSUnlike the listing in Windows File Explorer, the AutoHotkey LOOPĬommand, when used with files, retrieves all files regardless of theirĪttributes-including hidden and system files. Second LOOP command uses the parameter 1 to retrieve all folders andįiles. MainMenu is used as the name for the submenu when the items are added. Once within the second loop A_LoopFileName will take on the value of each item located in that folder as it increments through them. The variable MainMenu is created to save the name of the category item. Menu, %MainMenu%, Add, %A_LoopFileName%, MenuHandler If A_LoopFileAttrib contains H,R,S Skip any file that is Statement) so that each time a folder is found it immediately looks for The next step is to add a second loop within theįirst loop (inside the curly brackets of the first loop after the MENU More on that later.Īlone, this loop would create a menu of the folders located in the Than rework it now, I'll use it as a learning point. The implications of his approach until he actually gets there. It's not unusual to start down one path, then later realize that there Rather than MenuHandler label-which is only needed in the submenus. Later in the script by immediately assigning the FolderHandler label AUTOHOTKEY RAPIDCLICK CODESee now that I could have saved a couple of lines of code which occur In this script, each category menu item is changed laterĭepending upon whether there are files or folders within this folder. If this menu item, as it is now, is left on the final menu, the label (subroutine) MenuHandler,įound later in the script, would execute when clicked on the activated (the value of A_LoopFileName, the variable which stores the name of the current folder or file) is added to a menu named QuickLinks. In this case, a menu item named with the folder name The first step in creating a menu is to ADD In this case the primary function of the loop is to create a menu itemįor each category folder. LOOP command uses the standard curly brackets () to enclose the codeĮxecuted each time the loop is incremented to the next file or folder. LOOP command will continue recursively looking into all subfolders. The last parameter shown (set to 0) tellsĪutoHotkey not to look beyond this current folder. The default for this parameter isĠ which will retrieve only files. The parameter 2 found after the path and comma tellsĪutoHotkey to only retrieve folders. The "*.*" is the wildcard for checking everyįolder/file. Menu, QuickLinks, Add, %A_LoopFileName%, MenuHandler Wildcards such as "*" and "?" can be used in the folder/file path. Simply Loop followed by the path of the target files. It automatically increments through the items inĪ folder providing data on each. Is a powerful command for reading Windows file and folder names in With one of the hotkey combinations ( WIN Z or ALT Comma), the QuickLinks menu will appear as shown in the image at the left. If there is nothing in the folder, then it skips to the end The script immediately starts the process of scanning the QuickLinks folder with the LOOP (files and folders)Ĭommand. IfNotExist, C:\\Users\\%A_UserName%\\QuickLinks\\įileCreateDir, C:\\Users\\%A_UserName%\\QuickLinks\\ If the folder does not exist, it is created with FileCreateDir command. Since QuickLinks uses a standard folder (QuickLinks) found in the user folder, the script employs the IfNotExist command to look for it. The code, the complete script (without standard boilerplate from a newĪutoHotkey, AHK, file) can be found near the end of this column. Lastly, the keyboard combinations areĪssigned one for right-handed people ( WIN Z) and one for The labels (routines) containing the action executed when an item is Standard links are added at the bottom of the category menu followed by Nothing is found in the subfolder, the category menu item action Loops through its files creating links for each to add to a submenu. Third (3), for each folder found at the top level the script The category folders within it while creating menu items for the top Second (2), the script loops through the QuickLinks folder listing only Is the creation of the QuickLinks folder (if it doesn't already exist). The QuickLinks menu is the result of three primary steps.
0 Comments
Read More
Leave a Reply. |