AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Listview select column and start EMAIL,URL,PROGRAM

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
garry



Joined: 19 Apr 2005
Posts: 1030
Location: switzerland

PostPosted: Mon Jul 18, 2005 8:50 pm    Post subject: Listview select column and start EMAIL,URL,PROGRAM Reply with quote

(thank you all for scripts and the nice program AHK)
Here an idea how to select column in listview and start program
doubleclick column3/4/5 starts URL, EMAIL,Program
once click see Name City (column1/2) below
to sort click column head
New Adress=Button AddNew
delete/change rows with text editor or in Excel
Code:
;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/`;Chris@1234ABCD.xy`;C:\program files\AutoHotkey\autohotkey.chm`r`n,%F1%
     Fileappend,SCOTTSERVER    `;Los Angeles`;http://www.scottserver.net/forum/`;scott@1234ABCD.xy`;`r`n,%F1%
     Fileappend,SLEEPY         `;Alabama`;http://sleepyssin.suddenlaunch3.com/`;sleepy@1234ABCD.xy`;`r`n,%F1%
     Fileappend,Streamripper   `;`;http://streamripper.sourceforge.net/`;`;`r`n,%F1%
     Fileappend,CANDLE         `;Oslo`;http://www.candles-weblog.us`;candle@1234ABCD.xy`;`r`n,%F1%
     Fileappend,WhizCat        `;Atlanta`;http://scottserver.net/whizware`;TOM@1234ABCD.xy`;`r`n,%F1%
     Fileappend,CORRUPT        `;Arkansas`;http://www.apps4apps.filetap.com/`;corrupt@1234ABCD.xy`;`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)

loop,read,%F1%
{
stringsplit,BX,A_LoopReadLine,`;,
LV_Add("",BX1,BX2,BX3,BX4,BX5)
}

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
Gui, Show, x2 y0 w%T5B% h400 ,LISTVIEW
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  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%
2ButtonCancel:
Gui 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


Last edited by garry on Wed Jul 19, 2006 8:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Mon Jul 18, 2005 9:02 pm    Post subject: Reply with quote

It looks interesting; thanks for sharing it.

ListViews in XP and beyond have the ability to select columns, but I forget exactly how to enable it. If it can't be enabled through SendMessage, perhaps it can be built into the program someday.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group