 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
tic
Joined: 22 Apr 2007 Posts: 1271
|
Posted: Thu Apr 03, 2008 12:43 am Post subject: |
|
|
Mmmm it doesnt quite fit with what I want though.....
| Code: | #Persistent
#SingleInstance, Force
OnExit, CleanUp
Gui, 1: Add, Edit, x10 y10 w500 h200 vEdit1
Gui, 1: Add, Edit, xp+0 y+10 w500 h200 vEdit2
Gui, 1: Add, Edit, xp+0 y+10 w500 h200 vEdit3
Gui, 1: Show
COM_Init()
pwhr := COM_CreateObject("WinHttp.WinHttpRequest.5.1")
psink := ConnectIWinHttpRequestEvents(pwhr)
COM_Invoke(pwhr, "Open", "GET", "http://www.rlslog.net/", "True")
COM_Invoke(pwhr, "Send")
Sleep, 1000
COM_Invoke(pwhr, "Open", "GET", "http://n-europe.com/", "True")
COM_Invoke(pwhr, "Send")
Sleep, 1000
COM_Invoke(pwhr, "Open", "GET", "http://next-episode.net/", "True")
COM_Invoke(pwhr, "Send")
Return
CleanUp:
COM_Unadvise(NumGet(psink+8), NumGet(psink+12))
COM_Release(NumGet(psink+8))
COM_Release(pwhr)
COM_Term()
ExitApp
IWinHttpRequestEvents(This, nStatus="", pType="")
{
Global
Critical
;Tooltip, %A_EventInfo%
If (A_EventInfo = 0)
NumPut(This, pType+0)
Else If (A_EventInfo = 5)
{
Gui, 1: Submit, NoHide
GuiControl,, % !Edit1 ? "Edit1" : !Edit2 ? "Edit2" : "Edit3", % COM_Invoke(NumGet(this+4), "ResponseText") ;%
}
Return, 0
}
ConnectIWinHttpRequestEvents(pwhr)
{
Static IWinHttpRequestEvents
If !VarSetCapacity(IWinHttpRequestEvents)
{
VarSetCapacity(IWinHttpRequestEvents, 28, 0), nParams=3113213
Loop, Parse, nParams
NumPut(RegisterCallback("IWinHttpRequestEvents", "", A_LoopField, A_Index-1), IWinHttpRequestEvents, 4*(A_Index-1))
}
pconn := COM_FindConnectionPoint(pwhr, IID_IWinHttpRequestEvents:="{F97F4E15-B787-4212-80D1-D380CBBF982E}")
psink := COM_CoTaskMemAlloc(16), NumPut(pwhr, NumPut(&IWinHttpRequestEvents, psink+0))
NumPut(COM_Advise(pconn, psink), NumPut(pconn, psink+8))
Return, psink
} |
Just a quick test.
Note: All the above code is Sean's. I copied and pasted it
You see that those Sleep, 1000 are necessary and sometimes not adequate. The sleep needs to be increased and I sometimes (rarely) dont get all 3 results back with sleep 3000
It must depend on the system, so isnt really a very good example of asynchronous downloading, if such a massive gap is needed between files.
I need it to be quick, thats why I would want to download more than 1 file at once. Any ideas why it needs that massive sleep?
Also this still wouldnt work as how could I parse the information and have the listview usable on the gui? the info would need to be constantly parsing as fast as possible |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2359 Location: Australia, Qld
|
Posted: Thu Apr 03, 2008 4:34 am Post subject: |
|
|
I assume each "request" object can only handle one request at a time... Create a WinHttpRequest object for each concurrent request, rather than trying to reuse the same object.
| Quote: | | Also this still wouldnt work as how could I parse the information and have the listview usable on the gui? | Try explaining that again, without using a question as a "reason."
What I'd like to know is how could you parse the information and not have the ListView usable. Since AutoHotkey checks for messages every 5 ms by default, the ListView should remain responsive while script is running (but maybe not during a DllCall.) Anyway, assuming you are parsing search results, the parsing function should be lightning fast compared to the actual download. |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Sun Apr 20, 2008 6:02 pm Post subject: |
|
|
| Quote: | | what's IMPOSSIBLE with AHK? | Not much really. What's not practical to do in AHK code compared to alternatives might be a better way to phrase the question. Tasks that might require a lot of AHK code and/or workarounds can sometimes be accomplished easily in other languages, using command line utilities, etc... and then added to an AHK script using a relatively small amount of AHK code... For example, writing a dll (or using an existing one) to do various tasks then calling the dll from an AHK script can be very handy sometimes compared to writing long winded workarounds in AHK code . |
|
| Back to top |
|
 |
