AutoHotkey Community

It is currently May 27th, 2012, 12:55 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 646 posts ]  Go to page Previous  1 ... 30, 31, 32, 33, 34, 35, 36 ... 44  Next
Author Message
 Post subject:
PostPosted: December 29th, 2009, 4:02 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Sean wrote:
BTW
it is true that inexperience is the biggest hurdle

these are things that make handling a MODAL more challenging than a standard IE Browser

  • MODALS do not appear in the ShellWindows collection :twisted:
  • while the parent browser may be queried the MODAL window cannot itself(as far as i can tell anywhere) be queried successfully for an iWebBrowser2 interface but you may ask for the document which should be adequate for most automation
  • MODALS are a way to return data to a web script (VBScript or JScript) that typically requires user interaction to arrive at the desired return value. so by design the browser (firefox IE whatever if support MODAL) requires the process to halt untill the MODAL is dispatched

final point MODALS are not the only instance of this alerts messageboxes and many others if triggered directly via automation all manifest the same behavior. why is becoming such a hot topic when those do not?

I want to clarify these things I'm stating are true regardless of the language. these are not problems with AHK's implementation of COM its the way MODALS are created that make these things true

It may be easier to hack the pages script and insert the predetermined for automation returnvalue for the MODAL than to allow it to spawn in the first place

Bottom line these are not problems Sean, myself or really anyone can solve for you within COM or AHK itself. since it is the architecture of external technologies that create this challenge. Dealing with MODALS with automation should not be done by novices since doingso may require some unique to your situation creative coding.

which is why
tank wrote:
I have not nor do i intend to support ModalDialog boxes with iWeb library (at least in the near future) there is no reason to expect to see them in the real world often and its likely they will get fazed out in the future al together
if the example solution i provided isnt adequete its likely your going to need to just create something else.
@Sean I will not for fear of hijacking this thread post on this subject further as its not a COM problem but a problem of understanding the architecture of browsers. I regret having already showing how to handle MODALS in this thread

@Joy2DWorld
Joy2DWorld wrote:
also if you settimer, somesub, -100
into the call, does ahk still hang ?
Yes it would still hang

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Last edited by tank on December 29th, 2009, 4:21 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 4:17 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
In short, I think that multi-thread support is more a problem incurring than solving, especially from the point of view of developers/script providers, in a script environment where the code is plainly exposed to be freely altered.

Joy2DWorld wrote:
as for result := DLLCallThread(), can think of *a lot* of places where would come in handy.
Yes, I admit it can be handy for simple background jobs, however, those are not un-replacable by other means like SetTimer etc although they may be more cumbersome to use.

