 |
AutoHotkey Community Wir helfen uns gegenseitig aus der Patsche
|
| Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
| Autor |
Nachricht |
s09 Gast
|
Verfasst am: Do Jun 26, 2008 4:23 pm Titel: programm beendet sich alleine |
|
|
hi
ich habe ein problem ich mach mir gerade mehr oder weniger ein program mit dem aus links in der zwischenablage runterlädt nur da hab ich 2 probleme
1. jedes mal wenn ich einen neuen link in die zwischenablage kopiere muss ich das programm neustarten ... kann man das auch ohne jedes mal zu reloaden ??
2. wenn ich auf download sollte eigentlich die statusbar "sich bewegen" (mir fällt gerade kein anderer ausdruck ein ) why ?
hier ist ein bild kann man vill dann besser verstehen
http://img76.imageshack.us/img76/5370/dwxu0.jpg
und naja einiges wird euch vill. sehr bekannt vorkommen hab das eine oder andere aus dem forum hier kopiert ...
| Code: | #NoEnv
#Persistent
#SingleInstance force
URL3=%clipboard%
SplitPath,URL,name,
ifnotexist Downloads
filecreatedir, Downloads
ifnotexist downloader.ini
IniWrite, Downloads\, downloader.ini, Downloaderornder, Pfad
ifexist downloader.ini
INIRead, Pfad, downloader.ini, Downloaderornder, Pfad, downloads\
gui,color,F4F3FF
gui,add,tab, w480 h280, Download|Einstellungen
gui,add,edit, x120 y255 w300 h20 readonly
gui,add,progress, x120 y255 w300 h20 vPRBAR cFF7200 range0-%SIZE3%
gui,add,text, x120 y255 w300 h20 +0x200 +Center +BackgroundTrans vText22,
gui,show,h55 , Progress-Bar
gui,add,Button,x385 y5 w100 h20 gclose,Schließen
gui,add,Button,x15 y255 w100 h20 gStart,Download
gui,tab, Einstellungen
gui,add,edit,x300 y40 w80 r0 vedit01, %Pfad%
gui,add,text,x250 y40, >>>
gui,add,text,x150 y40 ,%Pfad%
gui,add,text,x20 y40, Downloader Ordner >>>
gui,add,Button,x385 y5 w100 h20 gclose,Schließen
gui,add,Button,x385 y235 w100 h20 greload,Reload
gui,add,Button,x385 y255 w100 h20 gsave, Speichern
gui,show,w500 h290,Downloader V0.1
return
START:
setformat,float,3
RES1:=0
RES1+=000
SIZE3:=HttpQueryInfo(URL3,5)
settimer,DDDD,1000
UrlDownloadToFile,%URL3%,%Pfad%\%NAME%
settimer,DDDD,OFF
GuiControl,,PRBAR, %SIZE3%
GuiControl,,Text22,FINISHED
DDDD:
Filegetsize,size1,%Pfad%\%NAME%
RES1:=Round((100*SIZE1)/SIZE3)
GuiControl,,PRBAR, %SIZE1% ;SIZE1 gibt Balken an SIZE3 ist max
GuiControl,,Text22,%RES1% `% SIZE=%SIZE3%
return
;================ BLOCK-A ==========================================================
/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HttpQueryInfo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;http://www.autohotkey.com/forum/topic10510.html&highlight=dllcall+wininet+internetclosehandle
;SIZE:=HttpQueryInfo(URL, 5)
;msgbox,262144,MESSAGE,SIZE = %SIZE% Byte
QueryInfoFlag:
HTTP_QUERY_RAW_HEADERS = 21
Receives all the headers returned by the server.
Each header is terminated by "\0". An additional "\0" terminates the list of headers.
HTTP_QUERY_CONTENT_LENGTH = 5
Retrieves the size of the resource, in bytes.
HTTP_QUERY_CONTENT_TYPE = 1
Receives the content type of the resource (such as text/html).
Find more at: http://msdn.microsoft.com/library/en-us/wininet/wininet/query_info_flags.asp
Proxy Settings:
INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
*/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HttpQueryInfo(URL, QueryInfoFlag=21, Proxy="", ProxyBypass="") {
hModule := DllCall("LoadLibrary", "str", "wininet.dll")
If (Proxy != "")
AccessType=3
Else
AccessType=1
io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags
If (ErrorLevel != 0 or io_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
iou_hInternet := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext
If (ErrorLevel != 0 or iou_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
VarSetCapacity(buffer, 1024, 0)
VarSetCapacity(buffer_len, 4, 0)
Loop, 5
{
hqi := DllCall("wininet\HttpQueryInfoA"
, "uint", iou_hInternet
, "uint", QueryInfoFlag ;dwInfoLevel
, "uint", &buffer
, "uint", &buffer_len
, "uint", 0) ;lpdwIndex
If (hqi = 1) {
hqi=success
break
}
}
IfNotEqual, hqi, success, SetEnv, res, timeout
If (hqi = "success") {
p := &buffer
Loop
{
l := DllCall("lstrlen", "UInt", p)
VarSetCapacity(tmp_var, l+1, 0)
DllCall("lstrcpy", "Str", tmp_var, "UInt", p)
p += l + 1
res := res . "`n" . tmp_var
If (*p = 0)
Break
}
StringTrimLeft, res, res, 1
}
DllCall("wininet\InternetCloseHandle", "uint", iou_hInternet)
DllCall("wininet\InternetCloseHandle", "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)
return, res
}
return
close:
exitapp
Guiclose:
ExitApp
save:
gui,submit,nohide
IniWrite, %Edit01%, downloader.ini, Downloaderornder, Pfad
return
reload:
reload
return
|
|
|
| Nach oben |
|
 |
