| View previous topic :: View next topic |
| Do you think this tutorial is beneficial to the AHK Community? |
| Yeah, I think this tutorial is a great value-add to the Community. |
|
86% |
[ 91 ] |
| Nope - I think this tutorial is a waste of web space. |
|
0% |
[ 1 ] |
| I think this tutorial would be better if it incorporated AHK_L & COM_L. |
|
12% |
[ 13 ] |
|
| Total Votes : 105 |
|
| Author |
Message |
UncleScrooge
Joined: 14 Apr 2009 Posts: 75 Location: Italy
|
Posted: Mon Nov 30, 2009 5:44 pm Post subject: |
|
|
| jethrow wrote: | - Why are you using pweb & pwb? Should be: | Code: | | MsgBox % COM_Invoke(pweb,"document.getElementsByTagName[h1].item[0].innerHTML") |
|
holymoly! what a moron... (me)
that's it! just a stupid "e" bug (friggin Napier)
thx a ton jethrow and all of you guys. _________________ Intel Centrino @ 2.8GHz
4 GB RAM
WIN XP SP3 |
|
| Back to top |
|
 |
poetbox
Joined: 07 Jan 2007 Posts: 107
|
Posted: Fri Dec 18, 2009 4:53 am Post subject: |
|
|
I use the COM_U to deal with a Unicode file,an error occar.
What shall I do?[/img] |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Fri Dec 18, 2009 5:15 am Post subject: |
|
|
In a function variables do not require percent signs unless you are using them dynamically (and literal text must be quoted):
| Code: | | COM_Invoke(pweb,"document.all.atc_content.value",A_LoopField) |
_________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
poetbox
Joined: 07 Jan 2007 Posts: 107
|
Posted: Fri Dec 18, 2009 9:51 am Post subject: |
|
|
| sinkfaze wrote: | In a function variables do not require percent signs unless you are using them dynamically (and literal text must be quoted):
| Code: | | COM_Invoke(pweb,"document.all.atc_content.value",A_LoopField) |
|
Thank you.Very good.
OK! |
|
| Back to top |
|
 |
incith
Joined: 01 Oct 2005 Posts: 130 Location: Canada
|
Posted: Fri Dec 25, 2009 6:22 pm Post subject: |
|
|
Having a problem with an onchange + onkeyup event. Basically I am trying to put text into a field, which is working fine, and then clicking the Search button, which also works fine.
The problem comes with the field I am putting text into, is expecting you to be typing into the field. When you type into the field it then triggers the onchange / onkeyup events: | Code: | | <INPUT onkeyup=fullNameParse267656572(this.value) onchange=fullNameParse267656572(this.value) value="THE TEXT I PUT IN" name="attribute.Full Name" autocomplete="off"> |
Using | Code: | | iWeb_setDomObj(netcare,"attribute.Full Name",myName,"23,48,10") |
to set the text within an iFrame, but it does not trigger the events. I tried playing with iWeb_FireEvents() to no luck.
Offtopic Edit: The "ahk web recorder" program is freaking wonderful. The only bug that threw me off at first was that it does not comma separate the first two iFrame numbers, e.g. I had iFrame one number "23" and the second was "48", and a third was "10". It gave me "2348,10". Once I changed it to "23,48,10" all worked great. |
|
| Back to top |
|
 |
jethrow
Joined: 24 May 2009 Posts: 1907 Location: Iowa, USA
|
Posted: Fri Dec 25, 2009 7:49 pm Post subject: |
|
|
Try firing the onchange event like this:
| Code: | element := COM_Invoke(netcare, "document.all[23].contentWindow.document.all[48].contentWindow.document.all[10].contentWindow.document.all","attribute.Full Name")
COM_Invoke(element, "fireEvent", "onchange") |
btw - MERRY CHRISTMAS _________________
- in case I forgot to smile
Basic Webpage Controls
COM Object Reference |
|
| Back to top |
|
 |