Quote:
Currently AHK script *must* wait for DLLCall to return. Why ?? (Not in why must that be with simple DLL Call, but.. why keep that limit when can be removed by simply allowing DLLCallThread().
Strictly speaking that's not the characteristic of DllCall itself, but that of the API it's calling. DllCall is merely a means to reach the API. Think about then why the API was designed from the start in that way. Could be just for simplicity for some of them, however, there exist ones for which it was crucial. Synchronization is the keyword for them. With multi-threading it's like that you just break those system-provided design and declare you'll take care of all yourself, either consciously or unconsciously. If you got feeling about how much experience it's gonna take to do it correctly (and how easily it can be breakable), I suggest to implement what you suggested lately in this thread using CreateThread etc.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 4:41 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
1. settimer won't solve dll as AHK is using psuedo threads.

2. have extensively experimented with AHK using script new thread solutions, and not happy results. EASY to implement as AHK native function, not reliable as far as I've found from within AHK (problem with inserting return values)


3. dependency on DLL to return *is* a serious AHK limitation that I have encountered in many different contexts.

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 5:06 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Joy2DWorld wrote:
have extensively experimented with AHK using script new thread solutions, and not happy results. EASY to implement as AHK native function, not reliable as far as I've found from within AHK (problem with inserting return values)
I'm aware that some members already reported about the ill-behaviors. Nevertheless, I think at least you got the feeling how much you should take into the consideration for your suggested solution, which appears simple, calling COM/iWeb functions from another thread to be correctly behaved.

Quote:
dependency on DLL to return *is* a serious AHK limitation that I have encountered in many different contexts.
Why is it a limitation? Or you just wanna have a separate DllCallAsync or alike?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 5:26 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
tank wrote:
it is true that inexperience is the biggest hurdle
Very nice speech, tank.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 5:30 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
Sean wrote:
Joy2DWorld wrote:
have extensively experimented with AHK using script new thread solutions, and not happy results. EASY to implement as AHK native function, not reliable as far as I've found from within AHK (problem with inserting return values)
I'm aware that some members already reported about the ill-behaviors. Nevertheless, I think at least you got the feeling how much you should take into the consideration for your suggested solution, which appears simple, calling COM/iWeb functions from another thread to be correctly behaved.

Quote:
dependency on DLL to return *is* a serious AHK limitation that I have encountered in many different contexts.
Why is it a limitation? Or you just wanna have a separate DllCallAsync or alike?


1. from my own play with threading in AHK, the problem is AHK internals not with simplicity of creating new thread to call dll from. if AHK internally just creates a threaded DLL call it can manage the return values exactly as handling callbacks right now.

2. unless am missing something the issue is of allowing dll call to new thread. AHK does not need to support AHK multi-thread to do that. Just to allow DLLCALL into new thread & insert return values (even if by callback type approach).

There are many dll calls for scanning/net functions like file downloads, all kinds of apis for dll called programs, etc., where the called routine takes a long time to respond. AHK is 'hung' for this entire time. just as one example.

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 6:07 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Joy2DWorld wrote:
There are many dll calls for scanning/net functions like file downloads, all kinds of apis for dll called programs, etc., where the called routine takes a long time to respond. AHK is 'hung' for this entire time. just as one example.
Windows usually provides asynchronous support to those APIs which are supposed to take long time to complete, either through optional parameters or with separate APIs. Anyway, if you feel the need of DllCallThread why don't you post about it in Wish List section? Have you already done that?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 6:25 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
Actually, Fiigured that no one else would need the function. This thread seems to indicate that maybe it would actually be generally useful, at any rate.

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Problems with COM.ahk
PostPosted: January 2nd, 2010, 8:25 pm 
Offline

Joined: December 16th, 2009, 5:59 pm
Posts: 12
I downloaded the COM_U.zip files and placed them in C:\Program Files\AutoHotkey\Lib directory which I created. Not sure about the '_U'.

I keep getting 'illegal character' messages when I try to use the com functions.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2010, 8:33 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
You need AutoHotkeyU, the Unicode version of AutoHotkey. There's a link to it in my signature.

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2010, 9:13 pm 
Offline

Joined: December 16th, 2009, 5:59 pm
Posts: 12
Does this replace AutoHotkey Version 1.0.48.05?

Will my other stuff still work?

Is there a version of COM.ahk that works with the standard AutoHotkey?

Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2010, 8:20 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
COM.zip is the one for the official build.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2010, 6:53 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Hey Sean, just wanted to know if you might have some guidance for me to troubleshoot a script that uses a lot of COM calls.

In the last couple of weeks my script has been prone to randomly locking up after I'd fire some hotkey that calls COM_Invoke and I wasn't able to pull up the lines most recently executed. When I was finally able to pull it up (momentarily) the last few lines that had executed appeared to be from COM_Unicode4Ansi, specifically:

Code:
VarSetCapacity(wString, nSize * 2 + 1)
DllCall("kernel32\MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", &wString, "int", nSize + 1)
Return   &wString


I never use that call but I did trace it back to COM_Invoke, but I don't know what would cause a COM_Invoke call to "terminate" in that function. There's no particular hotkey I can find that causes the problem, the most typical ones I've used when it occurs were ones I use to click buttons on a web page and one that copies data out of a cell in an Excel spreadsheet. The hotkey always completes its task but I'll have to close the process and restart it.

I haven't changed anything about the COM functions and I downloaded a fresh copy and used it just to make sure the problem was still occurring. Any thoughts on where to look for a problem?

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2010, 1:02 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
sinkfaze wrote:
In the last couple of weeks my script has been prone to randomly locking up after I'd fire some hotkey that calls COM_Invoke
How rapidly did you fire the hotkeys? As a first attempt to remedy, I suggest to add Critical into the hotkeys or into COM_Invoke.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2010, 4:48 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
If the hotkey takes a little time to complete, it might help to also use the N parameter; e.g. Critical 1000 makes AutoHotkey wait 1000ms between checking for messages. A_IsCritical can be used to save the script's current state for later restoration.
sinkfaze wrote:
I never use that call but I did trace it back to COM_Invoke, but I don't know what would cause a COM_Invoke call to "terminate" in [COM_Unicode4Ansi].
It's almost impossible for the script to stop at Return &wString. Much more likely (especially for COM_Invoke) is something like this:
Code:
DllCall(...COM_Unicode4Ansi(...)...)
When evaluation of the line begins, the DllCall line is logged. DllCall itself isn't called until after COM_Unicode4Ansi is called and is logged in ListLines. If nothing appears after COM_Unicode4Ansi in ListLines, it's probably stalled in the DllCall. Here's a more practical example:
Code:
X(Y())
ListLines
Pause
X(a){
    return "X is called"
}
Y(){
    return "Y is called"
}

It's most likely stalled in pdsp->Invoke (i.e. the particular method you're calling to "click buttons on a web page").


Edit: (on an unrelated note)

Sean, would you mind making COM_SysString an alias for COM_Unicode4Ansi in COM_L? It would make supporting COM_L and COM_U together easier. Actually, might be a good idea to add it to COM.ahk as well...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 646 posts ]  Go to page Previous  1 ... 30, 31, 32, 33, 34, 35, 36 ... 44  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cristi® and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group