BoBo² Gast
|
Verfasst am: Do Jun 26, 2008 5:50 pm Titel: |
|
|
| Zitat: | | 1. jedes mal wenn ich einen neuen link in die zwischenablage kopiere muss ich das programm neustarten ... kann man das auch ohne jedes mal zu reloaden ?? | Timer setzen, welcher das Clipboard überwacht. Sobald Inhalt vorhanden, abgreifen, Event starten und Clipboard zurücksetzen. Zurück auf Los.
| Zitat: | | 2. wenn ich auf download sollte eigentlich die statusbar "sich bewegen" (mir fällt gerade kein anderer ausdruck ein ) why ? | Ich vermute mal weil du es so beabsichtigst. Oder doch 'why not macht es der Fortschrittsbalken nie nicht das ding das wo da so?". War ein Konfusversuch, oder? |
|
| Nach oben |
|
 |
Dbof
Anmeldedatum: 10.01.2008 Beiträge: 253 Wohnort: C:\
|
|
| Nach oben |
|
 |
BoBo² Gast
|
Verfasst am: Do Jun 26, 2008 6:17 pm Titel: |
|
|
| Zitat: | | 2. wenn ich auf download sollte eigentlich die statusbar "sich bewegen" (mir fällt gerade kein anderer ausdruck ein ) why ? | Hat mich dann doch ganz stark daran erinnert ... [Warum?] |
|
| Nach oben |
|
 |
s09 Gast
|
Verfasst am: Do Jun 26, 2008 6:18 pm Titel: |
|
|
| Zitat: | | Ich vermute mal weil du es so beabsichtigst. Oder doch 'why not macht es der Fortschrittsbalken nie nicht das ding das wo da so?". War ein Konfusversuch, oder? |
ähm nochmal auf deutsch ^^ versteh ich jetzt irgentwie nicht  |
|
| Nach oben |
|
 |
