#include #include #include #include #include #include #include #include HotKeySet("{ESC}", "MyExit") ;|RIGHT|IE|DOWNLOAD| ;Global $sDL_URL="http://downloads.ddti.net/starkoh/" [Replaced with $idInpURL to store multiple DL address] ;ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore/" ;County Data ;http://downloads.ddti.net/starkoh/" ;County Data Global $hGui = GUICreate('MapFiles DL', 640, 480) Global $idLV_Config = GUICtrlCreateListView("County |URL", 5, 5, 305, 360, $LVS_REPORT) _GUICtrlListView_SetColumnWidth($idLV_Config, 0, 70) _GUICtrlListView_SetColumnWidth($idLV_Config, 1, 160) _GUICtrlListView_SetColumnWidth($idLV_Config, 2, 70) GUICtrlCreateLabel("URL:", 5, 380, 60, 20) GUICtrlCreateLabel("County:", 5, 410, 60, 20) Global $idInpURL = GUICtrlCreateInput("", 70, 380, 240, 20) Global $idInpCounty = GUICtrlCreateInput("", 70, 410, 80, 20) Global $idBtnConfigAdd = GUICtrlCreateButton("&Add", 10, 450, 60, 25) Global $idBtnConfigDel = GUICtrlCreateButton("&Remove", 85, 450, 70, 25) Global $idBtnConfigClear = GUICtrlCreateButton("&Clear", 170, 450, 65, 25) Global $idBtnConfigGet = GUICtrlCreateButton("&Get", 250, 450, 55, 25) Global $idLV_URLs = GUICtrlCreateListView('DL|RemoteFilename', 350, 5, 288, 430, $LVS_REPORT, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) Global $idtnDL = GUICtrlCreateButton('&Download checked Files', 350, 445, 200, 25, BitOR($BS_CENTER, $BS_DEFPUSHBUTTON)) Global $oIE = _IECreate("about:blank", 0, 1) ;while testing script its better to see IE Global $sLPath, $sRPath, $iBytes, $sURL _GUICtrlListView_SetColumnWidth($idLV_URLs, 0, $LVSCW_AUTOSIZE_USEHEADER) GUISetState() While 1 ;ConfigData() ;noncence creating 1...n Listviews each at same Pos ;creating Controls moved Switch GUIGetMsg() Case $idBtnConfigAdd ConfigAddData() Case $idBtnConfigDel ConfigRemData() Case $idBtnConfigClear ConfigClrData() Case $idBtnConfigGet ConfigGetData() Case $gui_event_close MyExit() Case $idtnDL $sDownloads = FileSelectFolder("Choose folder you want to save the file's", "") ConsoleWrite($sDownloads & @CRLF) If $sDownloads <> '' Then For $x = 0 To _GUICtrlListView_GetItemCount($idLV_URLs) If _GUICtrlListView_GetItemChecked($idLV_URLs, $x) Then $sItemText = _GUICtrlListView_GetItemText($idLV_URLs, $x, 1) $sRPath = $sURL & '/' & $sItemText $sLPath = $sDownloads & '\' & $sItemText ConsoleWrite($sRPath & @TAB & $sLPath & @TAB) $iBytes = InetGet($sRPath, $sLPath, 0, 0) ;1. 0= Get the file from local cache if available ;2. 0=waiting DL for File is comlete ConsoleWrite($iBytes & ' Bytes' & @CRLF) EndIf Next ConsoleWrite('DL finished' & @CRLF) EndIf EndSwitch WEnd Func ConfigAddData() $ReadCounty = GUICtrlRead($idInpCounty) $ReadURL = GUICtrlRead($idInpURL) GUICtrlCreateListViewItem($ReadCounty & "|" & $ReadURL, $idLV_Config) GUICtrlSetData($idInpCounty, "") GUICtrlSetData($idInpURL, "") EndFunc ;==>ConfigAddData Func ConfigRemData() _GUICtrlListView_DeleteItemsSelected($idLV_Config) EndFunc ;==>ConfigRemData Func ConfigClrData() _GUICtrlListView_DeleteAllItems($idLV_Config) EndFunc ;==>ConfigClrData Func ConfigGetData() Local $sItemText Local $iIndex = _GUICtrlListView_GetSelectionMark($idLV_Config) $sURL = _GUICtrlListView_GetItemText($idLV_Config, $iIndex, 1) ConsoleWrite($sURL & @CRLF) _GUICtrlListView_DeleteAllItems($idLV_URLs) _IENavigate($oIE, $sURL) Local $links = _IELinkGetCollection($oIE) If IsObj($links) Then _GUICtrlListView_BeginUpdate($idLV_URLs) For $link In $links $sItemText = StringRegExpReplace($link.href, '.*/(.*)', '$1') If $sItemText <> '' Then GUICtrlCreateListViewItem('|' & $sItemText, $idLV_URLs) Next EndIf _GUICtrlListView_SetColumnWidth($idLV_URLs, 1, $LVSCW_AUTOSIZE) _GUICtrlListView_EndUpdate($idLV_URLs) EndFunc ;==>ConfigGetData Func MyExit() _IEQuit($oIE) ;IE beenden Exit EndFunc ;==>MyExit