Help with Doubleclick Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Tomer
Posts: 314
Joined: 21 Aug 2016, 05:11

Help with Doubleclick

31 May 2020, 08:58

I want the Ok button make the same action exactly the Doubleclick does

Thanks in advnace

Code: Select all

vDir1 = c:

Gui,2:default
Gui,2: Add , ListView, r25 w323 backgroundGray cYellow grid vLV1 gLV1a altsubmit Multi, #|%vDir1%|Fullpath|Date
Gui,2: Add , Button,vLV2 gLV1a, Ok 
LV_ModifyCol(1,0)
LV_ModifyCol(2,200)
LV_ModifyCol(3,0)
LV_ModifyCol(4,100)
LV_ModifyCol(1,"integer")
LV_ModifyCol(2,"left")
LV_ModifyCol(4,"digit")
LV_ModifyCol(4, "left") 

Gui,2: Show
gosub,fill
return
exitapp


Fill:
Gui,2: Submit, Nohide

Loop, 2
	Gui,2:ListView, LV%A_Index%

ib=0
LV_Delete()
Loop, Files, % vDir1 "\*", D                        ;- folders
{
	if A_LoopFileName in %foldersBlacklist%
	{
		excludedFolders .= """" . A_LoopFileFullPath . """ "
		continue
	}
   ib++	
   SplitPath,A_LoopFileFullPath, name, dir, ext, name_no_ext, drive
   LV_Add("",ib,name,A_LoopFileFullPath,a_loopfiletimemodified)

}
LV_ModifyCol(4, "Logical SortDesc") 
return
;----------------

LV1a:
Gui,2: Submit, Nohide

Loop, 2
	Gui,2:ListView, LV%A_Index%

RC:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
  If A_GuiEvent=Doubleclick
     {
     LV_GetText(C1,A_EventInfo,1)
     LV_GetText(C2,A_EventInfo,2)
     LV_GetText(C3,A_EventInfo,3)
     LV_GetText(C4,A_EventInfo,4)
     path := c3
	 ;~ msgbox, %path%
	 goto, goit!
     return
     }
return

goit!:
msgbox, %path%
ExitApp
garry
Posts: 2279
Joined: 22 Dec 2013, 12:50

Re: Help with Doubleclick  Topic is solved

31 May 2020, 09:34

tried with a function from user 'just me'

Code: Select all

;- Help with Doubleclick 
;- https://www.autohotkey.com/boards/viewtopic.php?f=76&t=76703

vDir1 = c:
Gui,2:default
Gui,2: Add , ListView, r25 w323 backgroundGray cYellow grid vLV1 gLV1a altsubmit Multi hwndHLV, #|%vDir1%|Fullpath|Date
Gui,2: Add , Button,vLV2 gOK, Ok 
LV_ModifyCol(1,0),LV_ModifyCol(2,200),LV_ModifyCol(3,0),LV_ModifyCol(4,100),LV_ModifyCol(1,"integer"),LV_ModifyCol(2,"left"),LV_ModifyCol(4,"digit"),LV_ModifyCol(4, "left") 
Gui,2: Show
gosub,fill
return
;-----------------
2Guiclose:
exitapp
;-----------------
Ok:
aa:= LV_GetNext(0, "F")
LV_ClickRow(HLV,aa)
LV_GetText(C3,aa,3)
msgbox, 262208, ,%c3%,1
run,%c3% 
return
;-----------------
Fill:
Gui,2: Submit, Nohide
Gui,2:ListView, LV1
ib=0
LV_Delete()
Loop, Files, % vDir1 "\*", D                        ;- folders
{
	if A_LoopFileName in %foldersBlacklist%
	{
		excludedFolders .= """" . A_LoopFileFullPath . """ "
		continue
	}
   ib++	
   SplitPath,A_LoopFileFullPath, name, dir, ext, name_no_ext, drive
   LV_Add("",ib,name,A_LoopFileFullPath,a_loopfiletimemodified)
}
LV_ModifyCol(4, "Logical SortDesc") 
return
;----------------------
LV1a:
Gui,2: Submit, Nohide
Gui,2:ListView, LV1
RC:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
  If A_GuiEvent=Doubleclick
     {
     LV_GetText(C1,A_EventInfo,1)
     LV_GetText(C2,A_EventInfo,2)
     LV_GetText(C3,A_EventInfo,3)
     LV_GetText(C4,A_EventInfo,4)
     path := c3
	 msgbox, 262208, ,%path%
	 ;goto, goit!
     return
     }
return
;--------------------
GoIt:
return
;--------------------
LV_ClickRow(HLV, Row) { ; just me -> http://www.autohotkey.com/board/topic/86490-click-listview-row/#entry550767
   ; HLV : ListView's HWND, Row : 1-based row number
   VarSetCapacity(RECT, 16, 0)
   SendMessage, 0x100E, Row - 1, &RECT, , ahk_id %HLV% ; LVM_GETITEMRECT
   POINT := NumGet(RECT, 0, "Short") | (NumGet(RECT, 4, "Short") << 16)
   PostMessage, 0x0201, 0, POINT, , ahk_id %HLV% ; WM_LBUTTONDOWN
   PostMessage, 0x0202, 0, POINT, , ahk_id %HLV% ; WM_LBUTTONUP
}
;======================================
User avatar
Tomer
Posts: 314
Joined: 21 Aug 2016, 05:11

Re: Help with Doubleclick

01 Jun 2020, 02:35

Thanks garry !
works perfect :D
garry
Posts: 2279
Joined: 22 Dec 2013, 12:50

Re: Help with Doubleclick

01 Jun 2020, 10:47

found also another easy example

Code: Select all

;- Access to ListView data from Button subroutine? 
;- https://www.autohotkey.com/boards/viewtopic.php?f=5&t=52211

Gui, Add, ListView, r20 w500 gMyListView vLV, Name|Size (KB)
Loop, %A_Desktop%\*.*
    LV_Add("", A_LoopFileName, A_LoopFileSizeKB)
LV_ModifyCol()
LV_ModifyCol(2, "Integer")
Gui, Add, Button, gShowName, Show Name
Gui, Show
return
MyListView:
if (A_GuiEvent = "DoubleClick")
{
    LV_GetText(RowText, A_EventInfo)
    MsgBox, %RowText% ; Works fine
}
return
GuiClose:
ExitApp
ShowName:
Gui,1:ListView, LV1
;RC:=LV_GetNext("C")    ;- also OK
RF:=LV_GetNext("F")
if (rf=0)
  return
LV_GetText(Text, RF)
MsgBox % Text
Return
User avatar
Tomer
Posts: 314
Joined: 21 Aug 2016, 05:11

Re: Help with Doubleclick

01 Jun 2020, 12:57

Looks more simple indeed
Will definitely check it out!

Tnx!!

Return to “Ask For Help”

Who is online

Users browsing this forum: Ben, Bing [Bot], Google [Bot], kdservices, ManualColdSwitch, Ploaie, tee_rock, vsub and 143 guests