Hallo!
I am trying to get closer to the capable script writers and programmers using AutoHotKey.
I am building a simple framework to use for translations between English and German and the reverse.
I want to try and make it based on scripts. The first will be a list view.
The list view will have a csv file input which it presents in five columns.
I will use a simple key as the first of the five columns to prevent sorting the entries.
If I get help, with a simple script, I will be able to begin by building a structure for other scripts.
I look forward to any help, that I can be given.
Thanks in advance, forkinpmj.
I am in search of a simple List View script with 5 columns
Re: I am in search of a simple List View script with 5 colum
Hi! and Welcome!
For diving right into Gui's, you can start by taking a look at the the help docs on creating Gui's. Try some code and if you get stuck, search the forum for an answer and if you still can't figure it out post your code and someone will help you out!
Good luck and have fun!
For diving right into Gui's, you can start by taking a look at the the help docs on creating Gui's. Try some code and if you get stuck, search the forum for an answer and if you still can't figure it out post your code and someone will help you out!
Good luck and have fun!
Re: I am in search of a simple List View script with 5 colum
sample 1: (Basic | Grundstufe)
sample 2: (Intermediate | Mittelstufe)
sample 3: (Advanced/Hardcore | Hartenkern )
Code: Select all
; http://www.autohotkey.com/board/topic/88667-adjust-listview-area-to-total-of-column-widths/
; http://msdn.microsof...b761049(v=vs.85).aspx
#NoEnv
LVM_GETITEMRECT := 0x100E
Gui, Add, ListView, w10 vVLV hwndHLV, Col A|Col B|Col C ; create a ListView with a too small width
LV_Add("", 23,35,67)
LV_Add("", 65,43,22)
LV_Add("", 88,94,23)
Loop, 3
LV_ModifyCol(A_Index, "AutoHdr")
VarSetCapacity(RECT, 16, 0)
SendMessage, LVM_GETITEMRECT, 0, &RECT, , ahk_id %HLV%
W := NumGet(RECT, 8, "Int") + 4 ; 4 needs to be adjusted if the ListView has a vertical scroll
GuiControl, Move, VLV, w%W%
Gui, Show, AutoSize ; must be AutoSize
Return
GuiClose:
ExitApp
Code: Select all
; http://www.autohotkey.com/board/topic/88667-adjust-listview-area-to-total-of-column-widths/
;#SingleInstance, force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases
SendMode Input ; Recommended for new scripts due to its superior speed and reliability
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
Gui,2:default
Gui,2: Font, default, Lucida Console
Gui,2:Color,Black
lsw:=550
gsw:=(lsw+50)
colw:=((lsw/3)-3)
Gui,2:Add,ListView,grid backgroundTeal cWhite x10 y25 w%lsw% h640 +hscroll altsubmit vA1 gA2, A|B|C
LV_Add("", 23,35,67)
LV_Add("", 65,43,22)
LV_Add("", 88,94,23)
LV_ModifyCol(1,colw)
LV_ModifyCol(2,colw)
LV_ModifyCol(3,colw)
Gui,2:Show, x50 y10 w%gsw% h760,Test
return
2Guiclose:
exitapp
a2:
return
Code: Select all
; http://ahkscript.org/boards/viewtopic.php?f=6&t=2072
lv1:=new listview()
lv2:=new listview("info","x+10 w500 h500")
lv3:=new listview("Stuff|stuff1","r6",2)
Loop,5
lv1.add("",6-A_Index),lv2.add("",A_Index),lv3.Add("",A_Index,6-A_Index)
Gui,1:Show
Gui,2:Show
return
2GuiEscape:
2GuiClose:
GuiEscape:
GuiClose:
ExitApp
return
class listview{
static tracker:=[]
__New(text="info",pos="w500 h500",win=1){
static
Gui,%win%:Add,ListView,%pos% ggo hwndhwnd NoSortHdr,%text%
GuiControl,%win%:+v%hwnd%,%hwnd%
this.tracker[hwnd]:=this
this.win:=win
this.hwnd:=hwnd
}
go(){
go:
go:=listview.tracker[A_GuiControl]
Gui,% go.win ":ListView",%A_GuiControl%
if (A_GuiEvent="DoubleClick"){
columns:=LV_GetCount("column"),text:=[]
Loop,% columns
{
LV_GetText(tt,LV_GetNext(),A_Index)
text[A_Index]:=tt
}
m("Item " LV_GetNext() " has a value of " text)
return
}
if (A_GuiEvent!="D")
return
while,GetKeyState("LButton","P"){
columns:=LV_GetCount("column"),text:=[]
Loop,% columns
{
LV_GetText(tt,LV_GetNext(),A_Index)
text[A_Index]:=tt
}
Sleep,100
t("Move " text.1)
}
t()
go.Move(A_EventInfo-1,LV_GetCount(),text)
return
}
move(start,last,text){
CoordMode,Mouse,Screen
MouseGetPos,mx,my
top:=this.item(0),bottom:=this.item(last-1)
if (my<top.t)
move:=1,pos:="above"
if (my>bottom.b)
move:=last,pos:="below"
if !move
Loop,% last{
item:=this.item(A_Index-1)
if (my>item.t&&my<item.b){
move:=A_Index
pos:=((item.b-item.t)/2)+item.t+1<my?"Below":"Above"
break
}
}
if move{
move:=(start+1<move)?move:move+1
move:=pos="above"?move-1:move
LV_Delete(start+1),LV_Insert(move,"",text.1)
for a,b in text
if A_Index>1
LV_Modify(move,"col" A_Index,b)
}
return
}
item(item){
WinGetPos,x,y,w,h,ahk_id%A_GuiControl%
VarSetCapacity(rect,16),NumPut(2,rect),info:=[]
SendMessage,% 0x1000+14,%item%,&rect,,ahk_id%A_GuiControl%
for a,b in {l:0,t:4,r:8,b:12}
info[a]:=NumGet(rect,b)
info.t+=y,info.b+=y
return info
}
add(x*){
Gui,% this.win ":Default"
Gui,% this.win ":ListView",% this.hwnd
item:=LV_Add(x.1,x.2)
for a,b in x
if A_Index>2
LV_Modify(item,"col" A_Index-1,b)
}
}
m(x*){
for a,b in x
list.=b "`n"
MsgBox,% list
}
t(x*){
for a,b in x
list.=b "`n"
Tooltip,% list
}
Re: I am in search of a simple List View script with 5 colum
Catch a man a fish...
Re: I am in search of a simple List View script with 5 colum
dank garry für den Hinweis zu dieser site!
garry wrote:some old basic examples
http://www.autohotkey.com/board/topic/4 ... rlprogram/
I am in search of a simple List View script with 5 columns
Hallo!
I wrote the original post on this subject.
I have written a first script to address my problem and needs.
#SingleInstance
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
Gui, Add, ListView, r23 w400, Row Key|Column 1|Column 2|Column 3|Column 4
; Generated using SmartGUI Creator for SciTE
; Create the ListView with five columns,for table texts:
Gui, Show, w425 h368, Untitled GUI
return
; the ListView will be used to display tabulated data
; the data to be entered into the above columns is a csv file
; its content is the following
; TRKey|Column 1|Column 2|Column 3|Column 4
; aaa |The boy |The boy |[nom m s] |Der Junge
; aab |has |is |[v m 3ps] |ist
; aac |gone |alone |[adv] |allein
; aad |to school |to school |[pr dat f s] |zur Schule
; aae |alone. |gone. |[v pp] |gegangen.
;
; It begins with a row key which is used to prevent sorting
; I cannot seem to fimd the corrct way to link the data to the columns
; I have found no documentation to explain how to do what I need
GuiClose:
ExitApp
You will see that I still need some help. I hope that you can give it to me.
Regards patforkin
I wrote the original post on this subject.
I have written a first script to address my problem and needs.
#SingleInstance
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
Gui, Add, ListView, r23 w400, Row Key|Column 1|Column 2|Column 3|Column 4
; Generated using SmartGUI Creator for SciTE
; Create the ListView with five columns,for table texts:
Gui, Show, w425 h368, Untitled GUI
return
; the ListView will be used to display tabulated data
; the data to be entered into the above columns is a csv file
; its content is the following
; TRKey|Column 1|Column 2|Column 3|Column 4
; aaa |The boy |The boy |[nom m s] |Der Junge
; aab |has |is |[v m 3ps] |ist
; aac |gone |alone |[adv] |allein
; aad |to school |to school |[pr dat f s] |zur Schule
; aae |alone. |gone. |[v pp] |gegangen.
;
; It begins with a row key which is used to prevent sorting
; I cannot seem to fimd the corrct way to link the data to the columns
; I have found no documentation to explain how to do what I need
GuiClose:
ExitApp
You will see that I still need some help. I hope that you can give it to me.
Regards patforkin
Re: I am in search of a simple List View script with 5 colum
ich lief ihr Skript und ich bekam ein leeres Feld!
Re: I am in search of a simple List View script with 5 colum
other archived ListView scripts:
Code: Select all
; http://www.autohotkey.com/board/topic/4279-listview-select-column-and-start-emailurlprogram/
;-------- http://www.autohotkey.com/forum/topic4526.html&highlight=listview ---
;adress.ahk garry 2005-07-18
;doubleclick at column starts URL,EMAIL,PROGRAM
;one click see Name Adress below
#NoTrayIcon
F1=ADRESS.CSV
Gui, Color, 000000
Gui, Font, S10 CDefault , FixedSys
ifnotexist,adress.csv
{
Fileappend,AUTOHOTKEYFORUM`;New York`;http://www.autohotkey.com/forum/`;[email protected]`;C:\program files\AutoHotkey\autohotkey.chm`r`n,%F1%
Fileappend,SCOTTSERVER `;Los Angeles`;http://www.scottserver.net/forum/`;[email protected]`;`r`n,%F1%
Fileappend,SLEEPY `;Alabama`;http://sleepyssin.suddenlaunch3.com/`;[email protected]`;`r`n,%F1%
Fileappend,Streamripper `;`;http://streamripper.sourceforge.net/`;`;`r`n,%F1%
Fileappend,CANDLE `;Oslo`;http://www.candles-weblog.us`;[email protected]`;`r`n,%F1%
Fileappend,WhizCat `;Atlanta`;http://scottserver.net/whizware`;[email protected]`;`r`n,%F1%
Fileappend,CORRUPT `;Arkansas`;http://www.apps4apps.filetap.com/`;[email protected]`;`r`n,%F1%
}
T1=160 ;column1 width
T2=200 ;column2 width
T3=200 ;column3 width
T4=150 ;column4 width
T5=300 ;column5 width
T1A:=T1
T2A:=T1+T2
T3A:=T1+T2+T3
T4A:=T1+T2+T3+T4
T5A:=T1+T2+T3+T4+T5 ;listview width
T5B:=T5A+30 ;guishow width
T5C:=T5A-70 ;Position Button AddNew
T5D:=T5A-160 ;Position Button refresh
Gui,Add, ListView,grid r20 w%T5A% +hscroll altsubmit vMyListView gMyListView, Name|City|URL|EMAIL|Program
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
LV_ModifyCol(4,T4)
LV_ModifyCol(5,T5)
Gui, Font, S8 cwhite, Verdana
Gui, Add, Edit, x12 y355 w%T5A% h20 ReadOnly vC,
Gui,Add,Button, x%T5C% y378 w70 h20,AddNew
;Gui,Add,Button, x%T5D% y378 w70 h20,Refresh
gosub,LB1
Gui, Show, x2 y0 w%T5B% h400 ,LISTVIEW
return
LB1:
Gui,1:default
Gui,Listview,Mylistview
LV_Delete()
loop,read,%F1%
{
stringsplit,BX,A_LoopReadLine,`;,
LV_Add("",BX1,BX2,BX3,BX4,BX5)
}
return
buttonAddNew:
C1:=
C2:=
C3:=
C4:=
C5:=
GuiControl,,C1, %C1%
GuiControl,,C2, %C2%
GuiControl,,C3, %C3%
GuiControl,,C4, %C4%
GuiControl,,C5, %C5%
GuiControl,focus,C1
Gui,2:Font, S10 CDefault , FixedSys
Gui,2:Add,Text, x1 y5 w80 h20,NAME
Gui,2:Add,Edit, x80 y5 w420 h20 vC1,%C1%
;Gui,2:Add,Text, x1 y35 w80 h20,CITY
;Gui,2:Add,Edit, x80 y35 w420 h20 vC2,%C2%
Gui,2:Add,Text, x1 y35 w80 h20,STATE
Gui,2:Add, DropDownList,x80 y35 w420 vC2, Arizona|Arkansas|Texas|Alabama|Oklahoma
Gui,2:Add,Text, x1 y65 w80 h20,URL
Gui,2:Add,Edit, x80 y65 w420 h20 vC3,%C3%
Gui,2:Add,Text, x1 y95 w80 h20,EMAIL
Gui,2:Add,Edit, x80 y95 w420 h20 vC4,%C4%
Gui,2:Add,Text, x1 y125 w80 h20,PROGRAM
Gui,2:Add,Edit, x80 y125 w420 h20 vC5,%C5%
Gui,2:Add, Button, x390 y150 w70 h25, CLEAR
Gui,2:Add, Button, x470 y150 w70 h25, CANCEL
Gui,2:Add, Button, x550 y150 w40 h25, OK
Gui,2:Show, x2 y402 w600 h180,ADRESS-INPUT
return
2ButtonOK:
2GuiClose:
2GuiEscape:
Gui,2:submit
IF C1=
{
Gui destroy
return
}
FILEAPPEND,%C1%;%C2%;%C3%;%C4%;%C5%`r`n,%F1%
gosub,LB1
2ButtonCancel:
Gui,2: destroy
return
2ButtonClear:
C1:=
C2:=
C3:=
C4:=
C5:=
GuiControl,,C1, %C1%
GuiControl,,C2, %C2%
GuiControl,,C3, %C3%
GuiControl,,C4, %C4%
GuiControl,,C5, %C5%
GuiControl,focus,C1
Return
ButtonRefresh:
LV_Delete()
loop,read,%F1%
{
stringsplit,BX,A_LoopReadLine,`;,
LV_Add("",BX1,BX2,BX3,BX4,BX5)
}
return
MyListView:
GuiControlGet, MyListView
if A_GuiEvent = Normal
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
GuiControl, ,C,%C1% %C2%
}
if A_GuiEvent = DoubleClick
{
MouseGetPos,x,y
{
if x<%T1A%
return
if x<%T2A%
return
if x<%T3A%
{
LV_GetText(C3,A_EventInfo,3)
run,%C3%
return
}
if x<%T4A%
{
DATES=%A_DD%-%A_MM%-%A_YYYY%
LV_GetText(C4,A_EventInfo,4)
stringsplit,CX,C4,`@,
run,mailto:%C4%?subject=Message Titel %DATES%&Body=Hallo %CX1%`%0a`%0dHow are you ?`%0AI send you this message now....`%0ANext line...
;run,mailto:%C4%?subject=Greetings&Body=Hallo %CX1%
return
}
if x<%T5A%
{
LV_GetText(C5,A_EventInfo,5)
run,%C5%
return
}
}
}
return
GuiClose:
ExitApp
Code: Select all
; http://www.autohotkey.com/board/topic/4279-listview-select-column-and-start-emailurlprogram/
;--------- script from Thalon / how to delete multiple marked rows ---
;--------- LISTVIEW EXAMPLE -------------------------------------------
;-- edit
; delete multiple marked rows
; add
;----------------------------------------------------------------------
R3C=%A_scriptDir%\_CSV
ifnotexist,%R3C%
FileCreateDir,%R3C%
RM1=%A_scriptDir%\_CSV\EX1.csv
ifnotexist,%RM1%
{
fileappend,Mathe-01`,http://archives.math.utk.edu/popmath.html`,Mathematik Examples-1`r`n,%RM1%
fileappend,Mathe-02`,http://www.cut-the-knot.org/index.shtml`,Mathematik Examples-2`r`n,%RM1%
}
RM2=%A_scriptDir%\_CSV\EX2.csv
ifnotexist,%RM2%
{
fileappend,Autohotkey`,http://www.autohotkey.com/forum/index.php`r`n,%RM2%
fileappend,Puzzle games`,http://www.chiark.greenend.org.uk/~sgtatham/puzzles/`r`n,%RM2%
}
Gui,1:Font,S13 CDefault,Lucida Console
Gui,1:Add, ListView,backgroundteal csilver grid r10 x110 y0 w480 +hscroll altsubmit gLW2, Name|URL1
LV_ModifyCol()
Gui,1:Show,x0 y0 w600 h260,Listview_Example01 Edit=F12 DELETE=Rightclick
Gui,1:add,Listbox,x5 y10 w100 h200 Sort vLB1 gLB
Loop,%R3C%\*.csv
{
FX=%A_LoopFileName%
stringlen,L1,FX
stringmid,FA,FX,1,L1-4
GuiControl,,LB1,%FA%
}
GuiControl, ChooseString, LB1, %FA%
Gui,1:Font, S10 CDefault , FixedSys
Gui,1:Add,Button,gAddUrl x5 y230 w120 h20,AddUrl
;=============================================================================
LB:
Gui, 1:Default
Gui,1:Submit,nohide
LV_Delete()
LV_ModifyCol(1,220)
LV_ModifyCol(2,220)
F2=%R3C%\%LB1%.csv
loop,read,%F2%
{
BX1=
BX2=
stringsplit,BX,A_LoopReadLine,`,,
LV_Add("",BX1,BX2)
}
return
;==============================================================
AddUrl:
if LB1=
{
msgbox,select first a genre (EX1, EX2 ....)
return
}
GuiControl,2:Focus,Name
Gui,2:Font, S10 CDefault , FixedSys
Gui,2:Add,Text, x1 y5 w80 h20, NAME
Gui,2:Add,Edit, x80 y5 w500 h20 vA21, %A21%
Gui,2:Add,Text, x1 y30 w80 h20, URL1
Gui,2:Add,Edit, x80 y30 w500 h20 vA22, %A22%
Gui,2:Add, Button, x550 y80 w40 h25, OK
Gui,2:Show, x2 y385 w600 h100, URL-INPUT
return
;---------------------------------------
2GuiClose:
2GuiEscape:
return
2ButtonOK:
Gui,2:submit
if A21=
{
Gui,2: Destroy
return
}
FILEAPPEND, %A21%`,%A22%`r`n,%F2%
Gui,2: Destroy
GoSub, LB ;update LV
return
;============================================================
LW2:
Gui, Submit,nohide
if A_GuiEvent = Normal
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
Goto,SK12
}
;----------------------------
SK12:
if A_GuiEvent=K
{
GetKeyState,state,F12
if state=D
{
if LB1=
{
msgbox,select first a genre (EX1 or EX2....)
return
}
GuiControl,3:Focus,Name
Gui,3:Font, S10 CDefault , FixedSys
Gui,3:Add,Text, x1 y5 w80 h20, NAME
Gui,3:Add,Edit, x80 y5 w500 h20 vA31, %C1%
Gui,3:Add,Text, x1 y30 w80 h20, URL1
Gui,3:Add,Edit, x80 y30 w500 h20 vA32, %C2%
Gui,3:Add, Button, x550 y80 w40 h25, OK
Gui,3:Show, x2 y385 w600 h100, URL-INPUT
return
;---------------------------------------
3GuiClose:
3GuiEscape:
Gui, 3:Destroy
return
3ButtonOK:
Gui,3:submit
if A31=
{
Gui,3: Destroy
return
}
FileRead, FileContent, %R3C%\%LB1%.csv
FileDelete, %R3C%\%LB1%.csv
StringReplace, FileContent, FileContent, %C1%`,%C2%, %A31%`,%A32%
FileAppend, %FileContent%, %R3C%\%LB1%.csv
GoSub, LB
Goto,3guiclose
}
}
;============== PLAY =========
if A_GuiEvent = DoubleClick
{
run,%C2%
return
}
;--------- DELETE multiple marked rows ---------------------
if A_GuiEvent = RightClick
{
C1 =
RF = 0
RFL =
Loop
{
RF:=LV_GetNext(RF)
if RF=0
{
;msgbox,Select a row
break
}
RFL = %RF%|%RFL%
LV_GetText(C1_Temp, RF, 1)
C1 = %C1%`n%C1_Temp%
}
if C1 !=
{
MsgBox, 4, ,Want you really delete %C1% ?
IfMsgBox,No
Return
Else
{
Loop, parse, RFL, |
{
LV_Delete(A_LoopField)
}
filedelete,%F2%
Loop % LV_GetCount()
{
BX1=
BX2=
LV_GetText(BX1,A_INDEX,1)
LV_GetText(BX2,A_INDEX,2)
fileappend,%BX1%`,%BX2%`r`n,%F2%
}
}
C1=
C2=
}
return
}
;----------------------------
return
GuiClose:
ExitApp
Code: Select all
; http://www.autohotkey.com/board/topic/4279-listview-select-column-and-start-emailurlprogram/
;==============================================================
MODIFIED=20090103
NAME1 =TEST MP3PLAY LISTVIEW FWD/BACK SEARCH
;==============================================================
;F1=%A_scriptdir%\test55.txt
Gui,1:default
Gui,1:Font,S10 cDefault, Verdana
RF:=1
T1=500 ;column1 width
T2=0 ;column2 width
T3=70 ;column3 width
T4=50 ;column4 width
Gui,1:Add , Edit, x400 y570 w195 h20 vURLX gSEARCH1
Gui,1:Add,Button,default x0 y0 w0 h0 gSEARCH1 ,
;Gui,1:Add , Edit, x280 y570 w195 h20 vURLX gSEARCH2
;Gui,1:Add,Button,default x0 y0 w0 h0 gSEARCH2 ,
Gui,1:Add,Button,x10 y570 w70 h25 gBACKWARD ,<<
Gui,1:Add,Button,x90 y570 w70 h25 gFORWARD ,>>
Gui,1:Add , Edit, x200 y570 w70 h25 vTOT1 ,
Gui,1:Add , Edit, x290 y570 w70 h25 vPOS1 ,
Gui,1:Add, ListView,x10 y10 h480 w660 grid +hscroll nosorthdr altsubmit vMLV1A gMLV1B, NAME|FULLPATH|SIZE|NR
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
LV_ModifyCol(4,T4)
gosub,SB
GuiControl,1:Text,TOT1,%GC% ;show total
GuiControl,1:Text,POS1,%RF% ;show position
Gui,1:Show, x2 y0 w680 h600,TEST MP3PLAY
return
;-------------------------------
SB:
Gui,1:ListView,MLV1A
LV_Delete()
I=0
Loop, %A_desktop%\*.mp3, 0, 1
{
I++
;Lv_Add("", A_LoopFileName,A_LoopFileSizeKB,A_LoopFileTimeModified,A_LoopFileTimeCreated, A_LoopFileTimeAccessed,A_LoopFileAttrib, A_LoopFileFullPath)
Lv_Add("", A_LoopFileName,A_LoopFileFullPath,A_LoopFileSizeKB,I)
}
GC:=LV_GetCount()
LV_ModifyCol(3,"integer")
LV_ModifyCol(4,"integer")
LV_Modify(LV_GetCount(), "Vis")
return
/*
LV_Delete()
loop,read,%F1%
{
stringsplit,C,A_LoopReadLine,`;,
LV_Add("",C1,C2,C3)
}
return
*/
;=================================================
;================== FORWARD =======================
FORWARD:
Gui,1:submit,nohide
Gui,1: ListView,MLV1A
SoundPlay, Nonexistent.avi
if (RF=(GC))
{
RF:=(GC)
LV_GetText(C2,RF,2)
SoundPlay,%C2%
msgbox,,,PLAYS LAST,2
return
}
LV_Modify(RF, "-Select -Focus")
RF:=(RF+1)
LV_Modify(RF, "+Select +Focus")
LV_GetText(C2,RF,2)
GuiControl,1:Text,POS1,%RF%
SoundPlay,%C2%
return
;===================================================
;================== BACKWARD =======================
BACKWARD:
Gui,1:submit,nohide
Gui,1: ListView,MLV1A
SoundPlay, Nonexistent.avi
if RF=1
{
LV_Modify(1, "+Select +Focus")
LV_GetText(C2,RF,2)
SoundPlay,%C2%
msgbox,,,PLAYS FIRST,2
return
}
LV_Modify(RF, "-Select -Focus")
RF:=(RF-1)
LV_Modify(RF, "+Select +Focus")
LV_GetText(C2,RF,2)
GuiControl,1:Text,POS1,%RF%
SoundPlay,%C2%
return
;===================================================
;---- SEARCH first example ---------------
SEARCH1:
Gui,1:submit,nohide
if URLX=
gosub,SB
RF:=LV_GetNext("F")
RF:=1
Loop % LV_GetCount()
{
LV_GetText(C1,RF,1)
LV_GetText(C2,RF,2)
LV_GetText(C3,RF,3)
CX=%C1% %C2% %C3%
ifinstring,CX,%URLX%
{
RF:=(RF+1)
continue
}
LV_Delete(RF)
}
return
;--- second example reads a file ----
SEARCH2:
Gui,1:submit,nohide
LV_Delete()
loop,read,%F1%
{
LR=%A_loopreadline%
stringsplit,C,LR,`;,
CX=%C1% %C2% %C3%
ifinstring,CX,%URLX%
{
LV_Add("",C1,C2,C3)
}
}
return
;-----------------------------------------------
MLV1B:
Gui,1:Submit,nohide
Gui,1:ListView,MLV1A
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
if A_GuiEvent=normal
{
LV_GetText(C2,A_EventInfo,2)
GuiControl,1:Text,POS1,%RF%
soundplay,%C2%
return
}
return
;================================================
Guiclose:
exitapp
Code: Select all
; http://www.autohotkey.com/board/topic/4279-listview-select-column-and-start-emailurlprogram/
;------- create a test-file ----
EF=`r
ifnotexist,%F1%
{
AA=
(
Line1A;1AA;1AAA;1AAAA%EF%
Line2B;2BB;2CCC;2DDDD%EF%
Line3A;3BB;3TEST;3DDDD%EF%
Line4A;4BB;4TEST;4DDDD%EF%
Line5A;5BB;5CCC;5DDDD%EF%
)
Fileappend,%AA%`n,%F1%
}
;---------------------------------
RSSINI =%A_scriptdir%\LV_TEST_INI.txt
ifnotexist,%RSSINI%
IniWrite,EMPTY , %RSSINI% ,srccfile , KEY1
;--------------- SETTINGS MENU ----------------
menu ,S1 ,Add,&Source ,MH1
menu, myMenuBar, Add, SELECT SOURCE FILE ,:S1
gui,1:menu,MyMenuBar
;----------------------------------------------------
LSW:=(T1+T2+T3+T4+20) ;Listview width
GSW:=(LSW+30) ;GUI width
Gui,1:Add , Edit, x10 y430 w195 h20 vURLX gSEARCH2
Gui,1:Add,Button,default x0 y0 w0 h0 gSEARCH2 ,
Gui,1:Add,Button,x10 y470 w70 h25 g<< ,<<
Gui,1:Add,Button,x90 y470 w70 h25 g>> ,>>
Gui,1:Add,Button,x350 y430 w70 h25 gPrintlv ,PrintLV
Gui,1:Add , Edit, x200 y470 w70 h25 vTOT1 ,
Gui,1:Add , Edit, x290 y470 w70 h25 vPOS1 ,
T1=200 ;column1 width
T2=100 ;column2 width
T3=100 ;column3 width
T4=100 ;column4 width
T1A:=T1
T2A:=T1+T2
T3A:=T1+T2+T3
T4A:=T1+T2+T3+T4
LSW:=(T1+T2+T3+T4+20) ;Listview width
GSW:=(LSW+30) ;GUI width
IniRead,AA1, %RSSINI% ,SrccFile , KEY1
Gui,1:Add, Edit, x10 y0 w%LSW% h20 vSRC2 ,%aa1% ;show selected file
Gui,1:Add, ListView,x10 y30 h380 w%LSW% -hdr grid +hscroll nosorthdr altsubmit vMLV1A gMLV1B, AA|BB|CC|DD
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
LV_ModifyCol(4,T4)
gosub,SB
Gui,1:Show, x2 y0 w%GSW% h510,%name1%
return
;-------------------------------
SB:
Gui,1:ListView,MLV1A
IniRead,F1, %RSSINI% ,SrccFile , KEY1
GuiControl,1:text,src2,%F1%
R=0
LV_Delete()
loop,read,%F1%
{
R++
stringsplit,C,A_LoopReadLine,`;,
LV_Add("",C1,C2,C3,C4)
}
GC:=LV_GetCount()
LV_Modify(LV_GetCount(), "Vis") ;jumps to last row
LV_Modify(GC, "+Select +Focus") ;focus last row
GuiControl,1:Text,TOT1,%GC%
GuiControl,1:Text,POS1,%R% ;show position
return
;=================================================
MH1:
MF=
FileSelectFile, MF, 3,%A_Scriptdir%, Bitte wählen Sie Katalog, Text Documents (*.csv; *.txt; *.doc)
if MF=
return
IniWrite,%mf% , %RSSINI% ,srccfile , KEY1
gosub,SB
return
;---------------------------------------------------------------------
;============== PRINTLV =========================
PRINTLV:
Gui,1:submit,nohide
Gui,1:ListView, A1
ifexist,%F2%
filedelete,%F2%
RF:=1
GD:=LV_GetCount()
loop,%gd%
{
I2++
LV_GetText(C1,RF,1)
LV_GetText(C2,RF,2)
LV_GetText(C3,RF,3)
LV_GetText(C4,RF,4)
Fileappend,%C1%`;%C2%`;%C3%`;%C4%`r`n,%F2%
RF:=(RF+1)
}
run,%F2%
return
;=============== END PRINTLV ===================
;================== FORWARD =======================
>>:
Gui,1:submit,nohide
Gui,1: ListView,MLV1A
if (RF=(GC))
{
RF:=(GC)
LV_GetText(C1,RF,1)
msgbox, 262208, Forward, Reached END`n%C1% , 2
return
}
LV_Modify(RF, "-Select -Focus")
RF:=(RF+1)
LV_Modify(RF, "+Select +Focus")
LV_GetText(C1,RF,1)
GuiControl,1:Text,POS1,%RF%
return
;===================================================
;================== BACKWARD =======================
<<:
Gui,1:submit,nohide
Gui,1: ListView,MLV1A
if RF=1
{
LV_Modify(1, "+Select +Focus")
LV_GetText(C1,RF,1)
msgbox, 262208, Backward, Reached FirstRow`n%C1% , 2
return
}
LV_Modify(RF, "-Select -Focus")
RF:=(RF-1)
LV_Modify(RF, "+Select +Focus")
LV_GetText(C1,RF,1)
GuiControl,1:Text,POS1,%RF%
return
;===================================================
;--- second example reads a file ----
SEARCH2:
Gui,1:submit,nohide
LV_Delete()
loop,read,%F1%
{
LR=%A_loopreadline%
stringsplit,C,LR,`;,
CX=%C1% %C2% %C3% %C4%
ifinstring,CX,%URLX%
LV_Add("",C1,C2,C3,C4)
LV_Modify(GC, "+Select +Focus")
}
return
;-----------------------------------------------
MLV1B:
Gui,1:Submit,nohide
Gui,1:ListView,MLV1A
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
if A_GuiEvent=normal
{
LV_GetText(C1,A_EventInfo,1)
GuiControl,1:Text,POS1,%RF%
;msgbox, 262208, NORMAL, %C1% , 2
return
}
; ARROW KEYS UP / DOWN
if A_GuiEvent=K
{
If GetKeyState("UP","P")
{
LV_GetText(C1,RF,1)
GuiControl,1:Text,POS1,%RF%
if RF=1
{
msgbox, 262208, Backward, Reached FirstRow`n%C1% , 1
return
}
msgbox, 262208, UP, %C1% , 1
}
If GetKeyState("DOWN","P")
{
LV_GetText(C1,RF,1)
GuiControl,1:Text,POS1,%RF%
if (RF=(GC))
{
RF:=(GC)
msgbox, 262208, Forward, Reached LastLine`n%C1% , 1
return
}
msgbox, 262208, DOWN, %C1% , 1
}
}
if A_GuiEvent = Doubleclick
{
if (RN=0 or RN="")
return
MouseGetPos,x,y
{
if x<%T1A%
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
if C1=
return
ControlGet, List, List, Selected, SysListView321,%name1%
Loop, Parse, List, `;
{
Loop, Parse, A_LoopField, %A_Tab%
{
A=%A_INDEX%
if A=1
MsgBox, ROW=#%RN% COL=#%A_Index%`nC1=%C1%`nC2=%C2%`nC3=%C3%`nC4=%C4%`nA_Loopfield=%A_LoopField%
}
}
return
}
if x<%T2A%
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
if C2=
return
ControlGet, List, List, Selected, SysListView321,%name1%
Loop, Parse, List, `;
{
Loop, Parse, A_LoopField, %A_Tab%
{
A=%A_INDEX%
if A=2
MsgBox, ROW=#%RN% COL=#%A_Index%`nC1=%C1%`nC2=%C2%`nC3=%C3%`nC4=%C4%`nA_Loopfield=%A_LoopField%
}
}
return
}
if x<%T3A%
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
if C3=
return
ControlGet, List, List, Selected, SysListView321,%name1%
Loop, Parse, List, `;
{
Loop, Parse, A_LoopField, %A_Tab%
{
A=%A_INDEX%
if A=3
MsgBox, ROW=#%RN% COL=#%A_Index%`nC1=%C1%`nC2=%C2%`nC3=%C3%`nC4=%C4%`nA_Loopfield=%A_LoopField%
}
}
return
}
if x<%T4A%
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
if C4=
return
ControlGet, List, List, Selected, SysListView321,%name1%
Loop, Parse, List, `;
{
Loop, Parse, A_LoopField, %A_Tab%
{
A=%A_INDEX%
if A=4
MsgBox, ROW=#%RN% COL=#%A_Index%`nC1=%C1%`nC2=%C2%`nC3=%C3%`nC4=%C4%`nA_Loopfield=%A_LoopField%
}
}
return
}
}
}
return
;================================================
Guiclose:
exitapp
;======================= ENDE =======================
Code: Select all
; http://www.autohotkey.com/board/topic/4279-listview-select-column-and-start-emailurlprogram/
MODIFIED=20100315
CREATED =20100313
;===================================================================
/*
TAG=2Listview Listview Edit Add Delete Multiple Lines
-- no CELL EDIT but quick change Quantity (doubleclick, overwrite, enter)
-adress 1st Listview
-product 2nd Listview
-AddNew
-Modify
-Delete multiple marked lines
*/
;===================================================================
#NoTrayIcon
autotrim,off
setworkingdir, %A_scriptdir%
SetBatchlines -1
SendMode Input
;-------------- BLOCK GUI-1 SHOW --------------------------
Filename1=LV_ADRESS [Rightclick column to EDIT]
setformat,float,0.2
Gui,1:default
Gui,1:Color, 000000
Gui,1:Font, S10 CDefault , FixedSys
F1=%A_scriptdir%\Adress.txt
F2=%A_scriptdir%\Adress_checked.txt
transform,S,chr,32
VARN00=%S%
VARN01=PRIVAT
VARN02=FIRMA1
VARN03=FIRMA2
;----- for test ----
;Filedelete,%F1%
ifnotexist,%f1%
{
e4=
(
2010-03-10;%varn01%;20100310141522;Meier Walter Herr;Berlin,Dammstrasse 12;Bezahlt;;0`r
2010-03-07;%varn02%;20100307220947;Muller Werner Herr;Frankfurt,Mainstrasse 97;;;1`r
2010-03-09;%varn03%;20100309104534;Schmutz Harry Herr;Luedenscheid,Erfurtestrasse 4;;;0`r
2010-03-08;%varn01%;20100308175255;Hohler Franz Herr;Hamburg,Hafenstrasse 18;Bezahlt;;1`r
2010-03-07;%varn02%;20100307190712;Merkel Franziska Frau;CH-8000 Zurich,Bahnhofstrasse 48;;;0`r
)
Fileappend,%e4%`n,%F1%
}
T1=120 ; DATE
T2=130 ; Privat
T3=150 ; KDNR
T4=100 ; Name
T5=100 ; City
T6=60 ; Bezahlt
T7=100 ; Order
T8=0 ; Checked
T1A:=T1
T2A:=T1+T2
T3A:=T1+T2+T3
T4A:=T1+T2+T3+T4
T5A:=T1+T2+T3+T4+T5
T6A:=T1+T2+T3+T4+T5+T6
T7A:=T1+T2+T3+T4+T5+T6+T7
T8A:=T1+T2+T3+T4+T5+T6+T7+T8
LSW:=(T1+T2+T3+T4+T5+T6+T7+T8+20)
GSW:=(LSW+35)
Gui,1:Add, ListView,grid r17 w%LSW% +hscroll altsubmit checked vMLV1 gMLV2, DATE|FIRMA|KDNR-[X]|Name|City|Bezahlt|Order-[X]|Checked
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
LV_ModifyCol(4,T4)
LV_ModifyCol(5,T5)
LV_ModifyCol(6,T6)
LV_ModifyCol(7,T7)
LV_ModifyCol(8,T8)
;LV_ModifyCol(1,"Integer")
Gui,1:Font, S8 cwhite,FixedSys
Gui,1:Add, Edit, x12 y325 w%LSW% h20 ReadOnly vC,
Gui,1:Add, Edit, cBlue x12 y350 w200 h20 vSEARCH1 gSEARCH1,
Gui,1:Font, S8 cDefault,Verdana
;Gui,1:Add,Button, x400 y350 w120 h20 gALLE1 ,SHOWALL
Gui,1:Add,Button, x400 y380 w120 h20 gPrintCK1 ,PRINT-Checked
Gui,1:Add,Button, x400 y410 w120 h20 gPrintLV1 ,PRINT-LV
;Gui,1:Add,Button, x400 y440 w120 h20 g2ndLV ,2ND-LV
Gui,1:Add,Text , x20 y380 w50 h20 cWhite, Alle
Gui,1:Add,Text , x70 y380 w50 h20 cWhite, Checked
Gui,1:Add,Text , x140 y380 w50 h20 cWhite, Bezahlt
Gui,1:Add,Edit , x10 y405 w50 h20 vIX1 cBlack right, ;I alle
Gui,1:Add,Edit , x70 y405 w50 h20 vIX2 cBlack right, ;I checked
Gui,1:Add,Edit , x130 y405 w50 h20 vIX3 cBlack right, ;I bezahlt
Gui,1:Add,Button, x1 y500 w90 h20 gAddNew1 vAddNew1 ,AddNew
Gui,1:Add,Button, x100 y500 w90 h20 gDelete1 vDelete1 ,Delete
Gui,1:Add,Button, x230 y500 w90 h20 gSelectall ,Selectall
Gui,1:Add,Button, x330 y500 w90 h20 gDeSelectall ,DeSelectall
;Gui,1:Add,Button, x430 y500 w120 h20 gSaveChecked vSaveChecked1 ,Save-Checked
;Gui,1:Add,Button, x690 y465 w90 h20 gClearBez ,CLRBEZ ;clear alle bezahlte
; Gui,1:Add, MonthCal ,x10 y495 w190 h160 ,
;Gui,1:Add,DateTime ,x10 y495 w110 h22 vMydate2 gDatecalc,
gosub,LB
;GSW:=800
Gui,1:Show, x2 y0 w%GSW% h560,%filename1%
return
;-------------- END BLOCK GUI-1 SHOW --------------------------
;------------------ BLOCK READ LV-1 adress -------------------
LB:
Gui,1:default
Gui,1:submit,nohide
GuiControl,1:Enable,AddNew1
GuiControl,1:Enable,Delete1
;GuiControl,1:Enable,SaveChecked1
I1=0
I3=0
LV_Delete()
loop,read,%F1%
{
stringsplit,C,A_LoopReadLine,`;,
VarOut := C6
if VarOut is not space ;bezahlt
I3++
I1++
LV_Add("",C1,C2,C3,C4,C5,C6,C7,C8)
LV_GetText(B8,I1,8)
if B8=1
LV_Modify(I1, "check")
}
;LV_ModifyCol(1, "SortAsc")
;LV_ModifyCol(1, "Logical SortAsc")
;LV_ModifyCol(1,"integer")
LV_ModifyCol(1, "Sort")
LV_Modify(LV_GetCount(), "Vis")
GuiControl,1:,IX1,%I1%
GuiControl,1:,IX3,%I3%
return
;------------------ END BLOCK READ LV-1 adress ------------------------
;----------------- BLOCK GUI-1 close -----------
Guiclose:
gosub,savechecked
exitapp
;----------------- END BLOCK GUI-1 close -------
;-------------- BLOCK SELECT DESELECT ----------
SELECTALL:
LV_Modify(0, "check")
I2 =0
RNM =0
Loop % LV_GetCount()
{
RNM := LV_GetNext(RNM,"checked")
if not RNM
break
I2++
}
GuiControl,1:,IX2,%I2%
return
DESELECTALL:
LV_Modify(0, "-check")
GuiControl,1:,IX2,0
return
;-------------- END BLOCK SELECT DESELECT ----------
;---------------- read all not used ---------
ALLE1:
VARX=
gosub,lb
return
;---------------------------------------------
;============ BLOCK LISTVIEW-1 adress =========================
MLV2:
GuiControlGet,MLV1
Gui,1:Submit,nohide
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
I2 =0
RNM =0
Loop
{
RNM := LV_GetNext(RNM,"checked")
if not RNM
break
I2++
}
GuiControl,1:,IX2,%I2%
if A_GuiEvent=Normal
{
if (RN="" OR RN=0)
return
MouseGetPos,x,y
{
if x<%T1A%
return
if x<%T2A%
return
if x<%T3A%
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
Q1=
Q2=
Q3=
stringsplit,Q,C4,%s%,
FOLD2=%A_scriptdir%\KUNDEN\%c3%_%q1%
ifexist,%fold2%
run,%fold2%
return
}
if x<%T4A%
return
if x<%T5A%
return
if x<%T6A%
return
if x<%T7A%
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
LV_GetText(C5,A_EventInfo,5)
LV_GetText(C6,A_EventInfo,6)
LV_GetText(C7,A_EventInfo,7)
LV_GetText(C8,A_EventInfo,8)
Q1=
Q2=
Q3=
stringsplit,Q,C4,%s%,
F11=%A_scriptdir%\KUNDEN\%c3%_%q1%\%c3%_%A_now%.txt
ifnotexist,%f11%
gosub,2ndLV
else
run,%f11%
return
}
if x<%T8A%
return
}
}
if A_GuiEvent = RightClick
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
LV_GetText(C5,A_EventInfo,5)
LV_GetText(C6,A_EventInfo,6)
LV_GetText(C7,A_EventInfo,7)
LV_GetText(C8,A_EventInfo,8)
goto, Edit1
return
}
return
;============ END BLOCK LISTVIEW-1 adress ==============
;------------- BLOCK SEARCH LV-1 adress -------------------
SEARCH1:
Gui,1:submit,nohide
gosub,lb
GuiControl,1:Disable,AddNew1
GuiControl,1:Disable,Delete1
;GuiControl,1:Disable,SaveChecked1
GuiControl,1:Text,Edit1,%NOTHING%
if search1=
goto,lb
LV_Delete()
I=0
loop,read,%F1%
{
LR=%A_loopReadLine%
C1 =
C2 =
C3 =
C4 =
C5 =
C6 =
C7 =
C8 =
if (search1<>"")
{
if LR contains %search1%
{
stringsplit,C,A_LoopReadLine,`;,
I++
LV_Add("",C1,C2,C3,C4,C5,C6,C7,C8)
}
}
else
continue
}
LV_Modify(LV_GetCount(), "Vis") ;scrollt nach unten
return
;------------- END BLOCK SEARCH LV-1 adress -------------------
;---------------- BLOCK ADDNEW LV-1 adress -------------------
AddNew1:
Name2=AddNew
IfWinExist, %Name2%
return
{
C1=
C2=
C3=
C4=
C5=
C6=
C7=
C8=
}
Gui,4:Font, S10 CDefault , FixedSys
Gui,4:Add,DateTime,x80 y5 w180 h20 vTB ,%A41%
Gui,4:Add,Text, x1 y35 w80 h20,Firma
Gui,4:Add,DropDownList,x80 y35 w420 vA42, %VARN00%|%VARN01%|%VARN02%|%VARN03%
;Gui,4:Add,Text, x1 y65 w80 h20,KDNR
;Gui,4:Add,Edit, x80 y65 w420 h20 vA43 readonly,%C3%
Gui,4:Add,Text, x1 y95 w80 h20,Name
Gui,4:Add,Edit, x80 y95 w420 h20 vA44,%C4%
Gui,4:Add,Text, x1 y125 w80 h20,City
Gui,4:Add,Edit, x80 y125 w420 h20 vA45,%C5%
;Gui,4:Add,Text, x1 y155 w80 h20,BEZAHLT
;Gui,4:Add,Edit, x80 y155 w420 h20 vA46 readonly,%C6%
;Gui,4:Add,Text, x1 y185 w80 h20,ORDER
;Gui,4:Add,Edit, x80 y185 w420 h20 vA47 readonly,%C7%
;Gui,4:Add,Text, x1 y215 w80 h20,CHECKED
;Gui,4:Add,Edit, x80 y215 w420 h20 vA48 readonly ,%C8%
;Gui,4:Add, Button, x510 y130 w85 h25 gBEZAHLT4,<Bezahlt
Gui,4:Add, Button, x550 y180 w40 h25 gOK4, OK
Gui,4:Show, x2 y110 w600 h210,%name2%
Guicontrol,4:choosestring,A42,%varn01%
return
;-----------------------------------------------
;-----------
4GuiClose:
4GuiEscape:
Gui,4:Destroy
Gui,1:Default
return
;-----------
;Bezahlt4:
;GuiControl,4:Text,A45,Bezahlt
OK4:
Gui,4:submit
stringmid,YR4,TB,1,4
stringmid,MN2,TB,5,2
stringmid,DY2,TB,7,2
TDS=%YR4%-%MN2%-%DY2%
TDS2=%DY2%.%MN2%%YR4%
A43=%tb%
FileAppend,%TDS%;%A42%;%A43%;%A44%;%A45%;%A46%;%A47%;0`r`n,%F1%
Gui,4:Destroy
Gui,1:Default
A41=
Gosub,LB
return
;---------------- END BLOCK ADDNEW LV-1 adress -------------------
;----------- BLOCK EDIT LV-1 adress --------------------------
Edit1:
Gui,1:submit,nohide
Name3=Edit1
IfWinExist, %Name3%
return
Gui,6:Font, S10 CDefault , FixedSys
Gui,6:Add,Text, x1 y5 w80 h20,DATE
Gui,6:Add,Edit, x80 y5 w420 h20 vA61,%C1%
Gui,6:Add,DropDownList,x80 y35 w420 r20 vA62, %VARN00%|%VARN01%|%VARN02%|%VARN03%
Gui,6:Add,Text, x1 y65 w80 h20,KDNR
Gui,6:Add,Edit, x80 y65 w420 h20 vA63 readonly,%C3%
Gui,6:Add,Text, x1 y95 w80 h20,Name
Gui,6:Add,Edit, x80 y95 w420 h20 vA64,%C4%
Gui,6:Add,Text, x1 y125 w80 h20,City
Gui,6:Add,Edit, x80 y125 w420 h20 vA65,%C5%
Gui,6:Add,Text, x1 y155 w80 h20,BEZAHLT
Gui,6:Add,Edit, x80 y155 w420 h20 vA66 readonly,%C6%
Gui,6:Add,Text, x1 y185 w80 h20,ORDER
Gui,6:Add,Edit, x80 y185 w420 h20 vA67 readonly,%C7%
Gui,6:Add,Text, x1 y215 w80 h20,Checked
Gui,6:Add,Edit, x80 y215 w420 h20 vA68 readonly,%C8%
Gui,6:Add, Button, x510 y155 w85 h25 gBEZAHLT6 ,<Bezahlt
Gui,6:Add, Button, x605 y155 w65 h25 gBEZAHLT6clr ,<Clear
Gui,6:Add, Button, x550 y200 w40 h25 gOK6, OK
GuiControl,6:Choose,A62,%C2%
GuiControl,6:Choose,A63,%C3%
Gui,6:Show, x2 y110 w670 h260,%Name3%
return
;-----------
6GuiClose:
6GuiEscape:
Gui,6:Destroy
Gui,1:Default
return
;-----------
Bezahlt6:
GuiControl,6:Text,A66,Bezahlt
goto,OK6
Bezahlt6clr:
GuiControl,6:Text,A66,
OK6:
Gui,6:submit,nohide
;if A62=
; A62=%C2%
FileRead,AA,%F1%
FileDelete,%F1%
StringReplace,BB,AA,%C1%;%C2%;%C3%;%C4%;%C5%;%C6%;%C7%;%c8%,%A61%;%A62%;%A63%;%A64%;%A65%;%A66%;%A67%;%A68%
FileAppend,%BB%,%F1%
Gui,6:Destroy
Gui,1:Default
gosub,LB
GuiControl,1:Text,Search1,%NOTHING%
return
;----------- END BLOCK EDIT LV-1 adress --------------------------
;--------- BLOCK DELETE MULTIPLELINES LV-1 adress -----------------
Delete1:
C4 =
RF = 0 ;First line
RFL =
Loop
{
RF:=LV_GetNext(RF)
if RF=0
break
RFL = %RF%|%RFL%
LV_GetText(C4_Temp, RF, 4)
C4 = %C4%`n%C4_Temp%
}
if C4 !=
{
MsgBox, 4, ,Want you really delete %C4% ?
IfMsgBox,No
Return
Else
{
Loop, parse, RFL, |
LV_Delete(A_LoopField)
filedelete,%F1%
Loop % LV_GetCount()
{
BX1=
BX2=
BX3=
BX4=
BX5=
BX6=
BX7=
BX8=
LV_GetText(BX1,A_INDEX,1)
LV_GetText(BX2,A_INDEX,2)
LV_GetText(BX3,A_INDEX,3)
LV_GetText(BX4,A_INDEX,4)
LV_GetText(BX5,A_INDEX,5)
LV_GetText(BX6,A_INDEX,6)
LV_GetText(BX7,A_INDEX,7)
LV_GetText(BX8,A_INDEX,8)
e5=%e5%%BX1%;%BX2%;%BX3%;%BX4%;%BX5%;%BX6%;%BX7%;%BX8%`r`n
}
Fileappend,%e5%,%f1%
}
}
C4 =
RF = 0
RFL =
e5=
Gosub,LB
return
;--------- END BLOCK DELETE MULTIPLELINES LV-1 adress -----------------
;--------- BLOCK PRINTLISTVIEW-1 print what you see -------------
Printlv1:
Gui,1:submit,nohide
Gui,1:ListView, MLV1
TAB1 =10
TAB2 =18
TAB3 =20
TAB4 =12
TAB5 =12
TAB6 =10
TAB7 =10
TAB8 =10
Filedelete,%F2%
RF:=1
GD:=LV_GetCount()
I2=0
loop,%gd%
{
I2++
LV_GetText(C1,RF,1)
LV_GetText(C2,RF,2)
LV_GetText(C3,RF,3)
LV_GetText(C4,RF,4)
LV_GetText(C5,RF,5)
LV_GetText(C6,RF,6)
LV_GetText(C7,RF,7)
LV_GetText(C8,RF,8)
C1 := LP(C1,TAB1,S,"R")
C2 := LP(C2,TAB2,S,"R")
C3 := LP(C3,TAB3,S,"R")
C4 := LP(C4,TAB4,S,"R")
C5 := LP(C5,TAB5,S,"R")
C6 := LP(C6,TAB6,S,"R")
C7 := LP(C7,TAB7,S,"R")
C8 := LP(C8,TAB8,S,"R")
Fileappend,%C1% %C2% %C3% %C4% %C5% %C6% %C7% %C8%`r`n,%F2%
RF:=(RF+1)
}
run,%F2%
RF=0
return
;--------- END BLOCK PRINTLISTVIEW-1 print what you see -------------
;--------- BLOCK PRINTLISTVIEW-1 print CHECKED -------------
PrintCK1:
Gui,1:submit,nohide
Gui,1:ListView, MLV1
TAB1 =10
TAB2 =18
TAB3 =20
TAB4 =12
TAB5 =12
TAB6 =12
TAB7 =12
TAB8 =10
Filedelete,%F2%
RF:=1
GD:=LV_GetCount()
I2=0
loop,%gd%
{
I2++
LV_GetText(C1,RF,1)
LV_GetText(C2,RF,2)
LV_GetText(C3,RF,3)
LV_GetText(C4,RF,4)
LV_GetText(C5,RF,5)
LV_GetText(C6,RF,6)
LV_GetText(C7,RF,7)
LV_GetText(C8,RF,8)
C1 := LP(C1,TAB1,S,"R")
C2 := LP(C2,TAB2,S,"R")
C3 := LP(C3,TAB3,S,"R")
C4 := LP(C4,TAB4,S,"R")
C5 := LP(C5,TAB5,S,"R")
C6 := LP(C6,TAB6,S,"R")
C7 := LP(C7,TAB7,S,"R")
C8 := LP(C8,TAB8,S,"R")
if C8=1
Fileappend,%C1% %C2% %C3% %C4% %C5% %C6% %C7%`r`n,%F2%
RF:=(RF+1)
}
run,%F2%
RF=0
return
;--------- END BLOCK PRINTLISTVIEW-1 print CHECKED -------------
;------------ BLOCK LV-1 checked 0/1 speichern ---------------------------
SaveChecked:
K1=0
K2=0
filedelete,%F1%
Loop % LV_GetCount()
{
K1++
BX1=
BX2=
BX3=
BX4=
BX5=
BX6=
BX7=
LV_GetText(BX1,A_INDEX,1)
LV_GetText(BX2,A_INDEX,2)
LV_GetText(BX3,A_INDEX,3)
LV_GetText(BX4,A_INDEX,4)
LV_GetText(BX5,A_INDEX,5)
LV_GetText(BX6,A_INDEX,6)
LV_GetText(BX7,A_INDEX,7)
if K1=1
K2 := LV_GetNext(K2,"checked")
if (K1=K2)
{
Fileappend,%BX1%;%BX2%;%BX3%;%BX4%;%BX5%;%BX6%;%BX7%;1`r`n,%F1%
K2 := LV_GetNext(K2,"checked")
}
else
Fileappend,%BX1%;%BX2%;%BX3%;%BX4%;%BX5%;%BX6%;%BX7%;0`r`n,%F1%
}
return
;------------ END BLOCK LV-1 checked 0/1 speichern ---------------------------
;======================== 2ND LISTVIEW-2 Products ============================
;----------------- BLOCK GUI SHOW LV-2 ---------------
2NDLV:
Gui,1:submit,nohide
FilenameLV2=Artikel [DELETE=Mark lines and then Rightclick] [EDIT=doubleclick]
IfWinExist, %FilenameLV2%
return
;Gui,2:Color, 000000
Gui,2:Font, S10 CDefault , FixedSys
setformat,float,0.2
F3=%A_scriptdir%\Artikel.txt
F4=%A_scriptdir%\Artikel_Checked.txt
;----- for test ----
;Filedelete,%F3%
ifnotexist,%f3%
{
e5=
(
1;Auto Ford Taunus 1970;100.00;USED;0`r
1;Radio Grundig Concert Boy 1968;20.00;USED;1`r
1;Photocamera Panasonic DMC-TZ7;10.00;NEU;0`r
1;Sharp Basic Rechner PC-1201;30.00;USED;1`r
1;Television Sony 70-cm;10.00;NEU;0`r
)
Fileappend,%e5%`n,%F3%
}
e5=
Gui,2:default
L1:=60 ;Anzahl
L2:=240 ;Product
L3:=100 ;Preis
L4:=70 ;ART
L5:=50 ;Checked
LSW2:=(L1+L2+L3+L4+L5+20)
GSW2:=(LSW2+50)
; logical
Gui,2:Add, ListView,grid r17 w%LSW2% +hscroll altsubmit checked v2MLV1 g2MLV2, Anzahl|Product|Preis|Zustand|Checked
LV_ModifyCol(1,L1)
LV_ModifyCol(2,L2)
LV_ModifyCol(3,L3)
LV_ModifyCol(4,L4)
LV_ModifyCol(5,L5)
LV_ModifyCol(1,"Integer")
LV_ModifyCol(3,"Integer")
Gui,2:Add,Edit , x10 y320 w280 h20 vSearch2 gSearch2 cBlack , ;Search2
Gui,2:Add,Edit , x310 y320 w120 h20 vTotal1 cRed right, ;Total
Gui,2:Add,Text , x20 y360 w50 h20 cWhite, Alle
Gui,2:Add,Text , x70 y360 w50 h20 cWhite, Checked
Gui,2:Add,Edit , x10 y385 w50 h20 v2IX1 cBlack right, ;I alle
Gui,2:Add,Edit , x70 y385 w50 h20 v2IX2 cBlack right, ;I checked
Gui,2:Add,Button, x10 y405 w120 h20 g2Selectall v2Selectall ,Selectall
Gui,2:Add,Button, x150 y405 w120 h20 g2DeSelectall v2DeSelectall ,DeSelectall
Gui,2:Add,Edit , x10 y430 w370 h20 vKDNR1 cBlue , ;Kunde
Gui,2:Add,Button, x390 y430 w90 h20 g2SaveChecked vSaveChecked2 ,<--OK--
Gui,2:Add,Button, x10 y450 w90 h20 gAddNew2 vAddNew2 ,AddNew2
gosub,2LB
Gui,2:Show, x200 y10 w%GSW2% h500,%FilenameLV2%
return
;----------------- END BLOCK GUI SHOW LV-2 ---------------
2Guiclose:
Gui,1:default
Gui,2:destroy
return
;------------ BLOCK LV-2 READ ------------------
2LB:
Gui,2:submit,nohide
Gui,2:default
Gui, 2:ListView,2MLV1
I1=0
I2=0
; A_INDEX
LV_Delete()
loop,read,%F3%
{
stringsplit,H,A_LoopReadLine,`;,
I1++
LV_Add("",H1,H2,H3,H4,H5)
LV_GetText(B5,I1,5)
if B5=1
{
I2++
LV_Modify(I1, "check")
}
}
;LV_ModifyCol(1, "SortAsc")
;LV_ModifyCol(1, "Logical SortAsc")
;LV_ModifyCol(1,"integer")
;LV_ModifyCol(1, "Sort")
LV_Modify(LV_GetCount(), "Vis")
GuiControl,2:,2IX1,%I1%
GuiControl,2:,2IX2,%I2%
GuiControl,2:,KDNR1,Bestellung für KUNDE=%c3%-%c4%
return
;------------ END BLOCK LV-2 READ ------------------
;--------- try ---- BLOCK SEARCH LV-2 product -------------------
SEARCH2:
Gui,2:submit,nohide
gosub,2lb
GuiControl,2:Disable,AddNew2
if search2=
goto,2lb
LV_Delete()
I=0
loop,read,%F3%
{
LR=%A_loopReadLine%
r1 =
r2 =
r3 =
r4 =
r5 =
if (search2<>"")
{
if LR contains %search2%
{
stringsplit,R,A_LoopReadLine,`;,
I++
LV_Add("",r1,r2,r3,r4,r5)
}
}
else
continue
}
LV_Modify(LV_GetCount(), "Vis") ;scrollt nach unten
return
;------------- END BLOCK SEARCH LV-2 products -------------------
;=========== BLOCK LV-2 ============================
2MLV2:
;GuiControlGet,2MLV1
Gui,2:Submit,nohide
Gui, 2:ListView,2MLV1
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
I2 =0
2RNM =0
P3:=0
Y3:=0
Loop
{
2RNM := LV_GetNext(2RNM,"checked")
if not 2RNM
break
I2++
LV_GetText(P1,2RNM,1) ;Anzahl
LV_GetText(P3,2RNM,3) ;Preis
PR:=(P1*P3)
Y3:=(PR+Y3) ;Addiere Preis column3 which is checked
}
GuiControl,2:,2IX2,%I2%
GuiControl,2:,total1,%Y3%
if A_GuiEvent = Normal
{
return
}
if A_GuiEvent = DoubleClick
{
LV_GetText(H1,A_EventInfo,1)
LV_GetText(H2,A_EventInfo,2)
LV_GetText(H3,A_EventInfo,3)
LV_GetText(H4,A_EventInfo,4)
LV_GetText(H5,A_EventInfo,5)
gosub,editLV2
return
}
if A_GuiEvent = Rightclick
{
gosub,delete2
return
}
return
;=========== END BLOCK LV-2 ============================
;------------- BLOCK SELECT DESELECT LV-2 ------------
2SELECTALL:
LV_Modify(0, "check")
I2 =0
2RNM =0
P3:=0
Y3:=0
Loop % LV_GetCount()
{
2RNM := LV_GetNext(2RNM,"checked")
if not 2RNM
break
I2++
LV_GetText(P3,2RNM,3)
Y3:=(P3+Y3) ;Addiere Preis column3 which is checked
}
GuiControl,2:,2IX2,%I2%
GuiControl,2:,total1,%Y3%
return
;---------------------
2DESELECTALL:
LV_Modify(0, "-check")
GuiControl,2:,2IX2,0
GuiControl,2:,total1,0
return
;------------- END BLOCK SELECT DESELECT LV-2 ------------
;---------------------- 2 write checked not used ------------
2WriteChecked:
filedelete,%F3%
Loop % LV_GetCount()
{
K1++
CX1=
CX2=
CX3=
CX4=
LV_GetText(CX1,A_INDEX,1)
LV_GetText(CX2,A_INDEX,2)
LV_GetText(CX3,A_INDEX,3)
LV_GetText(CX4,A_INDEX,4)
if K1=1
K2 := LV_GetNext(K2,"checked")
if (K1=K2)
{
Fileappend,%CX1%;%CX2%;%cx3%;%cx4%;1`r`n,%F3%
K2 := LV_GetNext(K2,"checked")
}
else
Fileappend,%CX1%;%CX2%;%cx3%;%cx4%;0`r`n,%F3%
}
return
;------------------------ END save checked not used --------------------
;------------ BLOCK LV-2 checked 0/1 speichern and write ---------------------------
2SaveChecked:
Gui,1:submit,nohide
q1=
q2=
q3=
stringsplit,Q,C4,%s%,
FOLD1=%A_scriptdir%\KUNDEN\%c3%_%q1%
ifnotexist,%fold1%
FileCreateDir,%fold1%
sleep,500
TB=%A_now%
stringmid,YR4,TB,1,4
stringmid,MN2,TB,5,2
stringmid,DY2,TB,7,2
TDS=%YR4%-%MN2%-%DY2%
w1=
w2=
stringsplit,W,C5,`,,
q1=
q2=
q3=
stringsplit,Q,C4,%s%,
TABLM =5 ;--Left margin
LMM := LP(LMM,TABLM,S,"R")
TABL1=42
DL1:="Datum = " . tds
DL2:="Absender = Uwe Mayer"
DL3:="City = Mannheim"
DL4:="Strasse = Neckarstrasse 17"
DR1:="Kundennummer = " . c3
DR2:="Name = " . q1 " " . q2
DR3:="City = " . w1
DR4:="Strasse = " . w2
DL1 := LP(DL1,TABL1,S,"L") ;reserve space TABL1 (Left1-48)
DL2 := LP(DL2,TABL1,S,"L")
DL3 := LP(DL3,TABL1,S,"L")
DL4 := LP(DL4,TABL1,S,"L")
e21=
(
`r
%lmm%%dl1%%dr1%`r
%lmm%%dl2%%dr2%`r
%lmm%%dl3%%dr3%`r
%lmm%%dl4%%dr4%`r
`r
`r
`r
%lmm%Guten Tag %q3% %q1% ,`r
%lmm%Anbei ihre Bestellung vom %tds%`r
`r
`r
`r
)
Fileappend,%e21%`n,%f11%
TAB1 =4 ;Anzahl
TAB2 =40 ;Product
TAB3 =10 ;Preis
TAB4 =8 ;Zustand
TABPR=11 ;Preis Anzahl*product
TABY3=11 ;Preis Total
K1=0
K2=0
PR:=0
Y3:=0
;--- reads Listview, in case search dont overwrite F3 -------------
;filedelete,%F3%
Loop % LV_GetCount()
{
K1++
BX1=
BX2=
BX3=
BX4=
CX1=
CX2=
CX3=
CX4=
LV_GetText(BX1,A_INDEX,1)
LV_GetText(BX2,A_INDEX,2)
LV_GetText(BX3,A_INDEX,3)
LV_GetText(BX4,A_INDEX,4)
LV_GetText(CX1,A_INDEX,1)
LV_GetText(CX2,A_INDEX,2)
LV_GetText(CX3,A_INDEX,3)
LV_GetText(CX4,A_INDEX,4)
BX1 := LP(BX1,TAB1,S,"R")
BX2 := LP(BX2,TAB2,S,"L")
BX3 := LP(BX3,TAB3,S,"R")
BX4 := LP(BX4,TAB4,S,"R")
stringmid,bx2,bx2,1,tab2
if K1=1
K2 := LV_GetNext(K2,"checked")
;-- 1; or cx1;
if (K1=K2)
{
;Fileappend,1;%CX2%;%cx3%;%cx4%;1`r`n,%F3%
LV_GetText(P1,A_INDEX,1)
LV_GetText(P3,A_INDEX,3)
PR:=(P1*P3)
Y3:=(PR+Y3) ; Multiply Preis column3
PR := LP(PR,TABPR,S,"R")
Fileappend,%LMM%%BX1% %BX2% %bx3%%bx4%%PR%`r`n,%F11% ;write to ORDER
K2 := LV_GetNext(K2,"checked")
}
;else
;Fileappend,1;%CX2%;%cx3%;%cx4%;0`r`n,%F3%
}
FileRead,AA,%F1%
FileDelete,%F1%
StringReplace,BB,AA,%C1%`;%C2%`;%C3%`;%C4%`;%C5%`;%C6%`;%C7%`;%C8%,%C1%`;%C2%`;%C3%`;%C4%`;%C5%`;%C6%`;ORDED`;%C8%
FileAppend,%BB%,%F1%
TABPR2:=(TAB1+TAB2+TAB3+TAB4+TABPR+4)
Y3:=LP(Y3,TABPR2,S,"R")
ifexist,%f11%
{
Fileappend,%LMM%-----------------------------------------------------------------------------`r`n%LMM%%Y3%`r`n,%f11%
Fileappend,`r`n`r`n Mit freundlichen Grüssen`r`n Uwe`r`n,%f11%
run,%f11%
}
gosub,LB
gui,2:destroy
return
;------------ END BLOCK LV-2 checked 0/1 speichern and write ---------------------------
;---------------- BLOCK ADDNEW2 LV-2 product -------------------
AddNew2:
Name9=AddNew2
IfWinExist, %Name9%
return
{
H1=
H2=
H3=
H4=
H5=
}
VARP01=NEU
VARP02=USED
A93 :=0
Gui,9:Font, S10 CDefault , FixedSys
;Gui,9:Add,Text, x1 y5 w80 h20,Anzahl
;Gui,9:Add,Edit, x80 y5 w420 h20 vA91 readonly,%H1%
Gui,9:Add,Text, x1 y35 w80 h20,Product
Gui,9:Add,Edit, x80 y35 w420 h20 vA92,%H2%
Gui,9:Add,Text, x1 y65 w80 h20,Preis
Gui,9:Add,Edit, x80 y65 w420 h20 vA93,%H3%
Gui,9:Add,Text, x1 y95 w80 h20,ZUSTAND
Gui,9:Add,DropDownList,x80 y95 w420 vA94, %VARP01%|%VARP02%
;Gui,9:Add,Text, x1 y125 w80 h20,CHECKED
;Gui,9:Add,Edit, x80 y125 w420 h20 vA95 readonly ,%H5%
Gui,9:Add, Button, x550 y180 w40 h25 gOK9, OK
Gui,9:Show, x2 y110 w600 h210,%name9%
Guicontrol,9:choosestring,A94,%varp01%
return
;-----------------------------------------------
;-----------
9GuiClose:
9GuiEscape:
Gui,9:Destroy
Gui,2:Default
return
;-----------
OK9:
Gui,9:submit
if A93 =
A93 :=0
A93 +=0.00
FileAppend,1;%A92%;%A93%;%A94%;0`r`n,%F3%
Gui,9:Destroy
Gui,2:Default
A91=
Gosub,2LB
return
;---------------- END BLOCK ADDNEW2 LV-2 product -------------------
;--------- BLOCK DELETE MULTIPLELINES LV-2 product -----------------
Delete2:
C2 =
RF = 0 ;First line
RFL =
Loop
{
RF:=LV_GetNext(RF)
if RF=0
break
RFL = %RF%|%RFL%
LV_GetText(C2_Temp, RF, 2)
C2 = %C2%`n%C2_Temp%
}
e9=
if C2 !=
{
MsgBox, 4, ,Want you really delete %C2% ?
IfMsgBox,No
Return
Else
{
Loop, parse, RFL, |
LV_Delete(A_LoopField)
filedelete,%F3%
Loop % LV_GetCount()
{
BX1=
BX2=
BX3=
BX4=
BX5=
LV_GetText(BX1,A_INDEX,1)
LV_GetText(BX2,A_INDEX,2)
LV_GetText(BX3,A_INDEX,3)
LV_GetText(BX4,A_INDEX,4)
LV_GetText(BX5,A_INDEX,5)
e9=%e9%%BX1%;%BX2%;%BX3%;%BX4%;%BX5%`r`n
}
Fileappend,%e9%,%f3%
}
}
C2 =
RF = 0
RFL =
e9=
Gosub,2LB
return
;--------- END BLOCK DELETE MULTIPLELINES LV-1 adress -----------------
;------------ BLOCK EDIT LV-2 ---------------------------------
EDITLV2:
Gui,2:Submit,nohide
Gui, 2:ListView,2MLV1
Name4=EditLV2
IfWinExist, %Name4%
return
A73 :=0
VARP01=NEU
VARP02=USED
Gui,7:Font, S10 CDefault , FixedSys
Gui,7:Add,Text, x1 y5 w80 h20,ANZAHL
Gui,7:Add,Edit, x80 y5 w420 h20 vA71,%H1%
Gui,7:Add,Text, x1 y35 w80 h20,PRODUCT
Gui,7:Add,Edit, x80 y35 w420 h20 vA72,%H2%
Gui,7:Add,Text, x1 y65 w80 h20,PREIS
Gui,7:Add,Edit, x80 y65 w420 h20 vA73,%H3%
Gui,7:Add,Text, x1 y95 w80 h20,ART
Gui,7:Add,DropDownList,x80 y95 w420 vA74, %VARP01%|%VARP02%
Gui,7:Add,Text, x1 y125 w80 h20,CHECKED
Gui,7:Add,Edit, x80 y125 w420 h20 vA75 readonly,%H5%
Gui,7:Add, Button, x550 y200 w40 h25 default gOK7, OK
Gui,7:Show, x2 y110 w600 h240,%Name4%
GuiControl,7:Focus,A71
;Guicontrol,7:choosestring,A74,%varp01%
GuiControl,7:Choose,A74,%H4%
return
;-----------
7GuiClose:
7GuiEscape:
Gui,7:Destroy
Gui,1:Default
return
;-----------
;--------------- 7-OK ------------
OK7:
Gui,7:submit,nohide
Gui,2:default
Gui,2:ListView,2MLV1
if A73 =
A73 :=0
A73 +=0.00
P1:=0
P3:=0
Gui +LastFound ; needs for SendMessage
e5=
Loop % LV_GetCount()
{
B1=
B2=
B3=
B4=
B5=
LV_GetText(B1,A_INDEX,1)
LV_GetText(B2,A_INDEX,2)
LV_GetText(B3,A_INDEX,3)
LV_GetText(B4,A_INDEX,4)
LV_GetText(B5,A_INDEX,5)
SendMessage, 4140, A_INDEX - 1, 0xF000, SysListView321 ;show if it is checked
IsChecked := (ErrorLevel >> 12) - 1
if IsChecked=0
b5=0
else
b5=1
e5=%e5%%B1%;%B2%;%B3%;%b4%;%b5%`r`n
}
new1=
LV_Delete()
Loop, Parse,e5, `n
{
new1=%a_loopfield%
if new1=
break
stringreplace,new1,new1,%H1%`;%H2%`;%H3%`;%H4%,%A71%`;%A72%`;%A73%`;%A74%
stringsplit,M,new1,`;,
stringreplace,M5,M5,`r,
LV_Add("",M1,M2,M3,M4,M5)
}
new1=
e5=
I2=0
Y3:=0
P1:=0
P3:=0
Loop % LV_GetCount()
{
B5=
LV_GetText(B5,A_INDEX,5)
if B5=1
{
I2++
LV_Modify(A_INDEX, "check")
LV_GetText(P1,A_INDEX,1) ;Anzahl
LV_GetText(P3,A_INDEX,3) ;Preis
PR:=(P1*P3)
Y3:=(PR+Y3) ;Total Addiere Preis column3 which is checked
}
}
Gui,7:Destroy
;Gui,2:Default
;gosub,LB2
e5=
e6=
return
;------------ END BLOCK EDIT LV-2 ---------------------------------
;####################### FUNCTION PLACE KEEPER LinePadding BoBo ##################
/*
LinePadding("Text",20,A_Space,"L")
1. Parameter: Text/Wert welcher in der Zeile übergeben wird, hier das Wort Text
2. Parameter: Die Gesamtlänge der Zeile, hier 20 Zeichen
3. Parameter: Füllzeichen, hier A_Space (das Leerzeichen)
4. Parameter: Die Ausrichtung, hier L (heisst Linksbündig)
*/
;A:= LP(A,TAB1,S,"R")
;B:= LP(B,TAB1,S,"R")
;Line := LinePadding("TestString",20,A_Space,"L")
;MsgBox |%Line%| ; zu Testzwecken
LP(String,FieldLen,ToAppend,Justification)
{
StringLen, StringLen, String ; Anzahl Zeichen der Zeichenkette ermitteln
LCnt := FieldLen-StringLen ; Anzahl Füllzeichen ermitteln
Loop, % LCnt
Appended := (Appended . ToAppend) ; Auffüllen
If Justification = R
Return (Appended . String) ; Linksbündig
If Justification = L
Return (String . Appended) ; Rechtsbündig
}
;======================== ENDE ==================================================
;####################################################################################
Code: Select all
; http://www.autohotkey.com/board/topic/4279-listview-select-column-and-start-emailurlprogram/
MODIFIED=20120113
;-- a listview example with 3-columns
;-- ADDNEW -MODIFY -DELETE -SEARCH
;--------------------------------------------------
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
filename1:=%modified% . "ADD-MODIFY-DELETE Edit=RightClick DELETE=DEL"
;transform,S,chr,32 ;-- SPACE is the delimiter
;transform,S,chr,165 ;-- ANSI YEN is the delimiter
S=; ;-- COMMA is the delimiter
;--- create a test-file ----
F1=testbasic.txt
ifnotexist,%f1%
{
e4x=
(Ltrim Join`r`n
016%s%CCC%s%1193
9017%s%BBB%s%92
9018%s%AAA%s%1191
)
Fileappend,%e4x%`r`n,%f1%
}
;-----------------------------
T1=80 ;-- width column-1
T2=100 ;-- width column-2
T3=70 ;-- width column-3
tot:=(T1+T2+T3+50) ;-- width listview
xpos=110
T1A:=(xpos+T1)
T2A:=(xpos+T1+T2)
T3A:=(xpos+T1+T2+T3)
Gui,1:Font,S13 CDefault,Lucida Console
Gui,1:Add, ListView,backgroundteal csilver grid r10 x%xpos% y0 w%tot% +hscroll altsubmit gLW2 vLV_1, A|B|C
;LV_ModifyCol() ;-- fit automatic size
LV_ModifyCol(1,T1) ;-- size
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
Gui,1:Add,Button,gAddUrl x5 y230 w120 h20,Add
Gui,1:add,text, x140 y230 w60 ,Search=
Gui,1:add,edit, x210 y230 h20 w200 vWordToSearch gSearch
Gui,1:add,edit, x450 y230 h20 w60 right readonly vIx
Gui,1:Add,Button, x530 y230 h20 w60 gWriteFile,WRITE
Gui,1:Show,x0 y0 w620 h260,%filename1%
gosub,lb
GuiControl,Focus,WordToSearch
return
;-------------- end gui show ------------------
;------------ fill listview columns -----------
LB:
Gui,1:default
LV_Delete()
I=0
loop,read,%F1%
{
LR:=A_LoopReadLine
if LR=
continue
;LR:=RegExReplace(LR,"\x20{2,}"," ") ;-- allow only on space
LR=%LR% ;-- remove leading space
stringsplit,C,LR,%s% ;-- split with delimiter
I++
LV_Add("",C1,C2,C3)
}
LV_ModifyCol(1, "Sort") ;-- sort column-1
;LV_ModifyCol(2, "SortAsc") ;-- sort column-2
;LV_ModifyCol(1, "Logical SortAsc")
LV_ModifyCol(1,"integer")
LV_ModifyCol(3,"integer")
;LV_ModifyCol(2, "AutoHdr")
LV_Modify(LV_GetCount(), "Vis") ;-- scrolls to last line
GuiControl,1:,ix,%i%
return
;==============================================================
;======== close exit ===
GuiClose:
ExitApp
;=================== search ========================
search:
gui,1:submit,nohide
I=0
LV_Delete()
loop,read,%F1%
{
LR:=A_LoopReadLine
if LR=
continue
LR=%LR% ;-- remove leading space
stringsplit,C,LR,%s% ;-- split with delimiter
If InStr(LR,WordToSearch)
{
i++
LV_Add("",C1,C2,C3)
}
}
GuiControl,1:,ix,%i%
return
;============ write what you see to a file =====================
;--- odlanir http://www.autohotkey.com/forum/viewtopic.php?p=505196#505196
WriteFile:
clm=0
TempFile=%a_scriptdir%\LV_Print_content.txt
ifexist,%tempfile%
filedelete,%tempfile%
Loop % LV_GetCount("Column")
clm++
loop, % LV_GetCount()
{
RowNum := A_Index
loop, %clm%
LV_GetText(col%A_Index% , RowNum, a_index)
FileAppend, % col1 ";" col2 ";" col3 "`r`n", % TempFile
}
Run, % TempFile
return
;================= ADD-NEW ====================================
AddUrl:
Gui,2:Font, S10 CDefault , FixedSys
Gui,2:Add,Text, x1 y5 w80 h20, C1
Gui,2:Add,Edit, x80 y5 w500 h20 vA21,
Gui,2:Add,Text, x1 y30 w80 h20, C2
Gui,2:Add,Edit, x80 y30 w500 h20 vA22,
Gui,2:Add,Text, x1 y60 w80 h20, C3
Gui,2:Add,Edit, x80 y60 w500 h20 vA23,
Gui,2:Add, Button, x550 y90 w40 h25, OK
Gui,2:Show, x2 y385 w600 h120, ADD_NEW
return
;---------------------------------------
2GuiClose:
2GuiEscape:
Gui,2: Destroy
return
2ButtonOK:
Gui,2:submit
FILEAPPEND, %A21%%s%%A22%%s%%A23%`r`n,%F1%
Gui,2: Destroy
GoSub, LB ;-- update LV
return
;=========== end ADD NEW ==========================================
;============= Listview event ===============================================
LW2:
Gui, Submit,nohide
Gui,1:ListView, LV_1
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
;------- which column LV_1 is the name of Listview variable -----------------
if A_GuiEvent=ColClick
{
gosub,cc
return
}
;----------------------------------
;------- one-click ----------------
if A_GuiEvent = Normal
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
}
;------- Doubleclick shows only content from clicked column -----
if A_GuiEvent = DoubleClick
{
gosub,cc
LV_GetText(C1,A_EventInfo,columnx)
msgbox, 262208, ColumnInfo,You have DoubleClicked on`nRow= %A_EventInfo%`nColumn=%columnx%`nHeader=%thisheader%`nContent=%c1%
return
}
;------------ EDIT MODIFY LV --------
if A_GuiEvent = RightClick
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
GuiControl,3:Focus,Name
Gui,3:Font, S10 CDefault , FixedSys
Gui,3:Add,Text, x1 y5 w80 h20, AA
Gui,3:Add,Edit, x80 y5 w500 h20 vA31, %C1%
Gui,3:Add,Text, x1 y30 w80 h20, BB
Gui,3:Add,Edit, x80 y30 w500 h20 vA32, %C2%
Gui,3:Add,Text, x1 y60 w80 h20, CC
Gui,3:Add,Edit, x80 y60 w500 h20 vA33, %C3%
Gui,3:Add, Button, x550 y90 w40 h25, OK
Gui,3:Show, x2 y385 w600 h120, MODIFY
return
;----------
3ButtonOK:
Gui,3:submit
FileRead, FileContent, %F1%
FileDelete, %F1%
StringReplace, FileContent, FileContent, %C1%%s%%C2%%s%%C3% , %A31%%s%%A32%%s%%A33%
FileAppend, %FileContent%, %F1%
GoSub, LB
3GuiClose:
3GuiEscape:
Gui, 3:Destroy
return
}
;------------ END EDIT MODIFY LV --------
;------------ DELETE Listview ROW -------------------
if A_GuiEvent=K
{
GetKeyState,state,DEL
if state=D
{
LV_GetText(C1, RF, 1)
LV_GetText(C2, RF, 2)
LV_GetText(C3, RF, 3)
CT=%c1%%s%%c2%%s%%c3%
msgbox, 262436,Delete,Want you really delete the row %rf%=`n%ct% ?
IfMsgBox,No
Return
FileRead,AA,%F1%
Filedelete,%F1%
StringReplace,BB,AA,%ct%`r`n,,
FileAppend,%BB%,%F1%
gosub,lb
return
}
}
;============= end Listview event ===============================================
;-------------- Function Get Listviewx Columnx --------------------------------------------------------
CC:
;---- user jaysp Fri Aug 20, 2010 3:42 pm Get Listview columnx
;-------- http://www.autohotkey.com/forum/viewtopic.php?t=61655&highlight=clicked+column ---
;MouseGetPos,x,y,%Filename1% ;-- Get mouse position relative to the window
MouseGetPos X, Y, WinID, Ctrl
GuiControlGet, LV_1, Pos ;-- Get the x coordinate of the listview relative to the window
scrollpos := DllCall("GetScrollPos", "UInt", ChildHWND, "Int", 0) ;--Get the position of the scrollbar
highcoord := LV_1X - scrollpos ;-- Get the relative position on the x axis
;-- Get the widths of all columns
w_index=0
Loop % LV_GetCount("Column")
{
SendMessage, 4125, A_Index - 1, 0, SysListView321 ;-- Gets the width of each cell
w_index += 1
columnWidth%w_index% := ErrorLevel
}
;-- Get the relative position of each cell, see if x falls in the range and display the column
Loop, %w_index%
{
highcoord := highcoord + columnWidth%A_Index%
lowcoord := highcoord - columnWidth%A_Index%
If x between %lowcoord% and %highcoord%
Columnx:=A_index
LV_GetText( ThisHeader, 0, columnx ) ; Get column header.
}
return
;========================= end script Listview basics ==========================================
Code: Select all
; http://www.autohotkey.com/board/topic/4279-listview-select-column-and-start-emailurlprogram/
MODIFIED=20111120
;-- a listview example with 3-columns toggle columnx
;-- ADDNEW -MODIFY -DELETE multiple
;--------------------------------------------------
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
filename1:=%modified% . "ADD-MODIFY-DELETE multiple Edit_F12 DELETE_Rightclick"
;transform,S,chr,32 ;-- SPACE is the delimiter
S=, ;-- COMMA is the delimiter
;--- create a test-file ----
F1=test.txt
ifnotexist,%f1%
{
e4x=
(Ltrim Join`r`n
016%s%CCC%s%1193
9017%s%BBB%s%92
9018%s%AAA%s%1191
)
Fileappend,%e4x%`r`n,%f1%
}
;-----------------------------
T1=80 ;-- width column-1
T2=100 ;-- width column-2
T3=70 ;-- width column-3
tot:=(T1+T2+T3+50) ;-- width listview
xpos=110
T1A:=(xpos+T1)
T2A:=(xpos+T1+T2)
T3A:=(xpos+T1+T2+T3)
Gui,1:Font,S13 CDefault,Lucida Console
Gui,1:Add, ListView,backgroundteal csilver grid r10 x%xpos% y0 w%tot% +hscroll altsubmit gLW2 vLV_1, A|B|C
;LV_ModifyCol() ;-- fit automatic size
LV_ModifyCol(1,T1) ;-- size
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
Gui,1:Add,Button,gAddUrl x5 y230 w120 h20,Add
Gui,1:Add,Button,gHeader1 vHeader1a x150 y230 w150 h20,Header-Toggle ;-- Toggle between last selected column and column-1
Gui,1:Show,x0 y0 w600 h260,%filename1%
GuiControl,1: Disable, Header1a
gosub,lb
return
;=================================================================================================================
;--- toggle between last selected column and column-1
header1:
Q:=!Q
If Q
LV_ModifyCol(1, "Sort")
else
LV_ModifyCol(Columnx, "Sort")
return
LB:
Gui,1:default
LV_Delete()
loop,read,%F1%
{
LR:=A_LoopReadLine
if LR=
continue
;stringreplace,LR,LR,",,all
;LR:=RegExReplace(LR,"\x20{2,}"," ") ;-- allow only on space
LR=%LR% ;-- remove leading space
stringsplit,C,LR,%s% ;-- split with delimiter
LV_Add("",C1,C2,C3)
}
LV_ModifyCol(1, "Sort") ;-- sort column-1
;LV_ModifyCol(2, "SortAsc") ;-- sort column-2
;LV_ModifyCol(1, "Logical SortAsc")
LV_ModifyCol(1,"integer")
LV_ModifyCol(3,"integer")
;LV_ModifyCol(2, "AutoHdr")
LV_Modify(LV_GetCount(), "Vis") ;-- scrolls to last line
return
;==============================================================
;================= ADD-NEW ====================================
AddUrl:
Gui,2:Font, S10 CDefault , FixedSys
Gui,2:Add,Text, x1 y5 w80 h20, AA
Gui,2:Add,Edit, x80 y5 w500 h20 vA21, %A21%
Gui,2:Add,Text, x1 y30 w80 h20, BB
Gui,2:Add,Edit, x80 y30 w500 h20 vA22, %A22%
Gui,2:Add,Text, x1 y60 w80 h20, CC
Gui,2:Add,Edit, x80 y60 w500 h20 vA23, %A23%
Gui,2:Add, Button, x550 y90 w40 h25, OK
Gui,2:Show, x2 y385 w600 h120, ADD_NEW
return
;---------------------------------------
2GuiClose:
2GuiEscape:
return
2ButtonOK:
Gui,2:submit
if A21=
{
Gui,2: Destroy
return
}
FILEAPPEND, %A21%%s%%A22%%s%%A23%`r`n,%F1%
Gui,2: Destroy
GoSub, LB ;-- update LV
return
;============================================================
;============================================================
LW2:
Gui, Submit,nohide
Gui,1:ListView, LV_1
;------- which column LV_1 is the name of Listview variable ----------------------------
if A_GuiEvent=ColClick
{
gosub,cc
GuiControl, Enable, Header1a
return
}
;----------------------------------
/*
if A_GuiEvent=ColClick
{
Header_Line =
Loop, % LV_GetCount( "Col" ) ; Loop for however many columns are in the listview.
{
LV_GetText( myHeader, 0, A_INDEX ) ; Get column header.
Header_Line .= myHeader . "|" ; Build output data.
}
MsgBox, % Header_Line
Header_Line =
return
}
*/
if A_GuiEvent = Normal
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
Goto,SK12
}
;----------------------------
;=================== MODIFY ============
SK12:
if A_GuiEvent=K
{
GetKeyState,state,F12
if state=D
{
GuiControl,3:Focus,Name
Gui,3:Font, S10 CDefault , FixedSys
Gui,3:Add,Text, x1 y5 w80 h20, AA
Gui,3:Add,Edit, x80 y5 w500 h20 vA31, %C1%
Gui,3:Add,Text, x1 y30 w80 h20, BB
Gui,3:Add,Edit, x80 y30 w500 h20 vA32, %C2%
Gui,3:Add,Text, x1 y60 w80 h20, CC
Gui,3:Add,Edit, x80 y60 w500 h20 vA33, %C3%
Gui,3:Add, Button, x550 y90 w40 h25, OK
Gui,3:Show, x2 y385 w600 h120, MODIFY
return
;---------------------------------------
3GuiClose:
3GuiEscape:
Gui, 3:Destroy
return
3ButtonOK:
Gui,3:submit
FileRead, FileContent, %F1%
FileDelete, %F1%
StringReplace, FileContent, FileContent, %C1%%s%%C2%%s%%C3% , %A31%%s%%A32%%s%%A33%
FileAppend, %FileContent%, %F1%
GoSub, LB
Goto,3guiclose
}
}
;=====================================================
/*
;===== Doubleclick shows only clicked column =========
if A_GuiEvent = DoubleClick
{
MouseGetPos,x,y
{
if x<%T1A%
{
LV_GetText(C1,A_EventInfo,1)
msgbox, 262208, C1,%c1%
return
}
if x<%T2A%
{
LV_GetText(C2,A_EventInfo,2)
msgbox, 262208, C2,%c2%
return
}
if x<%T3A%
{
LV_GetText(C3,A_EventInfo,3)
msgbox, 262208, C3,%c3%
return
}
}
}
;=====================================================
*/
;===== Doubleclick shows only content from clicked column =========
if A_GuiEvent = DoubleClick
{
gosub,cc
LV_GetText(C1,A_EventInfo,columnx)
msgbox, 262208, C1,DoubleClicked on`nRow= %A_EventInfo%`nColumn=%columnx%`nHeader=%thisheader%`nContent=%c1%
return
}
;=====================================================
;============= DELETE multiple marked rows ===========
if A_GuiEvent = RightClick
{
C1 =
RF = 0
RFL =
Loop
{
RF:=LV_GetNext(RF)
if RF=0
{
;msgbox,Select a row
break
}
RFL = %RF%|%RFL%
LV_GetText(C1_Temp, RF, 1)
C1 = %C1%`n%C1_Temp%
}
if C1 !=
{
msgbox, 262436,Delete,Want you really delete %C1% ?
IfMsgBox,No
Return
Else
{
Loop, parse, RFL, |
LV_Delete(A_LoopField)
filedelete,%F1%
Loop % LV_GetCount()
{
BX1=
BX2=
BX3=
LV_GetText(BX1,A_INDEX,1)
LV_GetText(BX2,A_INDEX,2)
LV_GetText(BX3,A_INDEX,3)
fileappend,%BX1%%s%%BX2%%s%%BX3%`r`n,%F1%
}
}
C1=
C2=
C3=
}
return
}
return
;===================================================
;-------------- Get Listview Columnx --------------------------------------------------------
CC:
;---- user jaysp Fri Aug 20, 2010 3:42 pm Get Listview columnx
;-------- http://www.autohotkey.com/forum/viewtopic.php?t=61655&highlight=clicked+column ---
;MouseGetPos,x,y,%Filename1% ;-- Get mouse position relative to the window
MouseGetPos X, Y, WinID, Ctrl
GuiControlGet, LV_1, Pos ;-- Get the x coordinate of the listview relative to the window
scrollpos := DllCall("GetScrollPos", "UInt", ChildHWND, "Int", 0) ;--Get the position of the scrollbar
highcoord := LV_1X - scrollpos ;-- Get the relative position on the x axis
;-- Get the widths of all columns
w_index=0
Loop % LV_GetCount("Column")
{
SendMessage, 4125, A_Index - 1, 0, SysListView321 ;-- Gets the width of each cell
w_index += 1
columnWidth%w_index% := ErrorLevel
}
;-- Get the relative position of each cell, see if x falls in the range and display the column
Loop, %w_index%
{
highcoord := highcoord + columnWidth%A_Index%
lowcoord := highcoord - columnWidth%A_Index%
If x between %lowcoord% and %highcoord%
Columnx:=A_index
LV_GetText( ThisHeader, 0, columnx ) ; Get column header.
}
return
GuiClose:
ExitApp
Code: Select all
; http://www.autohotkey.com/board/topic/4279-listview-select-column-and-start-emailurlprogram/
MODIFIED=20120124
;-- ahk_basic xp ---
;-- 2-Listviews with 3/4 columns 1 hidden see 5 columns
;-- column/header-size fixed
;-- Doubleclick column start specified extensions
;-- RightClick see Row/Column-Info
;-- bron:
;-- http://www.autohotkey.com/forum/topic58717.html
;-- http://www.autohotkey.com/forum/post-507425.html#507425
;-- http://www.autohotkey.com/forum/post-186741.html#186741
;-- tagx listviewx columnx headerx blockx blockedx ------------------------
#SingleInstance, force
#NoEnv
SetTitleMatchMode 2
SetBatchLines, -1
Gui,2:default
OnMessage(0x4E, "WM_NOTIFY")
;-- when doubleclick column-1 (filename) ---------
runthese=jpg,bmp,png,txt,wav,mp3,mp4,flv,vob
;--- width columns , listview, gui
T1a :=100
T2a :=100
T3a :=0
lsw1:=(t1a+t2a+t3a+30)
T1b :=200
T2b :=100
T3b :=100
T4b :=0
lsw2:=(t1b+t2b+t3b+t4b+30)
lvx1:=(10) ;-- LV1 x-position left border
lvx2:=(lvx1+lsw1+50) ;-- LV2 x-position left border
Gsw:=(lsw1+lsw2+100)
;---------------------------------------
Gui,2: Add, ListView, x%lvx1% y5 r10 w%lsw1% vLV1 gLV -LV0x10 altsubmit, Windir|Size|Fullpath
Gui,2: Add, ListView, x%lvx2% y5 r10 w%lsw2% vLV2 gLV -LV0x10 altsubmit, Desktop|Size|Folder|Fullpath
Loop, %A_WinDir%\*.*
{
Gui,2: ListView, LV1
LV_Add("",A_LoopFileName,A_Loopfilesize,A_Loopfilefullpath)
}
LV_ModifyCol(1,T1a)
LV_ModifyCol(2,T2a)
LV_ModifyCol(3,T3a)
Loop, %A_desktop%\*.*,,1
{
Gui,2: ListView, LV2
StringSplit,CX, a_loopfilefullpath,`\
C:=(CX0-1) ; path oneflashback
D=% CX%C% ; name from path position -1
LV_Add("",A_LoopFileName,A_Loopfilesize,D,A_Loopfilefullpath)
}
LV_ModifyCol(1,T1b)
LV_ModifyCol(2,T2b)
LV_ModifyCol(3,T3b)
LV_ModifyCol(4,T4b)
Gui,2:Show,x0 y0 w%gsw% h260,Listview_Fixed_Column_Header-%modified%
return
;-------------- end gui show ------------------
;-- listviewx columnx headerx blockx blockieren ------------------------
WM_NOTIFY(wParam, lParam, msg, hwnd) {
Code:=(~NumGet(lParam+0,8))+1
Return,Code=306||Code=326 ? True:""
}
;--------------------------------------------------------------------------
;------------------ Listview --------------------------
LV:
gui,2: ListView, %A_GuiControl%
Gui,2:submit,nohide
ctrl=%A_GuiControl%
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
;------------ rightclick ------------------
;-- http://www.autohotkey.com/forum/post-186741.html#186741
If (A_EventInfo > 0) AND (A_GuiEvent = "RightClick") ;If the user right clicks a row
{ Message= ;Clear our message
ThisRow:=A_EventInfo ;Grab the row number that was clicked
Columns:=LV_GetCount("Col") ;Count the columns (could be pre-defined)
Loop, %Columns% ;Run once for each column
{ LV_GetText(Col%A_Index%,0,A_Index) ;Get header name
LV_GetText(CellText,ThisRow,A_Index) ;Get cell contents
Message.=Col%A_Index% . ": " . CellText . "`n" ;Add header name to cell contents
}
msgbox, 262208, Row/Column-Info, %Message%
}
;---------------
;--- doubleclick -------------------
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)
;--- x-position columns -----
if (ctrl="LV1")
{
x1:=(lvx1+t1a)
x2:=(lvx1+t1a+t2a)
x3:=(lvx1+t1a+t2a+t3a)
SplitPath,C3, name, dir, ext, name_no_ext, drive
}
if (ctrl="LV2")
{
x1:=(lvx2+t1b)
x2:=(lvx2+t1b+t2b)
x3:=(lvx2+t1b+t2b+t3b)
x4:=(lvx2+t1b+t2b+t3b+t4b)
SplitPath,C4, name, dir, ext, name_no_ext, drive
}
MouseGetPos,x,y
{
if x<%x1%
{
if (ctrl="LV1")
{
if ext in %runthese%
run,%c3%
else
msgbox, 262208, test, %c1%`n%c2%`n%c3%
return
}
if (ctrl="LV2")
{
if ext in %runthese%
run,%c4%
else
msgbox, 262208, test, %c1%`n%c2%`n%c3%`n%c4%
return
}
}
if x<%x2%
{
msgbox, 262208, test,Size=%c2%
return
}
if x<%x3%
{
if (ctrl="LV2")
run,%dir%
}
}
}
;-------
return
;------------------------------------------------
2Guiclose:
exitapp
;=============== end script ==================================
Re: I am in search of a simple List View script with 5 colum
Hallo and thank you.
This response with a basic script was intended to be what I needed.
However it is designed not for a text format but a numeric format, or have I misinterpreted the response.
Incidentally what does the format <LV_Add("",> imply.
Should I post here the content i wish to input into the List View? It could make my need more understandable.
Thanks again and regards pmjforkin.
; http://www.autohotkey.com/board/topic/8 ... mn-widths/
; http://msdn.microsof...b761049(v=vs.85).aspx
#NoEnv
LVM_GETITEMRECT := 0x100E
Gui, Add, ListView, w10 vVLV hwndHLV, Col A|Col B|Col C ; create a ListView with a too small width
LV_Add("", 23,35,67)
LV_Add("", 65,43,22)
LV_Add("", 88,94,23)
Loop, 3
LV_ModifyCol(A_Index, "AutoHdr")
VarSetCapacity(RECT, 16, 0)
SendMessage, LVM_GETITEMRECT, 0, &RECT, , ahk_id %HLV%
W := NumGet(RECT, 8, "Int") + 4 ; 4 needs to be adjusted if the ListView has a vertical scroll
GuiControl, Move, VLV, w%W%
Gui, Show, AutoSize ; must be AutoSize
Return
GuiClose:
ExitApp
This response with a basic script was intended to be what I needed.
However it is designed not for a text format but a numeric format, or have I misinterpreted the response.
Incidentally what does the format <LV_Add("",> imply.
Should I post here the content i wish to input into the List View? It could make my need more understandable.
Thanks again and regards pmjforkin.
; http://www.autohotkey.com/board/topic/8 ... mn-widths/
; http://msdn.microsof...b761049(v=vs.85).aspx
#NoEnv
LVM_GETITEMRECT := 0x100E
Gui, Add, ListView, w10 vVLV hwndHLV, Col A|Col B|Col C ; create a ListView with a too small width
LV_Add("", 23,35,67)
LV_Add("", 65,43,22)
LV_Add("", 88,94,23)
Loop, 3
LV_ModifyCol(A_Index, "AutoHdr")
VarSetCapacity(RECT, 16, 0)
SendMessage, LVM_GETITEMRECT, 0, &RECT, , ahk_id %HLV%
W := NumGet(RECT, 8, "Int") + 4 ; 4 needs to be adjusted if the ListView has a vertical scroll
GuiControl, Move, VLV, w%W%
Gui, Show, AutoSize ; must be AutoSize
Return
GuiClose:
ExitApp
Re: I am in search of a simple List View script with 5 colum
Hallo!
The following content from me represents what I am trying to achieve.
It is followed by a copy of the Basic Script offered to me.
#SingleInstance
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
Gui, Add, ListView, r23 w450, Key|EN-Sentence-Parts|EN-Sentence-Parts-New|Role-Tags|DE-Translation
LV_Add(AAA, The boy,the boy,[nom m s],Der Junge)
LV_Add(AAB, has,is,[v n 3ps], ist)
LV_Add(AAC, gone,to school,[dat f s],zur Schule)
LV_Add(AAD, to school,gone,[v pp],gegangen)
; Generated using SmartGUI Creator for SciTE
; Create the ListView with five columns,for table texts:
Gui, Show, w470 h368, Translation-Table ListView
return
; the ListView will be used to display tabulated data
; the data to be entered into the above columns is a csv file
; its content is intended to be the following
;
; TRKey|Column 1|Column 2|Column 3|Column 4
; aaa |The boy |The boy |[nom m s] |Der Junge
; aab |has |is |[v m 3ps] |ist
; aac |gone |alone |[adv] |allein
; aad |to school |to school |[pr dat f s] |zur Schule
; aae |alone. |gone. |[v pp] |gegangen.
;
; It begins with a row key which is used to prevent sorting
; I cannot seem to fimd the corrct way to link the text to the columns
; I have found no documentation to explain how to do what I need
GuiClose:
ExitApp
; --------------------------------------------------------------------------
;Here follows th4e Basic Script
; --------------------------------------------------------------------------
; http://www.autohotkey.com/board/topic/8 ... mn-widths/
; http://msdn.microsof...b761049(v=vs.85).aspx
#NoEnv
LVM_GETITEMRECT := 0x100E
Gui, Add, ListView, w10 vVLV hwndHLV, Key |EN SParts|FW SParts|Role-Tags|DE-Translate ; create a ListView with a too small width
LV_Add("", Key,EN SParts,FW SParts,Role-Tags, DE-Translate)
LV_Add("", AAA, The boy,the boy,[nom m s],Der Junge)
LV_Add("", AAB, has,is,[v n 3ps], ist)
LV_Add("", AAC, gone,to school,[dat f s],zur Schule)
LV_Add("", AAD, to school,gone,[v pp],gegangen)
Loop, 3
LV_ModifyCol(A_Index, "AutoHdr")
VarSetCapacity(RECT, 16, 0)
SendMessage, LVM_GETITEMRECT, 0, &RECT, , ahk_id %HLV%
W := NumGet(RECT, 8, "Int") + 4 ; 4 needs to be adjusted if the ListView has a vertical scroll
GuiControl, Move, VLV, w%W%
Gui, Show, AutoSize ; must be AutoSize
Return
GuiClose:
ExitApp
I hope that my needs are understandable. Thank you again and kind regards pmjforkin.
The following content from me represents what I am trying to achieve.
It is followed by a copy of the Basic Script offered to me.
#SingleInstance
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
Gui, Add, ListView, r23 w450, Key|EN-Sentence-Parts|EN-Sentence-Parts-New|Role-Tags|DE-Translation
LV_Add(AAA, The boy,the boy,[nom m s],Der Junge)
LV_Add(AAB, has,is,[v n 3ps], ist)
LV_Add(AAC, gone,to school,[dat f s],zur Schule)
LV_Add(AAD, to school,gone,[v pp],gegangen)
; Generated using SmartGUI Creator for SciTE
; Create the ListView with five columns,for table texts:
Gui, Show, w470 h368, Translation-Table ListView
return
; the ListView will be used to display tabulated data
; the data to be entered into the above columns is a csv file
; its content is intended to be the following
;
; TRKey|Column 1|Column 2|Column 3|Column 4
; aaa |The boy |The boy |[nom m s] |Der Junge
; aab |has |is |[v m 3ps] |ist
; aac |gone |alone |[adv] |allein
; aad |to school |to school |[pr dat f s] |zur Schule
; aae |alone. |gone. |[v pp] |gegangen.
;
; It begins with a row key which is used to prevent sorting
; I cannot seem to fimd the corrct way to link the text to the columns
; I have found no documentation to explain how to do what I need
GuiClose:
ExitApp
; --------------------------------------------------------------------------
;Here follows th4e Basic Script
; --------------------------------------------------------------------------
; http://www.autohotkey.com/board/topic/8 ... mn-widths/
; http://msdn.microsof...b761049(v=vs.85).aspx
#NoEnv
LVM_GETITEMRECT := 0x100E
Gui, Add, ListView, w10 vVLV hwndHLV, Key |EN SParts|FW SParts|Role-Tags|DE-Translate ; create a ListView with a too small width
LV_Add("", Key,EN SParts,FW SParts,Role-Tags, DE-Translate)
LV_Add("", AAA, The boy,the boy,[nom m s],Der Junge)
LV_Add("", AAB, has,is,[v n 3ps], ist)
LV_Add("", AAC, gone,to school,[dat f s],zur Schule)
LV_Add("", AAD, to school,gone,[v pp],gegangen)
Loop, 3
LV_ModifyCol(A_Index, "AutoHdr")
VarSetCapacity(RECT, 16, 0)
SendMessage, LVM_GETITEMRECT, 0, &RECT, , ahk_id %HLV%
W := NumGet(RECT, 8, "Int") + 4 ; 4 needs to be adjusted if the ListView has a vertical scroll
GuiControl, Move, VLV, w%W%
Gui, Show, AutoSize ; must be AutoSize
Return
GuiClose:
ExitApp
I hope that my needs are understandable. Thank you again and kind regards pmjforkin.
Re: I am in search of a simple List View script with 5 colum
LV_Add is a function and expects variables, therefore you must code your constants as:
Hubert
Code: Select all
LV_Add("", "Key","EN SParts","FW SParts","Role-Tags", "DE-Translate")
Re: I am in search of a simple List View script with 5 colum
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
CsvFile := "ListViewTest.csv" ; the name of the CSV file, expected to be in the script's folder
; ======================================================================================================================
; The ListView will be used to display tabulated data.
; The data to be entered into the above columns is a csv file.
; Its content is intended to be the following:
;
; TRKey|Column 1|Column 2|Column 3|Column 4
; aaa |The boy |The boy |[nom m s] |Der Junge
; aab |has |is |[v m 3ps] |ist
; aac |gone |alone |[adv] |allein
; aad |to school |to school |[pr dat f s] |zur Schule
; aae |alone. |gone. |[v pp] |gegangen.
;
; It begins with a row key which is used to prevent sorting.
; I cannot seem to fimd the corrct way to link the text to the columns.
; I have found no documentation to explain how to do what I need.
; ======================================================================================================================
; We need to create a file for testing, if it doesn't exist
; The field delimiter is |.
If !FileExist(CsvFile) {
Content := "TRKey|Column 1|Column 2|Column 3|Column 4" . "`r`n"
. "aaa|The boy|The boy|[nom m s]|Der Junge" . "`r`n"
. "aab|has|is|[v m 3ps]|ist" . "`r`n"
. "aac|gone|alone|[adv]|allein" . "`r`n"
. "aad|to school|to school|[pr dat f s]|zur Schule" . "`r`n"
. "aae|alone.|gone.|[v pp]|gegangen."
FileAppend, %Content%, %CsvFile%
}
; ======================================================================================================================
; Create the ListView
Gui, Add, ListView, r23 w450, Key|EN-Sentence-Parts|EN-Sentence-Parts-New|Role-Tags|DE-Translation
; ======================================================================================================================
; Populate the ListView reading the file line by line (using the 'classic' way)
Loop, Read, %CsvFile%
{
; The first line is a header line, we don't want process it.
If (A_Index = 1)
Continue
; We don't want to process empty lines, too.
If (A_LoopReadLine = "")
Continue
; Clear the output variables used with the following StringSplit.
Loop, 5
Split%A_Index% := ""
; Split the read line using | as delimiter.
StringSplit, Split, A_LoopReadLine, |
; Add the variables to the ListView.
LV_Add("", Split1, Split2, Split3, Split4, Split5)
}
; ======================================================================================================================
; Done, we can show the GUI now
Gui, Show, , Translation-Table ListView
Return
; ======================================================================================================================
GuiClose:
ExitApp
Re: I am in search of a simple List View script with 5 colum
Hallo!
When the GUI and the Columns menu has been created what are the code steps to add a csv table content to the columns?
Thanks and regards pmjforkin
When the GUI and the Columns menu has been created what are the code steps to add a csv table content to the columns?
Thanks and regards pmjforkin
Re: I am in search of a simple List View script with 5 colum
just me gave you a complete example in the previous post which vou can use with little changes:
1) Ignore the creation of the test file - you already have your csv file - instead give your filename
2) I think you must change the delimiter character in the StringSplit command from | to , or ;
Hubert
1) Ignore the creation of the test file - you already have your csv file - instead give your filename
2) I think you must change the delimiter character in the StringSplit command from | to , or ;
Hubert