Rich4rd

TextMenuWithSeparateActionsForMenuItems

Jun 7th, 2019
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance Force
  2. ;Text Menu with words
  3. TextMenu(TextOptions)
  4. {
  5.  StringSplit, MenuItems, TextOptions ,
  6.  Loop %MenuItems0%
  7.   {
  8.     Item := MenuItems%A_Index%
  9.     ;Menu, TxtMenu, add, %Item%, TxtMenuAction
  10.     Menu, TxtMenu, add, %Item%, TxtMenuAction
  11.   }
  12.  Menu, TxtMenu, Show
  13.  Menu, TxtMenu, DeleteAll
  14. }
  15.  
  16. TxtMenuAction:
  17. SendInput %A_ThisMenuItem%{raw}%A_EndChar%
  18. Return
  19. ;Text menu with separate actions of menu items
  20. :*:ryg::
  21.   TextMenu("It's red.¦It's yellow.¦It's green.")
  22. If A_thismenuitem = It's red.
  23.   SendInput, {Raw}
  24. (
  25.  Stop.
  26. )
  27. If A_thismenuitem = It's yellow.
  28.   SendInput, {Raw}
  29. (
  30.  Get ready.
  31. )
  32. If A_thismenuitem = It's green.  
  33.   SendInput, {Raw}
  34. (
  35.  Safe to drive.
  36. )
  37. Return
Advertisement
Add Comment
Please, Sign In to add comment