ManaUser
Joined: 24 May 2007 Posts: 900
|
Posted: Tue Apr 22, 2008 4:23 am Post subject: |
|
|
| Aside from things you can't do in any language (like peel potatoes), I think an OS is about the only think you absolutely couldn't make. (Which didn't stop someone from asking, I recall.) |
|
| Back to top |
|
 |
Adde_P
Joined: 04 Jun 2006 Posts: 180 Location: Sweden
|
Posted: Tue Apr 22, 2008 7:27 am Post subject: |
|
|
| ManaUser wrote: | | I think an OS is about the only think you absolutely couldn't make. (Which didn't stop someone from asking, I recall.) |
Remember im still here  _________________
 |
|
| Back to top |
|
 |
imapow
Joined: 13 Mar 2008 Posts: 89 Location: Trøndelag, Norway
|
Posted: Tue Apr 22, 2008 1:29 pm Post subject: |
|
|
| Adde_P wrote: |
Lets see whats impossible... World domination (Atleast I think so ) |
create a program to hack usa's, uk's and china's nuke siloes and rocet navigasjon satelittes. take the world by force and dominate _________________ -._.-¨¯¨-._.-IM@PΩW-._.-¨¯¨-._.- |
|
| Back to top |
|
 |
Adde_P
Joined: 04 Jun 2006 Posts: 180 Location: Sweden
|
Posted: Tue Apr 22, 2008 3:14 pm Post subject: |
|
|
| imapow wrote: |
create a program to hack usa's, uk's and china's nuke siloes and rocet
navigasjon satelittes. take the world by force and dominate |
*Adde_P Starts scripting  _________________
 |
|
| Back to top |
|
 |
Deller
Joined: 21 Nov 2007 Posts: 154 Location: 0x01101110
|
Posted: Fri Apr 25, 2008 12:00 am Post subject: |
|
|
| h4xx0r n00bl37 wrote: | | I don't think AHK can be used to peel potatos and make smoothies. |
at lease yet. there are always updates  |
|
| Back to top |
|
 |
heresy
Joined: 11 Mar 2008 Posts: 131
|
|
| Back to top |
|
 |
m^2
Joined: 28 Feb 2008 Posts: 34 Location: Krk, PL
|
Posted: Tue May 06, 2008 9:33 pm Post subject: |
|
|
Didn't try it, but you can use DllCall to allocate memory and then use this memory in subsequent API calls. _________________
|
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2359 Location: Australia, Qld
|
Posted: Tue May 06, 2008 10:41 pm Post subject: |
|
|
| heresy wrote: | does anybody have succeed on using Dllcall()
that requires pointer in arrays like this API? | Arrays are no different to any other structure. A WORD is 2 bytes, so "three arrays of 256 WORD elements" = 3 * 256 * 2 = 1536 bytes.
| Code: | VarSetCapacity(array, 1536)
; array_index: zero-based index of array (0-2)
; item_index: zero-based index of item within the array (0-255).
NumPut(value, array, array_index*256 + item_index*2, "short")
| That's a list in a string, not really an array. |
|
| Back to top |
|
 |
reft Guest
|
Posted: Wed May 07, 2008 8:24 pm Post subject: |
|
|
It would be weird if this site dinged and mewoed like my computer.  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|