EDIT : the problem was with XP , works with WIN-10
thank you tank
I once used urldownloadtovar , but have no success with this
https://autohotkey.com/download/1.1/version.txt
or other question
I see the text in ActiveX , can I copy this text to a variable ?
Code: Select all
;xxa=Shell.Explorer ;- IExplorer
xxa=Mozilla.Browser ;- firefox
F1:="https://autohotkey.com/download/1.1/version.txt"
;F2:="https://autohotkey.com/download/ahk-install.exe"
Gui Add, ActiveX, x1 y2 w200 h50 vWB,%xxa%
WB.Navigate(F1)
Gui, Show, h100
return
GuiClose:
ExitApp
Example UrlDownloadToVar
Code: Select all
;f1:="http://50.7.70.58:8708/played.html"
F1:="https://autohotkey.com/download/1.1/version.txt" ;- a security error occured ( with XP ) WIN-10 OK
;f1:="http://www.wrongadress.htm" ;- not exist
xx:=ComObjCreate("WinHttp.WinHttpRequest.5.1") ;-Create the Object
;-- catch get error / don't show failure
;ComObjError(false)
;xx.Silent := True ;- script failure = off
xx.SetTimeouts(500,500,500,500)
try {
xx.Open("GET",f1) ;-Open communication
xx.Send() ;-Send the "get" request
aac=
aac:=xx.ResponseText ;-Set the "aac" variable to the response
msgbox, 262208,%f1%--TEXT ,%aac%
} catch e {
xxx:=e.Message
msgbox, 262208,ERROR ,Error=Catch`n%f1%`n------------------------------------------`n%xxx%`n------------------------------------------,
}
return
example works with XP , AHK-version compare
Code: Select all
setworkingdir,%a_scriptdir%
A =%A_AHKVERSION%
f1x:="https://autohotkey.com/download/1.1/version.txt"
;urldownloadtofile,%f1x%,version.txt ; no success with XP
;return
SplitPath,f1x, name, dir, ext, name_no_ext, drive
ref=%dir%
f2=%a_scriptdir%\%name%
WGET1=%A_SCRIPTDIR%\wget.exe
ifnotexist,%wget1%
{
if A_Is64bitOS
x1=https://eternallybored.org/misc/wget/current/wget64.exe
else
x1=https://eternallybored.org/misc/wget/current/wget.exe
urldownloadtofile,%x1%,wget.exe
}
ifexist,%f2%
filedelete,%f2%
runwait,%comspec% /c wget --no-parent --referer=%ref% "%f1x%",,hide
fileread,B,%f2%
if (A<>B)
{
msgbox, 262436,AHK-Version ,(Changed)`nYour existing version is=%A%`n Actual version is=%B%`n64-bit=%a_is64bitos%`nUnicode=%a_isunicode%`nOS=%a_osversion%`nWant you open Autohotkey downloads page ?
IfMsgBox,No
return
Else
{
run,https://autohotkey.com/download/
;run,https://autohotkey.com/download/ahk-install.exe
return
}
}
else
{
msgbox, 262436,AHK-Version ,(Equal)`nYour existing version is=%A%`n Actual version is=%B%`n64-bit=%a_is64bitos%`nUnicode=%a_isunicode%`nOS=%a_osversion%`nWant you open Autohotkey downloads page ?
IfMsgBox,No
return
Else
run,https://autohotkey.com/download/
return
}
return