below you see a copy of a file I wrote some times ago. Now that I want to convert it to V2 I was first testing if it runs in v1, but it does not.
I have been trying for hours now.
What I do as the user of this script:
First I click to where I want to paste some text with my mouse.
Second I start my menu with ^1 (several informations - line by line read from a text file - are - line by line - displayed in the menu).
Then I select the information from the menu and the selected information is pasted.
Therefore I want to read a txt-file first, but my MsgBox stays empty.
Code: Select all
^1::
Text := []
Loop, read, "C:\Users\Hp\Desktop\Daten.txt"
{
newText := A_LoopReadLine
Text := %Text% . "¦" . %newText%
}
MsgBox %Text%
;TextMenu(Text)
return
TextMenu(TextOptions){
for k, MenuItems in StrSplit(TextOptions,"¦")
Menu,MyMenu,Add,% trim(MenuItems),Action
Menu,MyMenu,Show
Menu,MyMenu,DeleteAll
}
Action:
ClipboardBackup:=ClipboardAll
Clipboard:=""
Clipboard:=A_ThisMenuItem
Clipwait,1
Send ^v
Sleep, 200
Clipboard:=ClipboardBackup
return
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]