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 

myget

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



Joined: 20 Apr 2005
Posts: 25

PostPosted: Sat Sep 17, 2005 7:02 am    Post subject: myget Reply with quote

Toralf's Streamripper was used as a template.
Shoehorn programming.

(gnu.org info - slightly modified)
"GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, terminals, etc."

Requirements:
wget win binaries http://xoomer.virgilio.it/hherold/
http://www.gnu.org/software/wget/
http://wget.sunsite.dk/news.shtml
Edit script to set wgetdir path.
Set download directory in Options. Must be set for script to work.

A work in progress but functional.
The WgetVer variable is only used for the default user agent text
within the script so change it if using a different version.

Works with 1.10, 1.10.1, 1.10.2b
Many options untested. Comments and suggestions welcome.

This script was too big to fit in a post here so it's at .net
myget1.ahk
75kb
http://www.autohotkey.net/~olaf/ahks/myget1.ahk

latest hash - 11-07-05
4baf57d774cb6a16e3471038fca008bb *myget1.ahk

olaf


Last edited by olaf on Mon Nov 07, 2005 10:32 pm; edited 2 times in total
Back to top
View user's profile Send private message
olaf



Joined: 20 Apr 2005
Posts: 25

PostPosted: Mon Nov 07, 2005 9:36 pm    Post subject: Reply with quote

For new win bins 1.10.2b.

Only change in the ahk script is the comment for the -m option.
and the bump of WgetVer var to 1.10.2.
Since the script is functionally exactly the same, there is no version change.

olaf
_________________
Berserker
Back to top
View user's profile Send private message
Decarlo110



Joined: 15 Dec 2004
Posts: 303
Location: United States

PostPosted: Mon Nov 07, 2005 10:08 pm    Post subject: Reply with quote

I clicked on the links to find out more. Perhaps you could include a short description in the first post; that way, maybe more users would be interested in downloading it.

This seems to be the first major downloading program? i've seen in the forum, although i haven't carefully read thru all past posts (yet). I've written my own small downloader (beta version) after Chris added the dedicated thread to service the keyboard and mouse hooks, in 1.0.39. Download progs and other code which earlier could experience lag are improved and much more usable because of that enhancement.
_________________
1) The Open Source Definition http://www.opensource.org/docs/definition_plain.php

2) Intuitive. Logical. Versatile. Adaptable. <<AutoHotkey>>
Back to top
View user's profile Send private message
olaf



Joined: 20 Apr 2005
Posts: 25

PostPosted: Mon Nov 07, 2005 10:25 pm    Post subject: Reply with quote

Decarlo110 wrote:
I clicked on the links to find out more. Perhaps you could include a short description in the first post; that way, maybe more users would be interested in downloading it.


You know you're probably right about that. This little prog is so well known in the linux community, and has been around for so many years, that I didn't even think about adding a description. I'll stick one in there. Thanks for the suggestion.

olaf
_________________
Berserker
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Tue Nov 08, 2005 8:45 am    Post subject: Reply with quote

Thanks for the credit.

That script is big. Maybe you can simplify some of the code with functions.

I like the Ini sections :) they are huge. But I do not see a way to simplify them.


Thanks for sharing.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
olaf



Joined: 20 Apr 2005
Posts: 25

PostPosted: Tue Nov 08, 2005 8:08 pm    Post subject: Reply with quote

toralf wrote:
That script is big. Maybe you can simplify some of the code with functions.


I've wanted to implement functions, but for some reason I still can't grasp how to call them within a script even after reading through the manual. Call it a brain fart. Can you give a simple example?

olaf
_________________
Berserker
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Wed Nov 09, 2005 8:32 am    Post subject: Reply with quote

I have some remarks:
1) the subroutine "Urlbox" is never used. Plus it is the same routine as "LstPresets". So either you delte the "UrlBox" or you combine them to one. Maybe even with only one lable.

2) The code of "BtnAddToPreset" and "BtnWo" are nearly equal. You can combine them with a function:
Code:
BtnAddToPreset:
  AddToPreset("0")
Return

BtnWo:
  AddToPreset("1")
Return

AddToPreset(option)
{
  global
  Gui, 1:Submit, NoHide
  GuiControlGet, Urlbox
  PresetLabel = PresetName
  PresetAddCount +=1
  URL = %Urlbox%
  SplitPath, Urlbox, PresetName, PresetPath
  if not PresetName
  ;   PresetName = %PresetPath%
     PresetName = PresetName
  If Urlbox
    {
      NumberOfPresets ++
      PresetArray[%NumberOfPresets%][1] := A_Space
      PresetArray[%NumberOfPresets%][2] = %PresetAddCount%) %PresetName%
      if option
          PresetArray[%NumberOfPresets%][3] = %Exec% %URL%
      else
          PresetArray[%NumberOfPresets%][3] = %URL%
      PresetArray[%NumberOfPresets%][4] := A_Space
      FoundPreset := False
    }
  Gosub, FillPresetsInList
}


3) the indentation in your code is very inconsistent, please revise it.

4) the labels: BtnBrowseDownloadDir,
BtnInputFile, BtnOutputDocument, BtnLogToFile, BtnAppendToFile, BtnLoadCookies, BtnSaveCookies, BtnPostFile, BtnCertificate, BtnPrivateKey, BtnCaCertFile, BtnRandomFile, BtnEgdFile are similar, only
BtnCaDir is different, since it uses FileSelectFolder. But the other could be simplified with a function:
Code:
GetFile(Text, Filetype, ControlName)
{
  global
  Gui, 2:+OwnDialogs
  FileSelectFile, SelectedFile,,, %Text%, %FileType%
  If SelectedFile
      GuiControl, , %ControlName%, %SelectedFile%
}


5) all the checkbox actions (ChkAcceptExt, ChkRejectExt, ChkAcceptDomains, ...) can maybe be simplified with one routine like this:
Code:
EvalCheckbox:
  Gui, Submit, NoHide
  StringReplace, EdtControl, A_GuiControl, Chk, Edt
  GuiControl, -Disabled%A_GuiControl%, %EdtControl%
return
*not sure*

Currently you have 1618 lines, let's see how low you can get. :)
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
olaf



Joined: 20 Apr 2005
Posts: 25

PostPosted: Fri Nov 11, 2005 1:09 am    Post subject: Reply with quote

toralf wrote:
...
Currently you have 1618 lines, let's see how low you can get. Smile


Thanks for the suggestions. That gives me some good starting points to do some clean ups.

olaf
_________________
Berserker
Back to top
View user's profile Send private message
Display posts from previous:   
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