Oh man, tank, you live up to your name, i got steamrolled by your tankiness
. This one was brutal for me to comprehend, in fact i did not fully understand your code. I never worked with regular expressions so i struggled a lot with nearly every line you wrote.
But most importantly i wanna thank you
. Thanks for your time and effort helping me with my issue, you rock man
, can’t believe you wrote a script that fast after i posted my question. Usually I find a solution just by googling some comparable codes but this time I’ve run out of ideas.
Since I’m totally new to regex, may I ask some beginner questions i still could’t answer for myself after skimming through several regex-tutorials and the ahk quick reference.
I couldn’t find information about the created com object „Msxml2.XMLHTTP“ and i don’t understand what „false“ means at the end of line 7 of your code, setting this value to true seems to not affect the result. Though i honestly have to say i even don’t know what „Com Object“ is at all. I see it has something to do with external libraries according to the ahk-documentation. So i guess that ComObject-thing maybe is something like a reference to another coding language (respectively „library“) and insofar „external“?
Nevertheless, I gave my best to understand your code. I guess your idea was to read the website source code and search for strings. I think that’s it, the outputvar of your code is the download-url but still not an absolute path. Perfect, that’s what i needed.
However, and a piece of cake compared to your work, i needed a regex match for the portable verison of the app, which is the download url that ends with „XMediaRecode3459_x64.zip“.
So, my code works as follows:
Code: Select all
whr := ComObjCreate("Msxml2.XMLHTTP")
whr.Open("GET", "https www.xmedia-recode.de /download.html", Broken Link for safety false)
whr.Send()
links := whr.ResponseText
FoundPos := RegExMatch(links, "<a class=""download_link"" href=""(http www.xmedia-recode.de /download/XMediaRecode[0-9]*_x64\.zip)""", Broken Link for safety OutputVar)
msgbox, %OutputVar1%
UrlDownloadToFile, %OutputVar1%, %Userprofile%\Desktop\XmediaRecode-Update.zip
I have to say i struggled a lot getting a regular expression to work in the regexmatch command in ahk whereas i could achieve working results fast by using some online regex testers. This was probably because I was pretty confused placing all the quotation marks.
Is there a better regular expression than the one i used in the code i posted above? For instance, the following regex does not work and i don‘t know why:
Code: Select all
FoundPos := RegExMatch(links, "<a class=""download_link"" href=""((.*?)([0-9]*)(_x64\.zip))", OutputVar)
Thanks again for the help and maybe you can answer some of my questions