So this what i look for:
I have personal information in my computer, like my social number, login name at several sites etc. etc.
Now, when i need it, i open up a txt file with all of these information in it, then, i have to select a line, copy it, then paste it to (for example) an login page
I would prefer if it could be this way:
press a key combination like ctrl+i and this would be triggered to open an list with all of my personal info and with the option to select all (line) and then copy it to clipboard, or even more handy, select a line and it will then automatic copy this line of text to the clipboard which then can be pasted in any window
I know i ask alot, but it would be very helpfull if this can be done with ahk
How to display a list and copy to clipboard a selected text (see example)
Re: How to display a list and copy to clipboard a selected text (see example)
Try this script:loek3000 wrote: ↑17 Oct 2018, 17:36So this what i look for:
I have personal information in my computer, like my social number, login name at several sites etc. etc.
Now, when i need it, i open up a txt file with all of these information in it, then, i have to select a line, copy it, then paste it to (for example) an login page
I would prefer if it could be this way:
press a key combination like ctrl+i and this would be triggered to open an list with all of my personal info and with the option to select all (line) and then copy it to clipboard, or even more handy, select a line and it will then automatic copy this line of text to the clipboard which then can be pasted in any window
I know i ask alot, but it would be very helpfull if this can be done with ahk
(replace «"C:\Users\·\Desktop\test.txt"» at the start with your file path)
Code: Select all
^i::
If !(gFile) {
gFile:="C:\Users\·\Desktop\test.txt"
GoSub, ClipGui
} else {
Gui, clip: destroy
If (gChoose<>"") {
gFile := StrSplit(gFile,"|")
While !(strSplit(gChoose,"|")[a_index]="")
gClip .= (a_index=1?"":"`r`n") . gFile[strSplit(gChoose,"|")[a_index]]
Clipboard := gClip, gClip:=""
SplashTextOn, 50, 23,, Copy!
Sleep, 700
SplashTextOff
} gFile:=gChoose:=""
} Return
ClipGui:
FileRead, gFile, % gFile
gFile:=StrReplace(gFile,"`r`n","|") . "|", gg:=1
Gui,clip: Font, s14 cRed, Lucida Console
Gui,clip: Add, ListBox,w200 multi vVar gChoser altsubmit h140 ,%gFile%
GuiControl,clip: Choose, Var,12
Gui,clip:show
Return
Choser:
Gui,clip:Submit,Nohide
GuiControlGet, gChoose,,Var
Return
• Select line(s) to copy to clipboard.
• {again} Ctrl+i: Copy selection to clipboard ("Copy!" notification).
+ If no press anything (no selection), clipboard don't change
Hope it helps,
Re: How to display a list and copy to clipboard a selected text (see example)
Ah great thank you !
But i thing? instead of selecting a line (which is good) can it be copied into clipboard by double click it instead of (again) ctrl-i ?
so in this script, it will open the file, i select a line of text to be copied by double clicking on it
just a second, i will upload a picture
But i thing? instead of selecting a line (which is good) can it be copied into clipboard by double click it instead of (again) ctrl-i ?
so in this script, it will open the file, i select a line of text to be copied by double clicking on it
just a second, i will upload a picture
Re: How to display a list and copy to clipboard a selected text (see example)
I suggest just setting up a password manager
Re: How to display a list and copy to clipboard a selected text (see example)
Thanx, but, a password manager would not do the trick for me, i want to be able to quicly display and copy a textline...
But i added a screenshot:
But i added a screenshot:
Re: How to display a list and copy to clipboard a selected text (see example)
Ok, well, i asked for help on ahk, because i don't want to install another app... thanx anyway
Re: How to display a list and copy to clipboard a selected text (see example)
I want to give it a try tho...... what's the name of this PW manager?
Re: How to display a list and copy to clipboard a selected text (see example)
Thanx, i've installed it (because i already did a search) and i'm searching for the display you have in your example here, where you have to (only) double click, but i don't see it
Re: How to display a list and copy to clipboard a selected text (see example)
listview double click example:
Code: Select all
#NoEnv
#SingleInstance Force
SetBatchLines -1
myTxtFile =
(
row1key|row1value
row2key|row2value
)
Gui Add, ListView, r10 Grid gLvHandler +HWNDhLV, Key|Value
for each, Line in StrSplit(myTxtFile, "`n", "`r")
{
Columns := StrSplit(Line, "|")
LV_Add("", Columns*)
}
LV_ModifyCol()
Gui Show
Return
GuiClose:
GuiEscape:
ExitApp
Return
LvHandler:
if (A_GuiEvent == "DoubleClick")
{
Row := A_EventInfo
Col := LV_SubitemHitTest(hLV)
LV_GetText(result, Row, Col)
Clipboard := result
MsgBox % "copied: " Clipboard
}
Return
; https://autohotkey.com/board/topic/80265-solved-which-column-is-clicked-in-listview/
LV_SubitemHitTest(HLV) {
; To run this with AHK_Basic change all DllCall types "Ptr" to "UInt", please.
; HLV - ListView's HWND
Static LVM_SUBITEMHITTEST := 0x1039
VarSetCapacity(POINT, 8, 0)
; Get the current cursor position in screen coordinates
DllCall("User32.dll\GetCursorPos", "Ptr", &POINT)
; Convert them to client coordinates related to the ListView
DllCall("User32.dll\ScreenToClient", "Ptr", HLV, "Ptr", &POINT)
; Create a LVHITTESTINFO structure (see below)
VarSetCapacity(LVHITTESTINFO, 24, 0)
; Store the relative mouse coordinates
NumPut(NumGet(POINT, 0, "Int"), LVHITTESTINFO, 0, "Int")
NumPut(NumGet(POINT, 4, "Int"), LVHITTESTINFO, 4, "Int")
; Send a LVM_SUBITEMHITTEST to the ListView
SendMessage, LVM_SUBITEMHITTEST, 0, &LVHITTESTINFO, , ahk_id %HLV%
; If no item was found on this position, the return value is -1
If (ErrorLevel = -1)
Return 0
; Get the corresponding subitem (column)
Subitem := NumGet(LVHITTESTINFO, 16, "Int") + 1
Return Subitem
}
Re: How to display a list and copy to clipboard a selected text (see example)
Ah nice !!
almost perfect for me, but instead of putting all of the data into this script, can it read a .txt file instead?
if not i'm very happy with this already
thank you so much
almost perfect for me, but instead of putting all of the data into this script, can it read a .txt file instead?
if not i'm very happy with this already
thank you so much
Re: How to display a list and copy to clipboard a selected text (see example)
Nevermind, this is just as perfect for me as i was looking for
i added several rows and made the window a little wider..
thanks alot, this was just what i was looking for
i added several rows and made the window a little wider..
thanks alot, this was just what i was looking for