How to make a symbol selector Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Super Foxy
Posts: 14
Joined: 22 Feb 2023, 11:28

How to make a symbol selector

Post by Super Foxy » 20 Mar 2024, 15:29

There are a lot of symbols that aren't included on the keyboard by default, so I wanna make a script that lets you open a window with clickable symbols (stored in a variable inside the script), so when I click one of them, it's automatically pasted as if it was the clipboard, If pasting is too complicated then I'd like to at least copy the symbol to the clipboard.

XMCQCX
Posts: 231
Joined: 14 Oct 2020, 23:44

Re: How to make a symbol selector

Post by XMCQCX » 20 Mar 2024, 16:28

You can try QAP (Quick Access Popup), a program written in AHK. It allows you to quickly create menus that can paste symbols, text, etc...
Snippets are pieces of text that you can paste into the active application using the QAP popup menu, hotstrings or shortcuts. Text snippets can contain characters, end-of-lines, and tabs.
https://www.quickaccesspopup.com/tag/sn ... %20Snippet.

Super Foxy
Posts: 14
Joined: 22 Feb 2023, 11:28

Re: How to make a symbol selector

Post by Super Foxy » 20 Mar 2024, 16:31

XMCQCX wrote:
20 Mar 2024, 16:28
You can try QAP (Quick Access Popup), a program written in AHK. It allows you to quickly create menus that can paste symbols, text, etc...
Snippets are pieces of text that you can paste into the active application using the QAP popup menu, hotstrings or shortcuts. Text snippets can contain characters, end-of-lines, and tabs.
https://www.quickaccesspopup.com/tag/sn ... %20Snippet.
Thanks a lot, that seems really useful

User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: How to make a symbol selector  Topic is solved

Post by flyingDman » 20 Mar 2024, 22:36

Save with UTF-8 with BOM

Code: Select all

#Requires AutoHotkey v2.0
SetKeyDelay 0
OnMessage(0x200, WM_MOUSEMOVE)

	
h:= 24, w := 26.5, v := 12              				; height & width for each symbol; v is number of symbols per row. 
MyArr := ["ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔŒÕÖØÙÚÛÜßàáâãäåæçèéêëìíîïñòóôœõöøùúûüÿ"
		 ,"≈∝≡≠≤≥×·÷∂′″∇‰°∴ø∈∩∪⊂⊃⊆⊇¬∧∨∃∀⇒⇔→↔↑ℵ∉°✓¿¡«»§¶†‡•-–—™©®¢€¥£₤¤√−±∞►◄"
		 ,"αβγδεζηθικλμνξοπρσςτυφχψωΓΔΘΛΞΠΣΦΨΩ∫∑∏"
		 ,"₀₁₂₃₄₅₆₇₈₉⁰¹²³⁴⁵⁶⁷⁸⁹✔✓❌❎✕✖✗✘❓❔❕❗⏰⌚⌛⏳♡⚡☹☝☠⛄⛅⚪⚫⏺⚬⛔⏸☂☔¼½⅔¾⅞♠♣♦♥☏"
		 ,"─━│┃┄┅┆┇┈┉┊┋┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿"
		 ,"▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟"]

MyGui := Gui("-caption AlwaysOnTop +E0x08000000")
MyGui.Title := "Symbols"
MyGui.SetFont("s12")
MyGui.MarginX := MyGui.MarginY := 0
MyTab := MyGui.Add("Tab3","-Wrap", ["ú","⊆","Ω","½","╣","▙"])

loop MyArr.length
	{
	MyTab.UseTab(a_index)
	for a,b in strsplit(MyArr[a_index])
		MyGui.add("text","x" mod((a-1),v)*w " y" floor((a-1)/v)*h+35 " w" w " h" h " center",b).onevent("click",(ctrl,*)=>send(ctrl.value))
	}
MyGui.show()											; MyGui.show("noactivate")
return
	
esc:: MyGui.hide

f12:: MyGui.show