Gast
|
Verfasst am: Do Jun 26, 2008 6:18 pm Titel: |
|
|
| BoBo² hat Folgendes geschrieben: | | Zitat: | | 2. wenn ich auf download sollte eigentlich die statusbar "sich bewegen" (mir fällt gerade kein anderer ausdruck ein ) why ? | Hat mich dann doch ganz stark daran erinnert ... [Warum?] |
... es gibt ja kein edit als gast ........... |
|
| Nach oben |
|
 |
Dbof
Anmeldedatum: 10.01.2008 Beiträge: 253 Wohnort: C:\
|
Verfasst am: Do Jun 26, 2008 7:02 pm Titel: |
|
|
was gibt es denn nicht zu verstehen?! du fragst dich, wieso sich deine Progressbar bewegt, wenn du auf download klickst...und wie sollen wir dann antworten?!? Wenn du deine Post sauberer schreiben würdest, könnte ich das auch verstehen... _________________ mein spontanes ControlSend - Tutorial:
http://de.autohotkey.com/forum/viewtopic.php?p=25173#25173 |
|
| Nach oben |
|
 |
s09 Gast
|
Verfasst am: Do Jun 26, 2008 7:16 pm Titel: |
|
|
sry
war eigentlich so gemeint wenn ich auf denn download button drücke das sich der balken NICHT BEWEGT das ist mein problem
er lädt die datei auch nicht |
|
| Nach oben |
|
 |
s09 Gast
|
Verfasst am: Do Jun 26, 2008 7:59 pm Titel: |
|
|
hab denn fehler selber gefunden uf >_>
| Code: | URL3=%clipboard%
SplitPath,URL,name, |
dort hat noch die 3 gefehlt
also
| Code: | URL3=%clipboard%
SplitPath,URL3,name, |
|
|
| Nach oben |
|
 |
s09 Gast
|
Verfasst am: Fr Jun 27, 2008 9:04 pm Titel: |
|
|
ich schon wieder
hab eine neues problem unzwar der balken ist direkt gefüllt hab schon versucht das zu ändern aber irgentwie ohne erfolg
siehe bild ....
 |
|
| Nach oben |
|
 |
code Gast
|
Verfasst am: Fr Jun 27, 2008 9:33 pm Titel: |
|
|
code?
codecodecode!
Wir brauchen doch den Code. |
|
| Nach oben |
|
 |
denick
Anmeldedatum: 15.09.2006 Beiträge: 1091 Wohnort: Berlin
|
Verfasst am: Fr Jun 27, 2008 9:39 pm Titel: |
|
|
Moin,
gibt es hier wirklich niemand, der den gegebenen Code lesen kann
Ich werde mich morgen melden  _________________ Hilfe zur Hilfe
(de)nick |
|
| Nach oben |
|
 |
Gast
|
Verfasst am: Fr Jun 27, 2008 9:42 pm Titel: |
|
|
| code hat Folgendes geschrieben: | code?
codecodecode!
Wir brauchen doch den Code. |
ist daaaa ganz oben |
|
| Nach oben |
|
 |
