topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 4:32 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Using AutoHotkey to auto-download and update programs  (Read 9345 times)

zridling

  • Friend of the Site
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,299
    • View Profile
    • Donate to Member
Using AutoHotkey to auto-download and update programs
« on: April 24, 2007, 10:02 AM »
noutters over in the XYplorer Forum posted this cool AutoHotkey script. Modify it to suit your own upgrade needs!
________________________________________________
This AutoHotkey script will download the lastest beta of XYplorer and upgrade it on your machine. Enjoy!

;-------------------Start of script-------------------------
#SingleInstance,Force
#Persistent
SetBatchLines,-1

UrlDownloadToFile, http://www.xyplorer....0_beta_noinstall.zip, c:\temp.zip
MsgBox,1,,Kill XYplorer process and upgrade?
IfMsgBox,Cancel
Return
IfWinExist, XYplorer
WinKill

; The following line should be changed according to the program you use to unzip your files
RunWait, E:\_Utilities\7za.exe e -y -o"C:\Program Files\XYplorer\" c:\temp.zip
;Uncomment and change the path of UPX if you want to compress the files in the XYplorer directory
;RunWait, c:\upx.exe -9 -f *.*,C:\Program Files\XYplorer

FileDelete, c:\temp.zip
run, C:\Program Files\XYplorer\XYplorer.exe
ExitApp

Return
;-------------------End of script-------------------------

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: Using AutoHotkey to auto-download and update programs
« Reply #1 on: April 25, 2007, 08:18 AM »
I made a similar script myself for other uses. The only problem with using it more generally is that you have to know the url of the download.

I have always wondered why more software authors don't make their latest release version availalbe via a fixed url, for example: http://softwareautho.../download/latest.php (which would return not a HTML page but the installation package with the right mime type)

This would open the door for many updating utilities.

zridling

  • Friend of the Site
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,299
    • View Profile
    • Donate to Member
Re: Using AutoHotkey to auto-download and update programs
« Reply #2 on: April 25, 2007, 09:26 AM »
I've never given this any thought until I saw the script. Don Lessau, who is XYplorer's dev, removed the last two numbers on his updates to accommodate users who do this. And it works for him because he's incrementally updating XYplorer throughout the week. So you could download the daily beta or grab it whenever you wanted.

DonL

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 171
    • View Profile
    • XYplorer File Manager
    • Donate to Member
Re: Using AutoHotkey to auto-download and update programs
« Reply #3 on: April 26, 2007, 02:09 AM »
I have always wondered why more software authors don't make their latest release version availalbe via a fixed url, for example: http://softwareautho.../download/latest.php (which would return not a HTML page but the installation package with the right mime type)
Good idea. Give me a little hint about the necessary php code and I do it. :)

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: Using AutoHotkey to auto-download and update programs
« Reply #4 on: April 26, 2007, 03:31 AM »
Wow.  ;DHere are 92 different implementations in PHP. A lot of them are free.

Basically what you do is set up an connection to the download and binary write it to the browser with the right mime type. If you want to understand how it works or create your own implementation I found the following link from about.com



DonL

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 171
    • View Profile
    • XYplorer File Manager
    • Donate to Member
Re: Using AutoHotkey to auto-download and update programs
« Reply #5 on: April 26, 2007, 06:08 AM »
I think all I need for this Autohotkey script is something like this:

<?php
header("Location: download/xyplorer_5.80_beta.zip");
?>

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: Using AutoHotkey to auto-download and update programs
« Reply #6 on: April 26, 2007, 06:53 AM »
ah yes a redirect, I'll test if this works here too. Sometimes the simplest solution is overlooked :) edit: Indeed it seems the UrlDownloadToFile function of AutoHotkey supports redirection perfectly.

The very simplest you can make something like this work I think would be:

#SingleInstance,Force
#Persistent
SetBatchLines,-1
UrlDownloadToFile, http://www.some.url/some.asp, c:\temp\destinat.ion
ExitApp
Return

With (my asp/vbscript example): (some.asp)
Code: ASP [Select]
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><%
  2. Option Explicit
  3. Response.Buffer = True
  4.  
  5. ' Permanent redirection
  6. Response.Status = "301 Moved Permanently"
  7. Response.AddHeader "Location", "http://www.some.url/redirect.exe"
  8. Response.End
  9. %>

Technical implementation is then not really a reason why not to support a 'latest' redirection link.
« Last Edit: April 26, 2007, 07:12 AM by justice »

DonL

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 171
    • View Profile
    • XYplorer File Manager
    • Donate to Member
Re: Using AutoHotkey to auto-download and update programs
« Reply #7 on: April 26, 2007, 07:21 AM »
ah yes a redirect, I'll test if this works here too. Sometimes the simplest solution is overlooked :) edit: Indeed it seems the UrlDownloadToFile function of AutoHotkey supports redirection perfectly.
Thanks for testing! :Thmbsup: