Fractions command

Share your favorite FastKeys commands
Post Reply
burque505
Posts: 9
Joined: Apr 8th, ’17, 16:55

Post by burque505 » Apr 8th, ’17, 17:13

Hi, this is my first visit. I'm trying out FastKeys. I'm an utter novice at AutoHotkey also, but I'm already getting some mileage out of it.

This little script, which is from an AHK script I use a lot, shows there's more than one way to show a menu for selections. Here, from the "Text Expander" tab on the menu, I use Insert->New for a new entry. I use "Command" as the Type for the Substitute, and "Trigger immediately" in Options.
The string I use to trigger it is ;fractions, the first reason being obvious and the second just because I like to start my strings with a semicolon (reason being that in normal typing there will always be a space after the semicolon).
Please note I've changed my "Separator" in Settings from the default to "|".

As you'll notice, you can get a completely different menu by replacing or adding entries, between the "|" separators or after the last "|" separator of course, in line:
TextMenu("¼|½|¾|⅓|⅔|⅕|⅖|⅗|⅘|⅙|⅚|⅛|⅜|⅝|⅞")

Code: Select all

TextMenu("¼|½|¾|⅓|⅔|⅕|⅖|⅗|⅘|⅙|⅚|⅛|⅜|⅝|⅞")
Return

TextMenu(TextOptions)
{
 StringSplit, MenuItems, TextOptions , `|
 Loop %MenuItems0%
 {
   Item := MenuItems%A_Index%
   Menu, MyMenu, add, %Item%, MenuAction
 }
 Menu, MyMenu, Show
 Menu, MyMenu, DeleteAll      
}
MenuAction:
SendInput %A_ThisMenuItem%{Raw}%A_EndChar%
Return
I hope this may be useful to somebody.

Thanks for the program, Marko, I'll register soon unless I come across some deal-breaker.
thinman
Posts: 25
Joined: May 17th, ’13, 15:44

Post by thinman » Apr 11th, ’17, 07:05

Great idea, this will be very useful for me. Thanks!
burque505
Posts: 9
Joined: Apr 8th, ’17, 16:55

Post by burque505 » Apr 12th, ’17, 21:19

Thanks, thinman, that's encouraging! :D
Post Reply