/* Author: Jack Dunning — Date: February 21, 2017 The CheeseBurgerRecipe.ahk script demonstrates a simple method for presenting recipes in step-by-step manner using MsgBox windows. The icon right-click context menu allows the selection of different starting points and the simultaneous opening of each step. The System Tray icon file (CheeseBurgerIcon.ico) must be present in the script folder. Original Recipe appears at: http://www.foodnetwork.com/recipes/food-network-kitchen/cheesy-cheeseburgers-recipe This script uses a Label pass-over technique which allows the subroutine to start in any one of four starting points discussed in: https://jacksautohotkeyblog.wordpress.com/2017/03/03/understanding-label-names-and-subroutines-beginning-autohotkey-tip/ March 7, 2017 - Print capabilities have been added to the script through both the Menu item "Print All" and individual section printing via a Help button added to each MsgBox with its name changed to "Print Item" via techniques discussed in: https://jacksautohotkeyblog.wordpress.com/2017/01/23/tips-for-optimizing-the-standard-autohotkey-message-box-msgbox-command-autohotkey-quick-reference-part-six/ To do this all the variables for the steps were moved to the top of the script (auto-execute section). Plus, a new "MessageSetup:" subroutine allowed the needed code for each MsgBox to run before each section of the recipe via the GoSub command. March 23, 2017 - Added two more recipes: Animal-Style Cheeseburgers and Jack Stuffed Cheeseburger (Animal-Style). The first uses the same Label drop-through technique to display each step of the recipe. The second, Jack Stuffed Cheeseburger (Animal-Style), jumps between the new recipe and the other two using the GoTo command to create a unique. In order to fit more onto the System Tray icon right-click menu, I added submenus for each recipe menu item. The Print Recipe menu item moved to the respective submenu and uses the A_MenuName to print the appropriate recipe. The ControlGetText command made it possible to create a universal Print Item function without reusing each step variable. */ #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #Persistent FileInstall, CheeseBurgerWhiteIcon.ico, CheeseBurgerWhiteIcon.ico ; include icon in EXE file ; Create submenus for each recipe Menu, Cheeseburger, add, Ingredients, Ingredients Menu, Cheeseburger, add, Prepare, Prepare Menu, Cheeseburger, add, Cook, Cook Menu, Cheeseburger, add, Serve, Serve Menu, Cheeseburger, add, Print Recipe, Print Menu, tray, add, Jack Stuffed Cheeseburger, :Cheeseburger Menu, Animal, add, Ingredients, Animal_Ingredients Menu, Animal, add, Onions, Animal_Onions Menu, Animal, add, Sauce, Animal_Sauce Menu, Animal, add, Prepare, Animal_Prepare Menu, Animal, add, Buns, Animal_Buns Menu, Animal, add, Cook, Animal_Cook Menu, Animal, add, Serve, Animal_Serve Menu, Animal, add, Print Recipe, Print Menu, tray, add, Animal Style Cheeseburger, :Animal Menu, StuffedAnimal, add, Ingredients, Stuffed_Animal_Ingredients Menu, StuffedAnimal, add, Onions, Animal_Onions Menu, StuffedAnimal, add, Sauce, Animal_Sauce Menu, StuffedAnimal, add, Prepare, Prepare Menu, StuffedAnimal, add, Buns, Animal_Buns Menu, StuffedAnimal, add, Cook,Stuffed_Animal_Cook Menu, StuffedAnimal, add, Serve, Stuffed_Animal_Serve Menu, StuffedAnimal, add, Print Recipe, Print Menu, tray, add, Stuffed Animal Cheeseburger, :StuffedAnimal Menu, tray, Icon, CheeseBurgerWhiteIcon.ico ; add System Tray icon Menu, tray, Tip, Jack Stuffed Cheeseburger ; set ToolTip message for icon ; Load test into recipe step variables GoSub, StuffedCheeseburger GoSub, AnimalCheeseburger GoSub, StuffedAnimalCheeseburger Return ; Stuffed Cheeseburger Steps Subroutine Ingredients: GoSub, MessageSetup MsgBox,16385, Jack Stuffed Cheeseburger - Ingredients, Ingredients:`r`r%Ingredients% IfMsgBox Cancel Return Prepare: GoSub, MessageSetup MsgBox,16385, Jack Stuffed Cheeseburger - Prepare, Prepare:`r`r%Mix% IfMsgBox Cancel Return If (StuffedAnimal = 1) GoTo, Animal_Buns Cook: GoSub, MessageSetup MsgBox,16385, Jack Stuffed Cheeseburger - Cook, Cook:`r`r%Cook% IfMsgBox Cancel Return Serve: GoSub, MessageSetup MsgBox,16385, Jack Stuffed Cheeseburger - Serve, %Serve% Return ; Animal-style Cheeseburger Steps Subroutine Animal_Ingredients: GoSub, MessageSetup MsgBox,16385, Animal Style Cheeseburger - Ingredients (Animal Style), Ingredients:`r`r%Animal_Ingredients% IfMsgBox Cancel Return Animal_Onions: GoSub, MessageSetup MsgBox,16385, Animal Style Cheeseburger - Onions, Carmelized Onions:`r`r%Animal_Onions% IfMsgBox Cancel Return Animal_Sauce: GoSub, MessageSetup MsgBox,16385, Animal Style Cheeseburger - Sauce, Sauce:`r`r%Animal_Sauce% IfMsgBox Cancel Return If (StuffedAnimal = 1) GoTo, Prepare Animal_Prepare: GoSub, MessageSetup MsgBox,16385, Animal Style Cheeseburger - Prepare, Prepare:`r`r%Animal_Mix% IfMsgBox Cancel Return Animal_Buns: GoSub, MessageSetup MsgBox,16385, Animal Style Cheeseburger - Buns, Cook:`r`r%Animal_Buns% IfMsgBox Cancel Return If (StuffedAnimal = 1) GoTo, Stuffed_Animal_Cook Animal_Cook: GoSub, MessageSetup MsgBox,16385, Animal Style Cheeseburger - Cook, Cook:`r`r%Animal_Cook% IfMsgBox Cancel Return Animal_Serve: GoSub, MessageSetup MsgBox,16385, Jack Stuffed Cheeseburger - Serve (Animal Style), %Animal_Serve% Return ; Stuffed Animal-style Cheeseburger Steps Subroutine Stuffed_Animal_Ingredients: GoSub, MessageSetup MsgBox,16385, Jack Stuffed Cheeseburger - Ingredients (Animal Style), Ingredients:`r`r%Stuffed_Animal_Ingredients% IfMsgBox Cancel Return GoTo, Animal_Onions Stuffed_Animal_Cook: GoSub, MessageSetup MsgBox,16385, Jack Stuffed Cheeseburger - Cook (Animal Style), Cook:`r`r%Stuffed_Animal_Cook% IfMsgBox Cancel Return Stuffed_Animal_Serve: GoSub, MessageSetup MsgBox,16385, Jack Stuffed Cheeseburger - Serve (Animal Style), %Stuffed_Animal_Serve% Return Print: If (A_ThisMenu = "Cheeseburger") { FileDelete, RecipePrint.txt FileAppend , % "Jack Stuffed Cheeseburgers`r`r" . Ingredients . "`r`r" . Mix . "`r`r" . Cook . "`r`r" . Serve, RecipePrint.txt Run, Notepad /p RecipePrint.txt } If (A_ThisMenu = "Animal") { FileDelete, RecipePrint.txt FileAppend , % "Animal Style Cheeseburgers`r`r" . Animal_Ingredients . "`r`r" . Animal_Onions . "`r`r" . Animal_Sauce . "`r`r" . Animal_Mix . "`r`r" . Animal_Buns . "`r`r" . Animal_Cook . "`r`r" . Animal_Serve, RecipePrint.txt Run, Notepad /p RecipePrint.txt } If (A_ThisMenu = "StuffedAnimal") { FileDelete, RecipePrint.txt FileAppend , % "Jack Stuffed Cheeseburgers (Animal Style)`r`r" . Stuffed_Animal_Ingredients . "`r`r" . Animal_Onions . "`r`r" . Animal_Sauce . "`r`r" . Mix . "`r`r" . Animal_Buns . "`r`r" . Stuffed_Animal_Cook . "`r`r" . Stuffed_Animal_Serve, RecipePrint.txt Run, Notepad /p RecipePrint.txt } Return ChangeButtonNames: IfWinNotExist, ahk_class #32770 Return ; Keep waiting. SetTimer, ChangeButtonNames, off WinActivate ControlSetText, Button3, Print Item Return PrintItem() { WinGetActiveTitle, Title ControlGetText, Step, Static1, %Title% FileDelete, RecipePrint.txt FileAppend , %Title%:`r`r%Step%, RecipePrint.txt Run, Notepad /p RecipePrint.txt } MessageSetup: If (A_ThisMenu = "StuffedAnimal") StuffedAnimal = 1 Else StuffedAnimal = 0 SetTimer, ChangeButtonNames, 50 Gui +OwnDialogs OnMessage(0x53,"PrintItem") Return ; Stuffed Cheeseburger Steps Text StuffedCheeseburger: ; *** For new recipes, paste new ingredients between the two parentheses below Ingredients = ( 1 1/2 pounds ground beef chuck 4 1/2-inch cubes pepper jack cheese (about 1 ounce total) Kosher salt and freshly ground pepper 1/2 tablespoon vegetable oil 4 slices cheddar cheese (about 2 ounces) 4 hamburger buns Ketchup, mustard and/or mayonnaise, for spreading (optional) Lettuce leaves, sliced tomato and/or sliced red onion, for topping Pickles, for serving (optional) ) ; *** For new recipes, paste new preparations between the two parentheses below Mix = ( Divide the beef into 4 equal portions. Press a cube of pepper jack into the center of each and shape the meat around the cheese; form into patties, about 4 inches wide and 3/4 inch thick. Season the patties with salt and pepper. ) ; *** For new recipes, paste new cooking instructions between the two parentheses below Cook = ( Heat the vegetable oil in a large skillet over medium-high heat. Add the patties and cook until browned on the bottom, about 4 minutes. Flip the patties and top each with a slice of cheddar; cook 4 to 5 more minutes. ) ; *** For new recipes, paste new serving instructions between the two parentheses below Serve = ( Meanwhile, toast the hamburger buns and spread with ketchup, mustard and/or mayonnaise. Fill with the burgers and top with lettuce, tomato and/or red onion. Serve with pickles. ) Return ; Animal-style Cheeseburger Steps Text AnimalCheeseburger: ; *** For new recipes, paste new serving instructions between the two parentheses below Animal_Ingredients = ( 2 tablespoons vegetable oil, plus more for brushing 2 large onions, finely chopped Kosher salt 1/4 cup mayonnaise 2 tablespoons ketchup 1 tablespoon sweet pickle relish 1/2 teaspoon white vinegar 2 pounds ground beef chuck (preferably 60 percent lean) 4 hamburger buns, split 1/4 cup sliced dill pickles 3/4 cup shredded iceberg lettuce 4 to 8 thin slices tomato Freshly ground pepper 1/4 cup yellow mustard 8 slices American cheese ) ; *** For new recipes, paste new preparations between the two parentheses below Animal_Onions = ( Heat the vegetable oil in a large skillet over medium-low heat. Add the onions and 3/4 teaspoon salt, cover and cook, stirring occasionally, until golden and soft, about 30 minutes. (If the onions brown too quickly, reduce the heat to low.) Uncover, increase the heat to medium high and continue to cook, stirring often, until caramelized, about 8 more minutes. Add 1/2 cup water to the skillet, scraping up any browned bits from the bottom of the pan. Simmer, stirring, until the water evaporates, about 2 more minutes; transfer to a bowl and set aside. (The onions can be made up to 3 days ahead; cover and refrigerate, then reheat before using.) ) ; *** For new recipes, paste new preparations between the two parentheses below Animal_Sauce = ( Mix the mayonnaise, ketchup, relish and vinegar in a bowl; set aside. ) ; *** For new recipes, paste new preparations between the two parentheses below Animal_Mix = ( Shape the beef into 8 patties, about 4 inches wide and 1/2 inch thick. ) ; *** For new recipes, paste new serving instructions between the two parentheses below Animal_Buns = ( Heat a griddle or skillet over medium heat; lightly brush with vegetable oil. Toast the buns on the griddle, split-side down. Spread each toasted bun bottom with about 1 tablespoon of the mayonnaise mixture, then top with a few pickles, some lettuce, 1 or 2 slices tomato and another dollop of the mayonnaise mixture; set aside. (Keep the griddle hot.) ) ; *** For new recipes, paste new cooking instructions between the two parentheses below Animal_Cook = ( Season both sides of the patties with salt and pepper. Working in batches if necessary, put the patties on the griddle and cook 3 minutes. Spread about 1 1/2 teaspoons mustard on the uncooked side of each patty, then flip and top each with 1 slice cheese; continue cooking about 2 more minutes for medium doneness. Top 4 of the patties with caramelized onions, then cover with the remaining patties, cheese-side up ) ; *** For new recipes, paste new serving instructions between the two parentheses below Animal_Serve = ( Sandwich the double patties on the buns. ) Return ; Stuffed Animal-style Cheeseburger Steps Text StuffedAnimalCheeseburger: ; *** For new recipes, paste new serving instructions between the two parentheses below Stuffed_Animal_Ingredients = ( 2 tablespoons vegetable oil, plus more for brushing 2 large onions, finely chopped Kosher salt 1/4 cup mayonnaise 2 tablespoons ketchup 1 tablespoon sweet pickle relish 1/2 teaspoon white vinegar 1 1/2 pounds ground beef chuck 4 1/2-inch cubes pepper jack cheese (about 1 ounce total) 4 hamburger buns, split 1/4 cup sliced dill pickles 3/4 cup shredded iceberg lettuce 4 to 8 thin slices tomato Freshly ground pepper 1/4 cup yellow mustard 4 slices American cheese ) ; *** For new recipes, paste new cooking instructions between the two parentheses below Stuffed_Animal_Cook = ( Put the stuffed patties on the griddle and cook until browned on the bottom, about 4 minutes. Spread about 1 1/2 teaspoons mustard on the uncooked side of each patty, then flip and top each with 1 slice cheese; Flip the patties and top each with a slice of cheddar; cook 4 to 5 more minutes. Top the patties with caramelized onions. ) ; *** For new recipes, paste new cooking instructions between the two parentheses below Stuffed_Animal_Serve = ( Sandwich the stuffed patties in the buns. ) Return