After pressing the hotkey {^;} , a menu pop up so that I can select the items using Up|Down keys and hit {Enter} which will paste the selected string into my Text Editor
Currently all strings are in single line.
I have tried to make it into multi lines strings by using "Hello, How are you?`nHello"
I expect the strings I inserted to be like below.
Hello, How are you?
Hello
Now The string after`n turned into another new string instead
However the end result became like attached file
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
#Requires AutoHotkey v1.1
#SingleInstance,Force
; To add new content add the pipe ¦ at the begning of a new line for what you want to have in here and reload
Text=
(
¦This is an example
¦Hello, How are you?`nHello
)
sort,text ;If you'd like it alphabatized
^;:: ;when hit Control+Shift+L the menu will appear. Arrow up/down to select one and hit enter
TextMenu(Text) ;Trigger TextMenu function with text
return
TextMenu(TextOptions){
for k, MenuItems in StrSplit(TextOptions,"¦") ;parse the data on the weird pipe charachter
Menu, MyMenu,Add,% trim(MenuItems),Action ;Add each item to the Menu
Menu, MyMenu, Show ;Display the GUI and wait for action
Menu, MyMenu, DeleteAll ;Delete all the menu items
}
Action:
ClipboardBackup:=ClipboardAll ;backup clipboard
Clipboard:=""
Clipboard:=A_ThisMenuItem ;Shove what was selected into the clipboard
ClipWait,1
Send, ^v ;paste the text
sleep, 100 ;Remember to sleep before restoring clipboard or it will restore the clipboard before pasting
Clipboard:=ClipboardBackup ;Restore clipboard
return