AutoHotkey Community

It is currently May 27th, 2012, 3:49 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: myget
PostPosted: September 17th, 2005, 8:02 am 
Offline

Joined: April 20th, 2005, 8:44 am
Posts: 25
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 November 7th, 2005, 11:32 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2005, 10:36 pm 
Offline

Joined: April 20th, 2005, 8:44 am
Posts: 25
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2005, 11:08 pm 
Offline

Joined: December 15th, 2004, 10:24 pm
Posts: 303
Location: United States
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>>


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2005, 11:25 pm 
Offline

Joined: April 20th, 2005, 8:44 am
Posts: 25
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2005, 9:45 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2005, 9:08 pm 
Offline

Joined: April 20th, 2005, 8:44 am
Posts: 25
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 9th, 2005, 9:32 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2005, 2:09 am 
Offline

Joined: April 20th, 2005, 8:44 am
Posts: 25
toralf wrote:
...
Currently you have 1618 lines, let's see how low you can get. :)


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

olaf

_________________
Berserker


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 22 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group