an example
type in url and see links in a listview and start them with once click
Code:
;----- 2005-02-09 garry ---------------------
;----- URLDOWNLOAD and Listview--------------
;------ thanx laszlo , toralf.... and all others in the forum -------
FH1=urldownload.txt
FH2=SearchedURL1.csv
FH3=SearchedURL2.csv ;sorted and double lines are removed
filedelete,%FH2%
filedelete,%FH3%
;--------- examples ------------
;A51=http://www.autohotkey.com
A51=http://eguren-zone.blogspot.com/2006/09/garota-de-ipanema.html
Gui,2:Font, S10 CDefault , FixedSys
Gui,2:Add,Text, x1 y5 w80 h20, URL
Gui,2:Add,Edit, x80 y5 w500 h20 vA51, %A51%
Gui,2:Add, Button,default x100 y300 w0 h0 gOK, OK
Gui,2:Show, x2 y385 w600 h65,Search For URL in a WebSite
return
;---------
2GuiClose:
2GuiEscape:
ExitApp
OK:
Gui,submit,nohide
if A51=
goto,LSZ
A51=%A51%
stringleft,A51a,A51,7
if A51a=http://
goto A51B
else
A51=http://%A51%
A51B:
Gui,2:destroy
filedelete,%FH1%
Splashimage,,M2 x290 y330 h70 CWred m9 fs10 zh0,%A51% ,START >> Download,Download %A51%
URLDownloadToFile,%A51%,%FH1%
sleep,200
Splashimage,,b x290 y330 h70 CWsilver m9 fs10 zh0,Loaded: %A51%,FINISHED = OK
Sleep,2000
Splashimage, off
LSZ:
Gui,2:destroy
;-- thanx LASZLO ---
K=0
A=http://
Loop,Read, %FH1%
{
T=%A_LoopReadLine%
StringReplace t,T,.%A_Space%,`,,All
StringRight r,t,1
IfEqual r,., StringTrimRight t,t,1
Loop Parse,t,`,`'` `"`;?`!=< >()
{
StringLeft r,A_LoopField,7
If r=%A%
fileappend,%A_LoopField%`r`n,%FH2%
K++
}
}
KH:
if K>0
{
goto,LISTV
}
else
{
Splashimage,,b x300 y440 w600 h70 CWsilver m9 b fs10 zh0,File %FH2% NOT CREATED,no lines with http:// found or failure
Sleep,6000
Splashimage, off
goto,EX
}
;################################################################################33
LISTV:
Gui, Color, 000000
Gui, Font, S10 CDefault , FixedSys
LSW:=1000 ;ListView width
GSW:=LSW+30 ;GuiShow width
ROW:=20
GSH:=400
TXY:=(GSH-20) ;Text Y
Gui,Add, ListView,grid r%ROW% w%LSW% +hscroll altsubmit vMyListView gMyListView,URL
LV_ModifyCol(1,900)
FileRead,AA,%FH2%
;FileDelete,%FH2%
Sort,AA,u ;sort and remove double lines
FileAppend,%AA%,%FH3%
;loop,read,%FH2% ;search unsorted (double)
loop,read,%FH3% ;search sorted (double removed)
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
LV_Add("",BX1)
I++
}
Gui,Font,S8 cwhite, Verdana
Gui,Add,Text, x300 y%TXY%,%I%
Gui,Add,Text, x40 y%TXY%,Click once to start URL
Gui,Add,Text, x400 y%TXY%,AHKVERSION= %A_AHKVERSION%
Gui, Show, x2 y0 w%GSW% h%GSH% ,LISTVIEW
return
MyListView:
GuiControlGet, MyListView
if A_GuiEvent = Normal
{
LV_GetText(C1,A_EventInfo,1)
run,%C1%
return
}
return
EX:
GuiClose:
GuiEscape:
ExitApp