aa2zz6

How do I display IE downloadable text files inside GUI?

17 posts in this topic

#1 ·  Posted (edited)

I'm looking at creating a GUI that'll display all the downloadable mapping files from the link below. How would I do this when the items are in table form <tr> <td></td> </tr>. 

ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore

Edited by aa2zz6

Share this post


Link to post
Share on other sites



Just click:

_IECreateEmbedded(..)

and read.

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

I was looking for a way to display the website text on the GUI without opening a browser. I believe I've seen it in posts a few months back and I can't recall how it was actually done.

Share this post


Link to post
Share on other sites

.....

use _IECreate and set $iVisible = 0
Get content with _IETableWriteToArray

....

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

aa2zz6,

Just rip the file names from the FTP site like this...

#include <ie.au3>
#include <array.au3>

Local $oIE = _IECreate("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore ",0,0)
Local $links = _IELinkGetCollection($oIE), $out

For $link In $links
    $out &= stringregexpreplace($link.href,'.*/(.*)','$1') & @CRLF
Next

ConsoleWrite($out & @CRLF)

then create a gui and present the data in whatever way you want.

kylomas

edit: Example creating a dropdown list (combo)...

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ie.au3>
#include <array.au3>

Local $oIE = _IECreate("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore ",0,0)
Local $links = _IELinkGetCollection($oIE), $out

For $link In $links
    $out &= stringregexpreplace($link.href,'.*/(.*)','$1') & '|'
Next

#AutoIt3Wrapper_Add_Constants=n

local $gui010 = guicreate('')
local $aSize  = wingetclientsize($gui010)
local $cmb010 = guictrlcreatecombo('',20,20,200,250)
guisetstate()

guictrlsetdata($cmb010,$out,stringregexpreplace($out,'\|(.*?)\|.*','$1'))

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
    EndSwitch
WEnd

 

Edited by kylomas
example
1 person likes this

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I created a GUICtrlCreateEdit to store the information of all the different mapping files. Would it be possible to download the files from the GUICtrlCreateEdit? Each one would have a link attached and allow to click and download directly.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <array.au3>
#include <EditConstants.au3>

;Press to EXIT program!
HotKeySet("{ESC}", "Terminate")

$width = 1050
$height = 771
Global $LogMessage

_IEErrorHandlerRegister()
#Region ### START Koda GUI section ### Form=
$hMain = GUICreate("GIS Data", 1024, 600, @DesktopWidth / 2 - $width / 2, @DesktopHeight / 2 - $height / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN + $WS_BORDER)

#EndRegion ### END Koda GUI section ###

;Button link to Auditor's > GIS > Mapping Data
Local $Tusc = GUICtrlCreateButton("Tuscarawas County", 10, 10, 115, 50)

$Log = GUICtrlCreateEdit("", 500, 15, 520, 560, BitOR($ES_WANTRETURN, $ES_READONLY, $ES_AUTOVSCROLL, $WS_VSCROLL));



GUISetState(@SW_SHOW, $hMain)

Local $iPID = 0



While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $Tusc
        
            $iPID = Run(Tuscarawas(), "", @SW_SHOWMAXIMIZED)

    EndSwitch
WEnd

If $iPID Then ProcessClose($iPID)

Func Tuscarawas()

    Local $oIE = _IECreate("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore ", 0, 0)
    Local $links = _IELinkGetCollection($oIE), $out

    For $link In $links
        $out &= StringRegExpReplace($link.href, '.*/(.*)', '$1') & @CRLF
    Next

        $LogMessage = $out & @CRLF
        GUICtrlSetData($Log, $LogMessage)

EndFunc   ;==>Tuscarawas

;STOP program
Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Edited by aa2zz6

Share this post


Link to post
Share on other sites

Yes, use GUICtrlRead and StringSplit to get the links into a array. Agter them loop through the array and download the file with InetGet. A bit more comfortable for the user is a Listview with checkboxes, so the user can select what he want's downloading.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

or a simple combo control, as illustrated above...

What is the purpose of $ipid?

You can write the edit control directly from $out, no need for $logmessage, or eliminate $out altogether and write $logmessage from the links loop.

How are you going to store the links and associate them to a selection from the gui?

They all have a common prefix

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

2 hours ago, kylomas said:

aa2zz6,

Just rip the file names from the FTP site like this...