incith
Joined: 01 Oct 2005 Posts: 130 Location: Canada
|
Posted: Fri Dec 25, 2009 8:49 pm Post subject: |
|
|
| jethrow wrote: | Try firing the onchange event like this:
| Code: | element := COM_Invoke(netcare, "document.all[23].contentWindow.document.all[48].contentWindow.document.all[10].contentWindow.document.all","attribute.Full Name")
COM_Invoke(element, "fireEvent", "onchange") |
btw - MERRY CHRISTMAS |
Thank you VERY MUCH!
This is the present I needed most.
Seasons Greetings to all!!!! |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Sat Dec 26, 2009 5:31 am Post subject: |
|
|
| incith wrote: | | Offtopic Edit: The "ahk web recorder" program is freaking wonderful. The only bug that threw me off at first was that it does not comma separate the first two iFrame numbers... |
A problem none of us who are working on it probably had a chance to catch because we don't have any web pages that required us to recurse that deep into frames readily available to us. The official release probably won't be updated for a week or more, in the meantime you can make this change in the script under the Ctrl+e hotkey (should be around line 181):
| Code: | | fpath.=(A_Index=1 ? "" : ",") ((f1) ? (f1) : ((f3) ? (f3) : (f2))) ; the ternary statements should've been reversed |
And thanks for the compliments.  _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 1199
|
Posted: Wed Dec 30, 2009 12:00 pm Post subject: |
|
|
I'm referring to this piece of code quoted in the first post in tanks thread from Sean:
| Code: | COM_Init()
psh := COM_CreateObject("Shell.Application")
psw := COM_Invoke(psh, "Windows")
Loop, % COM_Invoke(psw, "Count")
pwb := COM_Invoke(psw, "Item", A_Index-1), sInfo .= COM_Invoke(pwb, "hWnd") . " : """ . COM_Invoke(pwb, "LocationURL") . """,""" . COM_Invoke(pwb, "LocationName") . """,""" . COM_Invoke(pwb, "StatusText") . """,""" . COM_Invoke(pwb, "Name") . """,""" . COM_Invoke(pwb, "FullName") . """`n", COM_Release(pwb)
COM_Release(psw)
COM_Release(psh)
COM_Term()
MsgBox, % sInfo |
This produces COM errors ("Function Name: "hWnd"")
when Steam is running. Steam is using an IEFrame, so I suppose this might be related. Any idea what could be done to fix this? Personally, I am only interested in getting explorer windows. Maybe there is an explorer specific interface that could be queried or so before calling hwnd?
I already tried contacting Steam devs about this, but they don't want to investigate this from their side. |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Wed Dec 30, 2009 1:31 pm Post subject: |
|
|
What is the exact error message? And have you rebooted your computer and tried the code again?
Although a portion of that code is used in the iWeb_getWin function, that specific code doesn't really have much to do with this topic (other than tank linking to it in the old thread). _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 1199
|
Posted: Wed Dec 30, 2009 1:59 pm Post subject: |
|
|
---------------------------
COM Error Notification
---------------------------
Function Name: "hWnd"
ERROR: Unbekannter Fehler
(0x80004005)
PROG:
DESC:
HELP: ,0
Will Continue?
---------------------------
Ja Nein
---------------------------
I tried rebooting, restarting Steam etc. this is perfectly reproducable and only happens when Steam is running. I should probably also say that I'm running Win7 32Bit. I use similar code that navigates active Explorer window, and I also see the error there. With that code it sometimes also happens when called at "unusual" places (that is, during a folder change, when closing explorer window, and I believe also sometimes in control panel, however, those happen a bit too infrequently to verify for sure what causes them).
Explorer windows that were started before Steam are not affected, probably because they are listed before the Steam IEFrame and my code breaks when it finds the correct window, so Hwnd is not called on the IEFrame of Steam. |
|
| Back to top |
|
 |
jethrow
Joined: 24 May 2009 Posts: 1907 Location: Iowa, USA
|
Posted: Wed Dec 30, 2009 2:23 pm Post subject: |
|
|
| fragman wrote: | | Personally, I am only interested in getting explorer windows. Maybe there is an explorer specific interface that could be queried or so before calling hwnd? |
I would use something like this to filter out IE windows: | Code: | If pwb := COM_Invoke(psw, "Item", A_Index-1) ; ensure pwb isn't "empty"
If Not InStr( COM_Invoke(pwb, "FullName"), "iexplore.exe" ) ; ensure pwb isn't IE |
_________________
- in case I forgot to smile
Basic Webpage Controls
COM Object Reference |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Wed Dec 30, 2009 2:57 pm Post subject: |
|
|
Why do you need to retrieve the windows using the hWnd?
It looks like you've already covered this ground with Sean and I don't think anyone in this thread is more qualified to answer questions about this than he is. We can't answer every question about why some programs don't respond properly to a COM call, particularly when it's classified as an unknown error. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 1199
|
Posted: Wed Dec 30, 2009 4:10 pm Post subject: |
|
|
| Code: | If pwb := COM_Invoke(psw, "Item", A_Index-1) ; ensure pwb isn't "empty"
If Not InStr( COM_Invoke(pwb, "FullName"), "Steam.exe" ) ; ensure pwb isn't Steam |
This works very good, thank you!
I used hWnd because I wanted to capture the active window, and this seemed like the safest way. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Wed Dec 30, 2009 4:23 pm Post subject: |
|
|
and yet it isnt even relavant to the active window the way your retreiving it
IEGet from the first page of this thread is the very best way to get the top most browser window
also passing a blank name to iweb_getwin will as well _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
|