Fractions command

Share your favorite FastKeys commands
Posts: 9
Joined: Sat Apr 08, 2017 3:55 pm

Fractions command

PostPosted by burque505 » Sat Apr 08, 2017 4:13 pm

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.

Posts: 20
Joined: Fri May 17, 2013 2:44 pm

Re: Fractions command

PostPosted by thinman » Tue Apr 11, 2017 6:05 am

Great idea, this will be very useful for me. Thanks!

Posts: 9
Joined: Sat Apr 08, 2017 3:55 pm

Re: Fractions command

PostPosted by burque505 » Wed Apr 12, 2017 8:19 pm

Thanks, thinman, that's encouraging! :D

Return to User Commands and Scripts

Who is online

Users browsing this forum: No registered users and 1 guest