Quote:
Yes, it works now. Now I just need a way to see if there's any way to check for installer changes and version updates, and also a way to automatically delete the installer when it's done running.
This should work-
Code:
U_TmpHtm = C:\ahk.html
U_TmpExe = C:\AutoHotkey.exe
URLDownloadToFile,http://www.autohotkey.com/download/,%U_TmpHtm%
Loop,Read,%U_TmpHtm%
{
IfInString,A_LoopReadLine,http://home.tampabay.rr.com/kodi/ahk/
{
U_Line = %A_LoopReadLine%
U_LineNumber = %A_Index%
Break
}
}
FileDelete,%U_TmpHtm%
If U_Line =
{
MsgBox,An error has occured: The specified link no longer exists.`nAutoUpdate will now close.
ExitApp
}
StringGetPos,U_URLBegin,U_Line,http://home.tampabay.rr.com/kodi/ahk/
U_URLBegin += 1
StringGetPos,U_URLEnd,U_Line,exe
U_URLEnd += 4
U_Count = %U_URLEnd%
U_Count -= %U_URLBegin%
StringMid,U_URL,U_Line,%U_URLBegin%,%U_Count%
StringMid, version1, U_URL, 51, 4, L
RegRead, version2, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AutoHotkey, DisplayName
StringRight, version2, version2, 6
StringReplace, version2, version2,.,,All
if version1 <> %version2%
{
URLDownloadToFile,%U_URL%,%U_TmpExe%
Run,%U_TmpExe%
winwait, ahk_class #32770
winwaitclose, ahk_class #32770
filedelete, %U_TmpExe%
}
else
{
msgbox, you have the latest version of Autohotkey
}
Return
I havn't tested it with older versions of autohotkey though.