AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

what's IMPOSSIBLE with AHK?
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat
View previous topic :: View next topic  
Author Message
tic



Joined: 22 Apr 2007
Posts: 1271

PostPosted: Thu Apr 03, 2008 12:43 am    Post subject: Reply with quote

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 Razz

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
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2359
Location: Australia, Qld

PostPosted: Thu Apr 03, 2008 4:34 am    Post subject: Reply with quote

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
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2328

PostPosted: Sun Apr 20, 2008 6:02 pm    Post subject: Reply with quote

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 Wink .
Back to top
View user's profile Send private message Visit poster's website
ManaUser



Joined: 24 May 2007
Posts: 900

PostPosted: Tue Apr 22, 2008 4:23 am    Post subject: Reply with quote

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
View user's profile Send private message
Adde_P



Joined: 04 Jun 2006
Posts: 180
Location: Sweden

PostPosted: Tue Apr 22, 2008 7:27 am    Post subject: Reply with quote

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.)

Rolling Eyes Remember im still here Wink
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
imapow



Joined: 13 Mar 2008
Posts: 89
Location: Trøndelag, Norway

PostPosted: Tue Apr 22, 2008 1:29 pm    Post subject: Reply with quote

Adde_P wrote:

Lets see whats impossible... World domination (Atleast I think so Shocked )


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
View user's profile Send private message
Adde_P



Joined: 04 Jun 2006
Posts: 180
Location: Sweden

PostPosted: Tue Apr 22, 2008 3:14 pm    Post subject: Reply with quote

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 Twisted Evil
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Deller



Joined: 21 Nov 2007
Posts: 154
Location: 0x01101110

PostPosted: Fri Apr 25, 2008 12:00 am    Post subject: Reply with quote

h4xx0r n00bl37 wrote:
I don't think AHK can be used to peel potatos and make smoothies.

at lease yet. there are always updates Razz
Back to top
View user's profile Send private message
heresy



Joined: 11 Mar 2008
Posts: 131

PostPosted: Tue May 06, 2008 9:26 pm    Post subject: Reply with quote

apart from jokes, does anybody have succeed on using Dllcall()
that requires pointer in arrays like this API? http://msdn.microsoft.com/en-us/library/ms536529(VS.85).aspx
when an WinAPI requires array i don't really know how to get it working.
will it be possible with olegbl's REAL ARRAY?
anyone have tried it?

[ Moderator!: MSDN link fixed ]
_________________
let's support Wiki
automation helper for beginners
Back to top
View user's profile Send private message
m^2



Joined: 28 Feb 2008
Posts: 34
Location: Krk, PL

PostPosted: Tue May 06, 2008 9:33 pm    Post subject: Reply with quote

Didn't try it, but you can use DllCall to allocate memory and then use this memory in subsequent API calls.
_________________
Vista wrote:
Wait...
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2359
Location: Australia, Qld

PostPosted: Tue May 06, 2008 10:41 pm    Post subject: Reply with quote

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")
Quote:
will it be possible with olegbl's REAL ARRAY?
That's a list in a string, not really an array.
Back to top
View user's profile Send private message
reft
Guest





PostPosted: Wed May 07, 2008 8:24 pm    Post subject: Reply with quote

It would be weird if this site dinged and mewoed like my computer. Laughing Shocked
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group