WM_MOUSEMOVE(wparam, *)
	{
	if (wparam = 1) 									; so Left Mouse Buttom can Drag Window
		PostMessage 0xA1, 2,,, "Symbols" 				; WM_NCLBUTTONDOWN
	}	
see here for more: https://copypastecharacter.com/all-characters
14.3 & 1.3.7

User avatar
kunkel321
Posts: 1062
Joined: 30 Nov 2015, 21:19

Re: How to make a symbol selector

Post by kunkel321 » 21 Mar 2024, 11:50

flyingDman wrote:
20 Mar 2024, 22:36
Save with UTF-8 with BOM

Code: Select all

#Requires AutoHotkey v2.0
SetKeyDelay 0
OnMessage(0x200, WM_MOUSEMOVE)

	
h:= 24, w := 26.5, v := 12              				; height & width for each symbol; v is number of symbols per row. 
MyArr := ["ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔŒÕÖØÙÚÛÜßàáâãäåæçèéêëìíîïñòóôœõöøùúûüÿ"
		 ,"≈∝≡≠≤≥×·÷∂′″∇‰°∴ø∈∩∪⊂⊃⊆⊇¬∧∨∃∀⇒⇔→↔↑ℵ∉°✓¿¡«»§¶†‡•-–—™©®¢€¥£₤¤√−±∞►◄"
		 ,"αβγδεζηθικλμνξοπρσςτυφχψωΓΔΘΛΞΠΣΦΨΩ∫∑∏"
		 ,"₀₁₂₃₄₅₆₇₈₉⁰¹²³⁴⁵⁶⁷⁸⁹✔✓❌❎✕✖✗✘❓❔❕❗⏰⌚⌛⏳♡⚡☹☝☠⛄⛅⚪⚫⏺⚬⛔⏸☂☔¼½⅔¾⅞♠♣♦♥☏"
		 ,"─━│┃┄┅┆┇┈┉┊┋┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿"
		 ,"▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟"]

MyGui := Gui("-caption AlwaysOnTop +E0x08000000")
MyGui.Title := "Symbols"
MyGui.SetFont("s12")
MyGui.MarginX := MyGui.MarginY := 0
MyTab := MyGui.Add("Tab3","-Wrap", ["ú","⊆","Ω","½","╣","▙"])

loop MyArr.length
	{
	MyTab.UseTab(a_index)
	for a,b in strsplit(MyArr[a_index])
		MyGui.add("text","x" mod((a-1),v)*w " y" floor((a-1)/v)*h+35 " w" w " h" h " center",b).onevent("click",(ctrl,*)=>send(ctrl.value))
	}
MyGui.show()											; MyGui.show("noactivate")
return
	
esc:: MyGui.hide

f12:: MyGui.show

WM_MOUSEMOVE(wparam, *)
	{
	if (wparam = 1) 									; so Left Mouse Buttom can Drag Window
		PostMessage 0xA1, 2,,, "Symbols" 				; WM_NCLBUTTONDOWN
	}	
see here for more: https://copypastecharacter.com/all-characters
This is my new favorite thing!!! ↑
ste(phen|ve) kunkel

User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: How to make a symbol selector

Post by flyingDman » 21 Mar 2024, 11:53

kunkel321 wrote:
21 Mar 2024, 11:50
This is my new favorite thing!!! ↑
Glad you like it! :thumbup:
14.3 & 1.3.7

User avatar
andymbody
Posts: 904
Joined: 02 Jul 2017, 23:47

Re: How to make a symbol selector

Post by andymbody » 22 Mar 2024, 08:36

flyingDman wrote:
20 Mar 2024, 22:36
Save with UTF-8 with BOM
Thanks for this!

Saved as instructed... some symbols are still just generic blocks (placeholders). Is there a way to fix this?
This is Win7, if that makes a difference.
2024-03-22 08_38_29-Symbols.png
2024-03-22 08_38_29-Symbols.png (2.21 KiB) Viewed 142 times

RussF
Posts: 1269
Joined: 05 Aug 2021, 06:36

