Hallo,
dieser ständige Wechsel zwischen AutoHotkey v1.1 und v2 macht mich noch ganz kirre!
Ich möchte am Browserstyle sofort erkennen um welchen Dialekt es sich gerade handelt.
Bei Urls wie:
viewtopic.php?f=82&p=524124
viewtopic.php?f=82&t=117967
weiß mein Autohotkey-Skript anhand der Forumsnummer 82 sofort, daß es sich um v2 handelt und aktiviert meinen V2-Style.
(v1.1: 6,7,19,76,93 / v2: 4,13,14,37,82,83,94,96)
Mein Problem sind Urls ohne Forumsnummer wie:
viewtopic.php?p=524124
viewtopic.php?t=117967
Wie kommt man da per Autohotkey-Skript am besten an die Forumsnummer? Irgendwie was mit PHP?
Welches Forum? PHP Anfrage an www.autohotkey.com Topic is solved
Moderator: jNizM
Re: Welches Forum? PHP Anfrage an www.autohotkey.com Topic is solved
Ich bin mir nicht sicher, ob ich dich richtig verstehe, aber meinst du vielleicht so etwas?
Code: Select all
#NoEnv
#Singleinstance Force
Url := "https://www.autohotkey.com/boards/viewtopic.php?p=524124"
Doc := DocumentFromHTML(URLDownloadToVar(Url))
If InStr(Brotkruemelnavigation := Doc.getElementById("nav-breadcrumbs").getElementsByClassName("crumb")[3].innerText, "V2")
MsgBox, ist version 2
Else If InStr(Brotkruemelnavigation, "V1")
MsgBox, ist version 1
Else
MsgBox, Konnte nicht ermittelt werden
DocumentFromHTML(HTML) {
Local
Doc := ComObjCreate("htmlfile")
Doc.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=9"">")
Doc.write(HTML)
Return Doc
}
URLDownloadToVar(url,ByRef variable=""){
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
hObject.Open("GET",url)
hObject.Send()
return variable:=hObject.ResponseText
}
Re: Welches Forum? PHP Anfrage an www.autohotkey.com
Vielen Dank, soetwas meinte ich!
Das 3. Krümel allein, reichte jedoch nicht. Deswegen nahm ich die Krümel 1-3:
Das 3. Krümel allein, reichte jedoch nicht. Deswegen nahm ich die Krümel 1-3:
Code: Select all
Url := "https://www.autohotkey.com/boards/viewtopic.php?t=117753"
Doc := DocumentFromHTML(URLDownloadToVar(Url)), Brotkrümel := ""
Loop, 3
Try Brotkrümel .= Doc.getElementById("nav-breadcrumbs")
.getElementsByClassName("crumb")[A_Index].innerText (A_Index<3?"/":"")
; Board index/AutoHotkey (v2, current version)/Bug Reports
If InStr(Brotkrümel, "V2")
MsgBox, ist version 2
Else If InStr(Brotkrümel, "V1")
MsgBox, ist version 1
Else
MsgBox, Konnte nicht ermittelt werden
DocumentFromHTML(HTML)
{
Local
Doc := ComObjCreate("htmlfile")
Doc.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=9"">")
Doc.write(HTML)
Return Doc
}
URLDownloadToVar(url,ByRef variable="")
{
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
hObject.Open("GET",url)
hObject.Send()
return variable:=hObject.ResponseText
}