Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

URLGet - Internet Explorer based Downloader


  • Please log in to reply
43 replies to this topic
SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Source code released: <!-- m -->http://gentee.com/ph...hp?p=9822#p9822<!-- m -->
View the code: <!-- m -->http://dl.dropbox.co... ... 0/URLGet.g<!-- m -->
kWo4Lk1.png

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Is it possible with this tool to do something similar to the IE menu item, "Save As Webpage, complete(*.htm, *.html)" so that the images and the css file is downloaded to a separate folder other than the source html? It enables the user to view the web page offline.


No need for a tool, should already be possible with AutoHotkey_L. I am no expert in COM, but - you could get a solution by posting a request in ask-for-help section.

  • Guests
  • Last active:
  • Joined: --
I don't think it's an easy task even with _L But thanks for the reply.

Delusion
  • Members
  • 272 posts
  • Last active: Jul 13 2014 09:04 PM
  • Joined: 16 Jul 2008
i just found this out and did some tests!
i think its awesome and i want to implement it in my script for downloading some data instead of internetfileread that im using now because it makes my script hang

so my question is :
how do i detect when the download is finished?

i want to download one file
when its finished get some data out of it with xpath
download next file using the data from before and so on
QuickSubs | Popcorn Movie Catalog
All my scripts are just in AutoHotkey v1.0.48.05

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

how do i detect when the download is finished?


You could track the progress by calling URLGet in four parameter mode

OR

If you require a simple solution like URLDownloadToFile, the following wrapper function should be sufficient:

URLGet( URL, MMH="Min" ) { ; MMH should be Max Min or Hide
 RunWait, %COMSPEC% /c URLGet "%URL%" %True% > %A_Temp%\URLGet.tmp,, %MMH% UseErrorLevel
 URLGetErrorLevel := ErrorLevel
 FileRead, CacheFileFullPath, %A_Temp%\URLGet.tmp
Return CacheFileFullPath, ErrorLevel := URLGetErrorLevel
}

URLGet() function will return the full path to Cache file if the download was successful.
URLGet() function will return null if the download fails or URLGet.exe is terminated by the user.
On either case, ErrorLevel will be set.

i want to download one file
when its finished get some data out of it


You may simply FileRead it like follows:

FileRead, HTM, % URLGet( "[color=darkred]http://www.google.com[/color]" )
MsgBox, % HTM


Delusion
  • Members
  • 272 posts
  • Last active: Jul 13 2014 09:04 PM
  • Joined: 16 Jul 2008
that little wrapper worked fine :D
download speed is MUCH faster and most of all my script doesnt hang anymore while im downloading!
thanks alot 8)
QuickSubs | Popcorn Movie Catalog
All my scripts are just in AutoHotkey v1.0.48.05

Maestr0
  • Members
  • 652 posts
  • Last active: Aug 17 2019 06:07 PM
  • Joined: 18 Oct 2008
Brilliant!
Would it be possible to add a parameter for outputfolder/-file?

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Would it be possible to add a parameter for outputfolder/-file?


URLDownloadToCacheFile() does not accept a target path and will only download to IE Cache.
Workaround is better done outside.

If you need to control download filename and path, you may use FileCopy/FileMove command like follows:

FileMove, % URLGet( "[color=#FF0000]http://www.google.com[/color]" ), [color=#FF0000]C:\goo.htm[/color]


URLGet( URL, MMH="Min" ) { ; MMH should be Max Min or Hide
 RunWait, %COMSPEC% /c URLGet "%URL%" %True% > %A_Temp%\URLGet.tmp,, %MMH% UseErrorLevel
 URLGetErrorLevel := ErrorLevel
 FileRead, CacheFileFullPath, %A_Temp%\URLGet.tmp
Return CacheFileFullPath, ErrorLevel := URLGetErrorLevel
}

To specify 'Output folder', you may use SetWorkingDir command:

SetWorkingDir, C:\
RunWait %A_ScriptDir%\URLGet.exe http://www.google.com
SetWorkingDir, %A_ScriptDir%

Edit: The following is simpler :oops:
RunWait URLGet.exe http://www.google.com, [color=#FF0000]C:\Test[/color]

Note: URLGet handles path in Unicode.

Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009
Have you considered the capabilities of a download manager?
Such as using multiple concurrent downloads to copy pieces of the file.

Maestr0
  • Members
  • 652 posts
  • Last active: Aug 17 2019 06:07 PM
  • Joined: 18 Oct 2008
Great, SKAN, thanks a lot!

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Have you considered the capabilities of a download manager?
Such as using multiple concurrent downloads to copy pieces of the file.


Will be too tough for me. :)

azure
  • Members
  • 1216 posts
  • Last active: Mar 18 2015 09:06 AM
  • Joined: 07 Jun 2007
can u make a gui of it?

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Gui for what?.. progress? The Gui will become unresponsive when connection is bad unless I use a worker thread.

Maestr0
  • Members
  • 652 posts
  • Last active: Aug 17 2019 06:07 PM
  • Joined: 18 Oct 2008
Probably he means a GUI to enter URLs into and a dialogue to save to, something like that, kinda like a download manager.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
GUI will be useful only if it is url-drag-drop capable.
Here is Sean's code, but I am unable to figure out the re-usable code.