s09
Anmeldedatum: 27.06.2008 Beiträge: 30
|
Verfasst am: Fr Jun 27, 2008 10:12 pm Titel: |
|
|
so hab mich jetzt angemeldet ^^ muss nicht immer neue antwort schreiben hier ist nochmal der code und unnötige sachen entfernt ...
| Code: | #NoEnv
#Persistent
#SingleInstance force
URL3=%clipboard%
SplitPath,URL3,name,
ifnotexist Downloads
filecreatedir, Downloads
ifnotexist downloader.ini
IniWrite, Downloads\, downloader.ini, Downloaderornder, Pfad
INIRead, Pfad, downloader.ini, Downloaderornder, Pfad, downloads\
gui,color,F4F3FF
gui,add,tab, w480 h280, Download|Einstellungen
gui,add,edit, x120 y255 w300 h20 readonly
gui,add,progress, x120 y255 w300 h20 vPRBAR cFF7200 range0-%SIZE3%
gui,add,text, x120 y255 w300 h20 +0x200 +Center +BackgroundTrans vText22,
gui,show,h55 , Progress-Bar
gui,add,Button,x385 y5 w100 h20 gclose,Schließen
gui,add,Button,x15 y255 w100 h20 gStart,Download
gui,tab, Einstellungen
gui,add,edit,x300 y40 w80 r0 vedit01, %Pfad%
gui,add,text,x250 y40, >>>
gui,add,text,x150 y40 ,%Pfad%
gui,add,text,x20 y40, Downloader Ordner >>>
gui,add,Button,x385 y5 w100 h20 gclose,Schließen
gui,add,Button,x385 y235 w100 h20 greload,Reload
gui,add,Button,x385 y255 w100 h20 gsave, Speichern
gui,show,w500 h290,Downloader V0.1
return
START:
setformat,float,3
RES1:=0
RES1+=000
SIZE3:=HttpQueryInfo(URL3,5)
settimer,DDDD,1000
UrlDownloadToFile,%URL3%,%Pfad%\%NAME%
settimer,DDDD,OFF
GuiControl,,PRBAR, %SIZE3%
GuiControl,,Text22,FINISHED
return
DDDD:
Filegetsize,size1,%Pfad%\%NAME%
RES1:=Round((100*SIZE1)/SIZE3)
GuiControl,,PRBAR, %SIZE1% ;SIZE1 gibt Balken an SIZE3 ist max
GuiControl,,Text22,%RES1% `% SIZE=%SIZE3%
return
;================ BLOCK-A ==========================================================
/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HttpQueryInfo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;http://www.autohotkey.com/forum/topic10510.html&highlight=dllcall+wininet+internetclosehandle
;SIZE:=HttpQueryInfo(URL, 5)
;msgbox,262144,MESSAGE,SIZE = %SIZE% Byte
QueryInfoFlag:
HTTP_QUERY_RAW_HEADERS = 21
Receives all the headers returned by the server.
Each header is terminated by "\0". An additional "\0" terminates the list of headers.
HTTP_QUERY_CONTENT_LENGTH = 5
Retrieves the size of the resource, in bytes.
HTTP_QUERY_CONTENT_TYPE = 1
Receives the content type of the resource (such as text/html).
Find more at: http://msdn.microsoft.com/library/en-us/wininet/wininet/query_info_flags.asp
Proxy Settings:
INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
*/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HttpQueryInfo(URL, QueryInfoFlag=21, Proxy="", ProxyBypass="") {
hModule := DllCall("LoadLibrary", "str", "wininet.dll")
If (Proxy != "")
AccessType=3
Else
AccessType=1
io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags
If (ErrorLevel != 0 or io_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
iou_hInternet := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext
If (ErrorLevel != 0 or iou_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
VarSetCapacity(buffer, 1024, 0)
VarSetCapacity(buffer_len, 4, 0)
Loop, 5
{
hqi := DllCall("wininet\HttpQueryInfoA"
, "uint", iou_hInternet
, "uint", QueryInfoFlag ;dwInfoLevel
, "uint", &buffer
, "uint", &buffer_len
, "uint", 0) ;lpdwIndex
If (hqi = 1) {
hqi=success
break
}
}
IfNotEqual, hqi, success, SetEnv, res, timeout
If (hqi = "success") {
p := &buffer
Loop
{
l := DllCall("lstrlen", "UInt", p)
VarSetCapacity(tmp_var, l+1, 0)
DllCall("lstrcpy", "Str", tmp_var, "UInt", p)
p += l + 1
res := res . "`n" . tmp_var
If (*p = 0)
Break
}
StringTrimLeft, res, res, 1
}
DllCall("wininet\InternetCloseHandle", "uint", iou_hInternet)
DllCall("wininet\InternetCloseHandle", "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)
return, res
}
return
close:
exitapp
save:
gui,submit,nohide
IniWrite, %Edit01%, downloader.ini, Downloaderornder, Pfad
return
reload:
reload
return
|
|
|
| Nach oben |
|
 |