#include <ie.au3>
#include <array.au3>

Local $oIE = _IECreate("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore ",0,0)
Local $links = _IELinkGetCollection($oIE), $out

For $link In $links
    $out &= stringregexpreplace($link.href,'.*/(.*)','$1') & @CRLF
Next

ConsoleWrite($out & @CRLF)

then create a gui and present the data in whatever way you want.

kylomas

edit: Example creating a dropdown list (combo)...

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ie.au3>
#include <array.au3>

Local $oIE = _IECreate("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore ",0,0)
Local $links = _IELinkGetCollection($oIE), $out

For $link In $links
    $out &= stringregexpreplace($link.href,'.*/(.*)','$1') & '|'
Next

#AutoIt3Wrapper_Add_Constants=n

local $gui010 = guicreate('')
local $aSize  = wingetclientsize($gui010)
local $cmb010 = guictrlcreatecombo('',20,20,200,250)
guisetstate()

guictrlsetdata($cmb010,$out,stringregexpreplace($out,'\|(.*?)\|.*','$1'))

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
    EndSwitch
WEnd

 

The example is very nice and I will probably use that style.

1 hour ago, kylomas said:

or a simple combo control, as illustrated above...

What is the purpose of $ipid?

You can write the edit control directly from $out, no need for $logmessage, or eliminate $out altogether and write $logmessage from the links loop.

How are you going to store the links and associate them to a selection from the gui?

They all have a common prefix

kylomas

At the time I didn't see the example prior to posting my piece of code. The $ipid was something that I copied from the help file. I put the code together quickly in order to put some type of code in response to the first piece of code that displayed the text from the website.

Edited by aa2zz6

Share this post


Link to post
Share on other sites

The InetGet inside the Case $Tusc doesn't seem to download the current information from the combo box.  Looking at the help file it says:

InetGet ( "URL", "filename" [, options = 0 [, background = 0]] )

That being said, I put the $oIE as the current url and the file name would be $cmb010 (combo box) displaying a name and a file extension. It doesn't seem to read from the combo box.

While 1
    Switch GUIGetMsg()
        Case $gui_event_close
            Exit
        Case $Tusc
            InetGet($oIE, $cmb010, 16, 0)
    EndSwitch
WEnd
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ie.au3>
#include <array.au3>

HotKeySet("{ESC}", "Terminate")


Local $oIE = _IECreate("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore", 0, 0)
Local $links = _IELinkGetCollection($oIE), $out

For $link In $links
    $out &= StringRegExpReplace($link.href, '.*/(.*)', '$1') & '|'
Next

#AutoIt3Wrapper_Add_Constants=n

Local $gui010 = GUICreate('')
Local $aSize = WinGetClientSize($gui010)
Local $cmb010 = GUICtrlCreateCombo('', 20, 20, 200, 250)
GUISetState()

GUICtrlSetData($cmb010, $out, StringRegExpReplace($out, '\|(.*?)\|.*', '$1'))

Local $Tusc = GUICtrlCreateButton("Download", 20, 50, 115, 30)

While 1
    Switch GUIGetMsg()
        Case $gui_event_close
            Exit
        Case $Tusc
            InetGet($oIE, $cmb010, 16, 0)
    EndSwitch
WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Share this post


Link to post
Share on other sites

The DL-URL is "ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore"&GuiCtrlRead($cmb010)

The local FilePath = "YourFilePath"&"&GuiCtrlRead($cmb010)

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I got an illegal character error in this piece of code so I removed the "&" towards the end. I didn't get any errors after that but nothing download. The local FilePath is a directory on my computer correct? I wonder if I placed this wrong.

Error