Re: How to make a symbol selector

Post by RussF » 22 Mar 2024, 09:04

What displays depends on what font you have selected.

Russ

User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: How to make a symbol selector

Post by flyingDman » 22 Mar 2024, 09:15

They all show up on my Win11 PC.
20240322_071354.jpg
20240322_071354.jpg (16.42 KiB) Viewed 133 times
14.3 & 1.3.7

User avatar
andymbody
Posts: 904
Joined: 02 Jul 2017, 23:47

Re: How to make a symbol selector

Post by andymbody » 22 Mar 2024, 09:35

RussF wrote:
22 Mar 2024, 09:04
What displays depends on what font you have selected.
Did a simple copy/paste from code window. The characters in code window display fine, but once pasted, the characters are blocks as shown in the image. This also happens if I first create a new doc in Notepad++ and make it UTF-8 BOM prior to pasting. Also tried saving the code as a file using download button, and get same results. And if I copy, then paste as if I am posting a reply here, it is pasted correctly. So it's not related to clipboard either. Might be a Win7 thing.

Update... ok... I don't know what happened, but now the characters look fine in the Scite code window, but still don't display correctly in the GUI window. Do I need to set a font for the GUI? Is this what you mean by "what font you have selected"?

Tested on Win 10, and works fine, so must be related to how Win7 displays fonts in the AHK Gui's? Maybe there is a way to adjust that. But my search has not been fruitful yet.

If you feel I should try something else, I will give it a shot.

BTW... I changed the width to this so the tabs will adjust to screen resolution
w := 33/(A_ScreenDPI/96)

Thanks!
Andy

jinok
Posts: 3
Joined: 17 Jul 2023, 00:27

Re: How to make a symbol selector

Post by jinok » 22 Mar 2024, 10:58

Code: Select all

#Requires AutoHotkey v2.0 64-bit
#SingleInstance Force

Symbols :=  [
    ["∙","•","●","○","■","□","◆","◇","★","☆"],
    ["▶","▷","▲","△","▼","▽","◀","◁","♡","♥"],
    ["※","±","㎡","〈〉","「」","『』","【】","","", ""],
    ["①","②","③","④","⑤","⑥","⑦","⑧","⑨","⑩"],
    ["⑪","⑫","⑬","⑭","⑮","←","↑","↓","→",""]
]
    
MyGui := Gui(,"Symbols")
MyGui.Opt("AlwaysOnTop")
YY:=10
loop 5
    {
        HH := A_Index
        XX := 10 
        loop 10
            {
                RR := A_Index
                MyGui.Add("Button", "w30 X" XX " Y" YY, Symbols[HH][RR]).OnEvent("Click", OKClick)
                XX := XX + 30 
            }
        YY := YY + 22
    }
MyGui.Show("Hide")

OKClick(Btn, info)
{
    MyGui.hide
    if Btn.text = "〈〉" or Btn.text = "「」" or Btn.text ="『』" or Btn.text ="【】"
        Send Btn.text "{left 1}{space 2}{left 1}"
    else if Btn.Text
        Send Btn.text "{space}"
    sleep 50
    MyGui.Restore
}

^NumpadMult::
{
    MyGui.Show()
    WinSetTransparent 220, "Symbols"
}     



User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: How to make a symbol selector

Post by flyingDman » 22 Mar 2024, 11:02

andymbody wrote:
22 Mar 2024, 09:35
Might be a Win7 thing.
... I am afraid it is. (it also works fine on an older Win 10 PC and no DPI adjustments were needed)
14.3 & 1.3.7

User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: How to make a symbol selector

Post by flyingDman » 22 Mar 2024, 15:39

@jinok I like the open and closing brackets with 2 spaces!
Note: if you include the +E0x08000000 in the gui options you can remove the MyGui.hide and MyGui.restore and the gui will not flicker. +E0x08000000 allows you send to the window below the script's window.
14.3 & 1.3.7

Post Reply

Return to “Ask for Help (v2)”