denick
Anmeldedatum: 15.09.2006 Beiträge: 1091 Wohnort: Berlin
|
Verfasst am: Sa Jun 28, 2008 9:10 am Titel: |
|
|
Moin,
ich habe mir Dein Skript mal angesehen und etwas umgebaut. Vielleicht gefällt es Dir ja so besser. Die meisten Anpassungen sind kommentiert:
| Code: | #NoEnv
#Persistent
#SingleInstance force
; Nach NeueDatei verschoben
; URL3=%clipboard%
; SplitPath,URL3,name,
; ------------------------------------------------------------------------------
; INI
IfNotExist downloader.ini
IniWrite, Downloads, downloader.ini, Downloaderordner, Pfad
; Unnötig bzw. fehlerträchtig
; ifexist downloader.ini
IniRead, Pfad, downloader.ini, Downloaderordner, Pfad, Downloads
; Es könnte ja sein, dass der Pfad wirklich aus der INI gelesen wird
IfNotExist %Pfad% ; Downloads
FileCreateDir, %Pfad% ; Downloads
; ------------------------------------------------------------------------------
; Gui
Gui,Color, F4F3FF
Gui,Add,tab, w480 h280, Download|Einstellungen
; Die folgenden 3 Felder liegen übereinander, warum?
; Schieben wir das Edit ein wenig nach oben, geben ihm eine Variable und
; füllen es mit der aktuellen Datei
; Gui,Add,Edit, x120 y255 w300 h20 readonly
Gui,Add,Edit, x120 y190 w350 h60 Readonly -VScroll -Wrap vEdit22
; Wenn Du die Gui nicht jedesmal neu erstellst, kennst Du die Bereichsgröße
; nicht, muss auch nicht sein, lass es einfach auf Standard (0-100)
Gui,Add,Progress, x120 y255 w350 h20 vPRBAR cFF7200 ; range0-%SIZE3%
Gui,Add,Text, x120 y255 w350 h20 +0x200 +Center +BackgroundTrans vText22,
Gui,show,h55 , Progress-Bar
Gui,Add,Button,x385 y5 w100 h20 gClose,Schließen
; Gönnen wir uns noch einen Button für die URL-Übernahme
Gui,Add,Button,x15 y190 w100 h20 gNeueDatei,Neue Datei
Gui,Add,Button,x15 y255 w100 h20 gStart,Download
Gui,tab, Einstellungen
Gui,Add,Edit,x300 y40 w80 r0 vEdit01, %Pfad%
Gui,Add,Text,x250 y40, >>>
; Dieser Text kann sich ändern, gib ihm eine Variable
Gui,Add,Text,x150 y40 vText01,%Pfad%
Gui,Add,Text,x20 y40, Downloader Ordner >>>
Gui,Add,Button,x385 y5 w100 h20 gClose,Schließen
; Den braucht es nimmer
; Gui,Add,Button,x385 y235 w100 h20 gReload,Reload
Gui,Add,Button,x385 y255 w100 h20 gSave, Speichern
Gui,show,w500 h290,Downloader V0.1
Return
; ------------------------------------------------------------------------------
NeueDatei:
; Wenn die folgenden 2 Anweisungen hier stehen, brauchst Du kein Reload
URL3=%clipboard%
SplitPath,URL3,name,
; Progress und Text zurücksetzen
GuiControl,,PRBAR, 0
GuiControl,,Text22,
; Edit22 füllen
SIZE3:=HttpQueryInfo(URL3,5)
GuiControl,,Edit22, Quelle:`t%URL3%`nZiel:`t%Pfad%\%NAME%`nGröße:`t%SIZE3% Bytes
ClipBoard=
Return
Start:
; Progress und Text zurücksetzen
GuiControl,,PRBAR, 0
GuiControl,,Text22,
; Überflüssig
; SetFormat,Float,3
; RES1:=0
; RES1+=000
; Nach NeueDatei verschoben
; SIZE3:=HttpQueryInfo(URL3,5)
SetTimer,DDDD,On
UrlDownloadToFile,%URL3%,%Pfad%\%Name%
Sleep, 500
SetTimer,DDDD,OFF
; Datei geladen = 100 %
GuiControl,,PRBAR, 100 ; %SIZE3%
GuiControl,,Text22,FINISHED
; Hier sollte ein Return stehen
Return
; ------------------------------------------------------------------------------
DDDD:
FileGetSize,size1,%Pfad%\%Name%
RES1:=Round((100*SIZE1)/SIZE3)
; Hier mit Prozenten arbeiten
GuiControl,,PRBAR, %RES1% ; %SIZE1% ;SIZE1 gibt Balken an, SIZE3 ist max
GuiControl,,Text22, %Size1% (%RES1% `%) von %SIZE3% Bytes
Return
; ------------------------------------------------------------------------------
Guiclose:
Close:
ExitApp
; ------------------------------------------------------------------------------
Save:
Gui,Submit,Nohide
IniWrite, %Edit01%, downloader.ini, Downloaderordner, Pfad
; Variablen und Anzeige auffrischen
Pfad := Edit01
GuiControl,,Text01,%Pfad%
Return
; ------------------------------------------------------------------------------
Reload:
Reload
Return
; ------------------------------------------------------------------------------
;================ BLOCK-A ==========================================================
/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HttpQueryInfo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;http://www.autohotkey.com/forum/topic10510.html&highlight=dllcall+wininet+internetclosehandle
;SIZE:=HttpQueryInfo(URL, 5)
;msgbox,262144,MESSAGE,SIZE = %SIZE% Byte
QueryInfoFlag:
HTTP_QUERY_RAW_HEADERS = 21
Receives all the headers returned by the server.
Each header is terminated by "\0". An additional "\0" terminates the list of headers.
HTTP_QUERY_CONTENT_LENGTH = 5
Retrieves the size of the resource, in bytes.
HTTP_QUERY_CONTENT_TYPE = 1
Receives the content type of the resource (such as text/html).
Find more at: http://msdn.microsoft.com/library/en-us/wininet/wininet/query_info_flags.asp
Proxy Settings:
INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
*/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HttpQueryInfo(URL, QueryInfoFlag=21, Proxy="", ProxyBypass="") {
hModule := DllCall("LoadLibrary", "str", "wininet.dll")
If (Proxy != "")
AccessType=3
Else
AccessType=1
io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags
If (ErrorLevel != 0 or io_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
iou_hInternet := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext
If (ErrorLevel != 0 or iou_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
VarSetCapacity(buffer, 1024, 0)
VarSetCapacity(buffer_len, 4, 0)
Loop, 5
{
hqi := DllCall("wininet\HttpQueryInfoA"
, "uint", iou_hInternet
, "uint", QueryInfoFlag ;dwInfoLevel
, "uint", &buffer
, "uint", &buffer_len
, "uint", 0) ;lpdwIndex
If (hqi = 1) {
hqi=success
break
}
}
IfNotEqual, hqi, success, SetEnv, res, timeout
If (hqi = "success") {
p := &buffer
Loop
{
l := DllCall("lstrlen", "UInt", p)
VarSetCapacity(tmp_var, l+1, 0)
DllCall("lstrcpy", "Str", tmp_var, "UInt", p)
p += l + 1
res := res . "`n" . tmp_var
If (*p = 0)
Break
}
StringTrimLeft, res, res, 1
}
DllCall("wininet\InternetCloseHandle", "uint", iou_hInternet)
DllCall("wininet\InternetCloseHandle", "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)
return, res
} |
_________________ Hilfe zur Hilfe
(de)nick |
|
| Nach oben |
|
 |
|
|
Du kannst Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum antworten.
|
Powered by phpBB © 2001, 2005 phpBB Group Deutsche Übersetzung von phpBB.de
|