DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: DONE: AutoHotkeyUpdateChecker  (Read 10,040 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
DONE: AutoHotkeyUpdateChecker
« on: February 21, 2006, 06: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.onlinehome.us/forum/viewtopic.php?t=8 :
Code
;---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, ...?
Thank you.
« Last Edit: March 07, 2006, 07:29 AM by brotherS »

brotherS

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

Code
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
Thank you.

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: DONE: AutoHotkeyUpdateChecker
« Reply #2 on: March 07, 2006, 07:49 PM »
Just added it, and it checked for the new version correctlly!
Thanks! :D

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: DONE: AutoHotkeyUpdateChecker
« Reply #3 on: March 08, 2006, 02:19 AM »
brotherS,

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



best regards,
lanux

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: DONE: AutoHotkeyUpdateChecker
« Reply #4 on: March 08, 2006, 02:44 AM »
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
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,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: DONE: AutoHotkeyUpdateChecker
« Reply #5 on: March 08, 2006, 03:57 AM »
jgpaiva: yes, now i know... ;-) tks anyway...

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
Re: DONE: AutoHotkeyUpdateChecker
« Reply #6 on: March 08, 2006, 08:48 AM »
Hi lanux128, welcome to the amazing world of AutoHotkey!  :D
Thank you.

Original address: https://www.donationcoder.com/forum/index.php?topic=2525.0