InetGet("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore" & GUICtrlRead($cmb010), "C:\Users\j\Desktop\ "&" & GUICtrlRead($cmb010))
                                                                                                                ----

Non Error - path wrote wrong?

InetGet("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore" & GUICtrlRead($cmb010), "C:\Users\j\Downloads" & GUICtrlRead($cmb010))

 

Edited by aa2zz6

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Sorry, i forgot the slash in RemotePath and the backslash in LocalPath.

InetGet("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore/" & GUICtrlRead($cmb010), "C:\Users\j\Downloads\" & GUICtrlRead($cmb010))

And here the solution with LV:

#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <ie.au3>
#include <array.au3>

Global $sDL_URL="ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore"
Global $hGui=GUICreate('MapFiles DL',640,480)
Global $idLV=GUICtrlCreateListView('DL|RemoteFilename',5,5,630,430,$LVS_REPORT,BitOR($LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT))
Global $idtnDL=GUICtrlCreateButton('&Download checked Files',5,445,630,25,BitOR($BS_CENTER,$BS_DEFPUSHBUTTON))
Global $oIE = _IECreate($sDL_URL,0,0)
Global $links = _IELinkGetCollection($oIE)
Global $sItemText, $sLPath, $sRPath, $iBytes

For $link In $links
    $sItemText=stringregexpreplace($link.href,'.*/(.*)','$1')
    If $sItemText <> '' Then GUICtrlCreateListViewItem('|' & $sItemText,$idLV)
Next
_GUICtrlListView_SetColumnWidth($idLV,0, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($idLV,1, $LVSCW_AUTOSIZE)
GUISetState()


while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
        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)
                    If _GUICtrlListView_GetItemChecked($idLV,$x) Then
                        $sItemText=_GUICtrlListView_GetItemText($idLV,$x,1)
                        $sRPath=$sDL_URL&'/'&$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

 

 

Edited by AutoBert
1 person likes this

Share this post


Link to post
Share on other sites
8 hours ago, AutoBert said:

Sorry, i forgot the slash in RemotePath and the backslash in LocalPath.

InetGet("ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore/" & GUICtrlRead($cmb010), "C:\Users\j\Downloads\" & GUICtrlRead($cmb010))

And here the solution with LV:

#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <ie.au3>
#include <array.au3>

Global $sDL_URL="ftp://68.142.166.18/TUSC_GIS_FTP/Tus157_gis-mapdatastore"
Global $hGui=GUICreate('MapFiles DL',640,480)
Global $idLV=GUICtrlCreateListView('DL|RemoteFilename',5,5,630,430,$LVS_REPORT,BitOR($LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT))
Global $idtnDL=GUICtrlCreateButton('&Download checked Files',5,445,630,25,BitOR($BS_CENTER,$BS_DEFPUSHBUTTON))
Global $oIE = _IECreate($sDL_URL,0,0)
Global $links = _IELinkGetCollection($oIE)
Global $sItemText, $sLPath, $sRPath, $iBytes

For $link In $links
    $sItemText=stringregexpreplace($link.href,'.*/(.*)','$1')
    If $sItemText <> '' Then GUICtrlCreateListViewItem('|' & $sItemText,$idLV)
Next
_GUICtrlListView_SetColumnWidth($idLV,0, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($idLV,1, $LVSCW_AUTOSIZE)
GUISetState()


while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
        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)
                    If _GUICtrlListView_GetItemChecked($idLV,$x) Then
                        $sItemText=_GUICtrlListView_GetItemText($idLV,$x,1)
                        $sRPath=$sDL_URL&'/'&$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

 

The GUICtrlCreateListView provides a nice platform for downloading mapping data. 

Thank you, Kylomas and AutoBert for the support on this post. 

 

Share this post


Link to post
Share on other sites

I added a URL GUICtrlCreateListView on the right to replace the Global $sDL_URL="" but it doesn't show the downloads. The idea was to implement multiple URL links and store the data instead of using a single variable. 

#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <ie.au3>
#include <array.au3>
#include <EditConstants.au3>

HotKeySet("{ESC}", "Terminate")

;|RIGHT|IE|DOWNLOAD|
;Global $sDL_URL="http://downloads.ddti.net/starkoh/" [Replaced with $ConfigURL 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 $ConfigCounty, $ConfigURL
Global $ConfigList
Global $hGui=GUICreate('MapFiles DL',640,480)

Global $idLV=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($ConfigURL,0,0)
Global $links = _IELinkGetCollection($oIE)
Global $sItemText, $sLPath, $sRPath, $iBytes

For $link In $links
    $sItemText=stringregexpreplace($link.href,'.*/(.*)','$1')
    If $sItemText <> '' Then GUICtrlCreateListViewItem('|' & $sItemText,$idLV)
Next
_GUICtrlListView_SetColumnWidth($idLV,0, $LVSCW_AUTOSIZE_USEHEADER)
_GUICtrlListView_SetColumnWidth($idLV,1, $LVSCW_AUTOSIZE)

;|LEFT|DATABASE|URL|COUNTY|
Func ConfigData()

    $ConfigList = GUICtrlCreateListView("County |URL", 5, 5, 305, 360, $LVS_REPORT)
    _GUICtrlListView_SetColumnWidth($ConfigList, 0, 70)
    _GUICtrlListView_SetColumnWidth($ConfigList, 1, 160)
    _GUICtrlListView_SetColumnWidth($ConfigList, 2, 70)

    GUICtrlCreateLabel("URL:", 5, 380, 60, 20)
    GUICtrlCreateLabel("County:", 5, 410, 60, 20)

    $ConfigURL = GUICtrlCreateInput("", 70, 380, 240, 20)

    $ConfigCounty = GUICtrlCreateInput("", 70, 410, 80, 20)

    $ConfigAdd = GUICtrlCreateButton("Add", 20, 450, 80, 25)
    $ConfigRem = GUICtrlCreateButton("Remove", 115, 450, 80, 25)
    $ConfigClr = GUICtrlCreateButton("Clear", 210, 450, 80, 25)

    GUISetState()

    Do
        $msg = GUIGetMsg()
        Switch $msg
            Case $ConfigAdd
                ConfigAddData()
            Case $ConfigRem
                ConfigRemData()
            Case $ConfigClr
                ConfigClrData()
        EndSwitch
    Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>ConfigData

Func ConfigAddData()
    $ReadCounty = GUICtrlRead($ConfigCounty)
    $ReadURL = GUICtrlRead($ConfigURL)

    GUICtrlCreateListViewItem($ReadCounty & "|" & $ReadURL, $ConfigList)

    GUICtrlSetData($ConfigCounty, "")
    GUICtrlSetData($ConfigURL, "")
EndFunc   ;==>ConfigAddData

Func ConfigRemData()
    _GUICtrlListView_DeleteItemsSelected($ConfigList)
EndFunc   ;==>ConfigRemData

Func ConfigClrData()
    _GUICtrlListView_DeleteAllItems($ConfigList)
EndFunc   ;==>ConfigClrData

GUISetState()

while 1
    ConfigData()
    switch guigetmsg()
        case $gui_event_close
            Exit
        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)
                    If _GUICtrlListView_GetItemChecked($idLV,$x) Then
                        $sItemText=_GUICtrlListView_GetItemText($idLV,$x,1)
                        $sRPath=$ConfigURL&'/'&$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 Terminate()
    Exit
EndFunc   ;==>Terminate

Share this post


Link to post
Share on other sites

Your code was not the best and (for me)  bad to read, so renamed some Variables, moved functions to another place etc. For my logic of UI a Button for filling DL-Listview must be,  so inserted. It's tested only little because my internetspeed is very poor (64 kbits/s).

Here is the script: mapDL.au3 It's not the best but runable.

What should be done:

  • commenting the script (by you with trying to understand the logic behind and reading about the (yet) unknown functions
  • searching for unused variables and funcs.

What could be done:

  • switch from the script blocking mode of InetGet to X Background Downloads at same time. 
  • adding additional infos of the DL-files (size, date)
  • sorting the LV by clicking ColumnHeader
  • and, and ...

But please when implementing new features test the example(s) of needed func's.

 

Have fun with the script and test excesive (it's 4:50 in Germany and i am tired)  

Share this post


Link to post
Share on other sites
On 1/29/2016 at 10:44 PM, AutoBert said:

Your code was not the best and (for me)  bad to read, so renamed some Variables, moved functions to another place etc. For my logic of UI a Button for filling DL-Listview must be,  so inserted. It's tested only little because my internetspeed is very poor (64 kbits/s).

Here is the script: mapDL.au3 It's not the best but runable.

What should be done:

  • commenting the script (by you with trying to understand the logic behind and reading about the (yet) unknown functions
  • searching for unused variables and funcs.

What could be done:

  • switch from the script blocking mode of InetGet to X Background Downloads at same time. 
  • adding additional infos of the DL-files (size, date)
  • sorting the LV by clicking ColumnHeader
  • and, and ...

But please when implementing new features test the example(s) of needed func's.

 

Have fun with the script and test excesive (it's 4:50 in Germany and i am tired)  

I will definitely do my best to improve my knowledge in AutoIT and become a better programmer. Thanks for the support and advice. I'll strive towards improving this project one day at a time!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now