Website Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • August 30, 2015, 07:33:29 PM
  • Proudly celebrating 10 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: DONE: AutoHotkeyUpdateChecker  (Read 4425 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,122
    • View Profile
    • Donate to Member
DONE: AutoHotkeyUpdateChecker
« on: February 21, 2006, 12:40:40 PM »
Hi,

I was told about a really great idea - a tiny script to automatically check for new versions of AutoHotkey!

From http://s89775182.onl...um/viewtopic.php?t=8 :
Code: [Select]
;---2005-10-16 garry, check AutoHotKey for new version -------------
F1=%A_ScriptDir%\AHKURL.TXT
A=%A_AHKVERSION%
URLDownloadToFile,http://www.autohotkey.com,%F1%
I=0
Loop
{
        I+=1
        FileReadLine, line, %F1%, %i%
        if ErrorLevel <> 0
        exitApp
   IfInString,line,The latest version is
        {
   stringmid,BA,LINE,25,18
        GOTO A2
        }
}
A2:
FileDelete,%F1%
B1=%BA%
I=0
loop,parse,B1,`
{
   Transform,B2,ASC,%A_LOOPFIELD%
   I+=1
   if B2<46
   GOTO A3
   if B2>57
   GOTO A3
}
A3:
stringmid,B,B1,1,I-1
if A<>%B%
{
msgbox,(Changed) Your existing version is=%A%, Actual version is=%B%
run,http://www.autohotkey.com/download
ExitApp
}
else
{
msgbox,(Equal) Your existing version is=%A%, Actual version is=%B%
MsgBox, 4, , Start AHK Forum?
IfMsgBox,No
return
Else
Run,http://www.autohotkey.com/forum
ExitApp
}
I'm sure someone in here could even optimize that? To maybe let it auto-check at a given interval, add some other stuff, ...?
« Last Edit: March 07, 2006, 01:29:53 AM by brotherS »

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,122
    • View Profile
    • Donate to Member
Re: DONE: AutoHotkeyUpdateChecker
« Reply #1 on: March 07, 2006, 01:33:41 AM »
new, better version, which checks silently every 8 hours:

Code: [Select]
GoSub, AutoExec11

[...]

;2006-03-04
;check for new AutoHotKey version
#Persistent
AutoExec11:
SetTimer, UpdateCheckAHK, 28800000 ; check every 8 hours
return
;
UpdateCheckAHK:
F1=http://www.autohotkey.com/download/CurrentVersion.txt
F2=%A_ScriptDir%\AHKURL.TXT
A =%A_AHKVERSION%

SetTitleMatchMode, 1
If WinExist("AutoHotkey Download")
    TrayTip, AutoHotkey, already open
else
 {
 URLDownloadToFile,%F1%,%F2%
 Splashimage, off
 Filereadline,B,%F2%,1
 if A<>%B%
    {
;    msgbox,(Changed) Your existing version is=%A%, Actual version is=%B%
     Run,IExplore.exe http://www.autohotkey.com/download
    }
  else
    {
    TrayTip, AutoHotkey, no new version available
    }
 }
return

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: DONE: AutoHotkeyUpdateChecker
« Reply #2 on: March 07, 2006, 01:49:26 PM »
Just added it, and it checked for the new version correctlly!
Thanks! :D

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,216
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: DONE: AutoHotkeyUpdateChecker
« Reply #3 on: March 07, 2006, 08:19:34 PM »
brotherS,

i changed the timer to 0 and here is the result... ;-)

http://img215.imageshack.us/img215/4296/ahkupdate6lz.png
DONE: AutoHotkeyUpdateChecker


best regards,
lanux

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: DONE: AutoHotkeyUpdateChecker
« Reply #4 on: March 07, 2006, 08:44:37 PM »
Lanux: possibly, you already know this, but i'll say it anyways, better be safe than sorry.
Changing that timer to 0 will make the script be always checking for updates (i.e. always downloading the autohotkey.com page.)
Possibly, this will take you much bandwidth, and might not be the solution you were looking for.
To only have it execute once, you should change that timer to:
Code: [Select]
GoSub,UpdateCheckAHK,If you already knew this, sorry, but i supposed it was better to warn you (and other possible readers of this thread)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,216
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: DONE: AutoHotkeyUpdateChecker
« Reply #5 on: March 07, 2006, 09:57:47 PM »
jgpaiva: yes, now i know... ;-) tks anyway...

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,122
    • View Profile
    • Donate to Member
Re: DONE: AutoHotkeyUpdateChecker
« Reply #6 on: March 08, 2006, 02:48:06 AM »
Hi lanux128, welcome to the amazing world of AutoHotkey!  :D