 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 1331
|
Posted: Wed Oct 24, 2007 1:51 am Post subject: |
|
|
| lexikos wrote: | | Sean wrote: | | Code: | | pweb := COM_QueryService(pdoc,IID_IWebBrowserApp,IID_IWebBrowserApp) |
| Shouldn't that be IHTMLDocument or IHTMLDocument2? |
What I meant was this:
| Code: | ;ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, ahk_class IEFrame
MouseGetPos, , , , hIESvr, 2
If !hIESvr
ExitApp
IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}"
COM_CoInitialize()
DllCall("SendMessageTimeout", "Uint", hIESvr, "Uint", DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT"), "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 1000, "UintP", lResult)
DllCall("oleacc\ObjectFromLresult", "Uint", lResult, "Uint", COM_GUID4String(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}"), "int", 0, "UintP", pdoc)
pweb := COM_QueryService(pdoc, IID_IWebBrowserApp, IID_IWebBrowserApp)
COM_Release(pdoc)
|
|
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2542 Location: Australia, Qld
|
Posted: Wed Oct 24, 2007 9:52 am Post subject: |
|
|
I was somehow thinking in reverse (get pdoc from pweb,) but I see now what you meant by "can be used with any DOM objects." Useful to know; thanks.  |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1331
|
Posted: Wed Oct 24, 2007 2:56 pm Post subject: |
|
|
| lexikos wrote: | | Useful to know; |
Actually this was the original code, the ReadyState used to be queried through pweb. I recently changed it to make the code simpler, but I realized I also removed some useful info.  |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 422 Location: Galil, Israel
|
Posted: Thu Oct 25, 2007 1:36 am Post subject: |
|
|
ok, not exactly on topic, but,
can anyone explain the difference between | Code: | | MouseGetPos, , , , hIESvr, 2 | and | Code: | | MouseGetPos, , , , hIESvr, 3 |
the doc's | Quote: | specify one of the following digits:
1: Uses a simpler method to determine OutputVarControl. This method correctly retrieves the active/topmost child window of an Multiple Document Interface (MDI) application such as SysEdit or TextPad. However, it is less accurate for other purposes such as detecting controls inside a GroupBox control.
2 [v1.0.43.06+]: Stores the control's HWND in OutputVarControl rather than the control's ClassNN.
3 [v1.0.43.06+]: A combination of 1 and 2 above.
| doesn't seem to register for me.
'cause it sure seems that 3 is giving the actual control handle, while 2 gives a container handle. or some such thing... _________________ Joyce Jamce |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1331
|
Posted: Thu Oct 25, 2007 5:31 am Post subject: |
|
|
| Joy2DWorld wrote: | | 'cause it sure seems that 3 is giving the actual control handle, while 2 gives a container handle. |
Both will give the window handle of the control, just will use different methods.
2 with the default method, 3 with the simpler method. |
|
| Back to top |
|
 |
Erittaf
Joined: 03 Nov 2007 Posts: 182
|
Posted: Sat Dec 08, 2007 10:17 pm Post subject: |
|
|
Does anyone know of any difficulties running this on vista? I have a project that will be used on vista machines but I don't have vista at all. I want to use this function but I also need to be sure it will work.
Any vista users out there willing to test for me? |
|
| Back to top |
|
 |
Erittaf
Joined: 03 Nov 2007 Posts: 182
|
Posted: Sun Dec 09, 2007 12:51 am Post subject: |
|
|
alright... I have modified my code with some debugging statements so I can capture a line by line on what is happening on this remote vista machine.
Here's the code I am using: | Code: |
LoadIEDone(URL_TO_LOAD)
{
fileAppend, in function LOADIE`n, %A_Desktop%\debug.txt
CoInitialize()
fileAppend, coinint done`n, %A_Desktop%\debug.txt
pie := ActiveXObject("InternetExplorer.Application")
fileAppend, pie done `,%pie%`,`n, %A_Desktop%\debug.txt
Invoke(pie, "Visible=", "True")
fileAppend, invoke vis pie done `,%pie%`,`n, %A_Desktop%\debug.txt
Invoke(pie, "Navigate", URL_TO_LOAD)
fileAppend, invoke nav pie done `,%pie%`,`n, %A_Desktop%\debug.txt
Loop
{
fileAppend, loop %A_Index%`n, %A_Desktop%\debug.txt
If Invoke(pie, "ReadyState") = 4
{
fileAppend, breaking loop`n, %A_Desktop%\debug.txt
Break
}
Sleep, 500
}
Release(pie)
fileAppend, pie released`n, %A_Desktop%\debug.txt
CoUninitialize()
fileAppend, CoUninitialize() done`n, %A_Desktop%\debug.txt
return pie
} |
As you can see I have added a fileappend to an error.txt bwtewwn each line. I have found that on my XP SP2 machine it works fine but on my freind's vista machine it will get stuck in the loop.
Here's the contents of my "debug.txt" | Code: | in function LOADIE
coinint done
pie done ,39385724,
invoke vis pie done ,39385724,
invoke nav pie done ,39385724,
loop 1
loop 2
loop 3
loop 4
loop 5
loop 6
loop 7
loop 8
loop 9
loop 10
loop 11
loop 12
loop 13
loop 14
loop 15
loop 16
loop 17
loop 18
loop 19
loop 20
loop 21
loop 22
loop 23
loop 24
loop 25
loop 26
loop 27
loop 28
loop 29
loop 30
loop 31
loop 32
loop 33
loop 34
loop 35
loop 36
loop 37
loop 38
loop 39
loop 40
loop 41
loop 42
loop 43
loop 44
loop 45
loop 46
loop 47
loop 48
loop 49
loop 50
loop 51
loop 52
loop 53
loop 54
loop 55
loop 56
loop 57
loop 58
loop 59
loop 60
loop 61
loop 62
loop 63
loop 64
loop 65
loop 66
loop 67
loop 68
loop 69
loop 70
loop 71
loop 72
loop 73
loop 74
loop 75
loop 76
loop 77
loop 78
loop 79
loop 80
loop 81
loop 82
loop 83
loop 84
loop 85
loop 86
loop 87
loop 88
loop 89
loop 90
loop 91
loop 92
loop 93
loop 94
loop 95
loop 96
loop 97
loop 98
loop 99
loop 100
loop 101
loop 102
loop 103
loop 104
loop 105
loop 106
loop 107
loop 108
loop 109
loop 110
loop 111
loop 112
loop 113
loop 114
loop 115
loop 116
loop 117
loop 118
loop 119
loop 120
loop 121
loop 122
loop 123
loop 124
loop 125
loop 126
loop 127
loop 128
loop 129
loop 130
loop 131
loop 132
loop 133
loop 134
loop 135
loop 136
loop 137
loop 138
loop 139
loop 140
loop 141
loop 142
loop 143
loop 144
loop 145
loop 146
loop 147
loop 148
loop 149
loop 150
loop 151
loop 152
loop 153
loop 154
loop 155
loop 156
loop 157
loop 158
loop 159
loop 160
loop 161
loop 162
loop 163
loop 164
loop 165
loop 166
loop 167
loop 168
loop 169
loop 170
loop 171
loop 172
loop 173
loop 174
loop 175
loop 176
loop 177
loop 178
loop 179
loop 180
loop 181
loop 182
loop 183
loop 184
loop 185
loop 186
loop 187
loop 188
loop 189
loop 190
loop 191
loop 192
loop 193
loop 194
loop 195
loop 196
loop 197
loop 198
loop 199
loop 200
loop 201
loop 202
loop 203
loop 204
loop 205
loop 206
loop 207
loop 208
loop 209
loop 210
loop 211
loop 212
loop 213
loop 214
loop 215
loop 216
loop 217
loop 218
loop 219
loop 220
loop 221
loop 222
loop 223
loop 224
loop 225
loop 226
loop 227
loop 228
loop 229
loop 230
loop 231
loop 232
loop 233
loop 234
loop 235
loop 236
loop 237
loop 238
loop 239
loop 240
loop 241
loop 242
loop 243
loop 244
loop 245
loop 246
loop 247
loop 248
loop 249
loop 250
loop 251
loop 252
loop 253
loop 254
loop 255
loop 256
loop 257
loop 258
loop 259
loop 260
loop 261
loop 262
loop 263
loop 264 |
Anyone know why it would act differently on either machine? Or how to fix the unending loop? |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 422 Location: Galil, Israel
|
Posted: Sun Dec 09, 2007 2:12 am Post subject: |
|
|
_________________ Joyce Jamce |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Sun Dec 09, 2007 2:19 am Post subject: |
|
|
for me | Code: | | Invoke(pie, "ReadyState") | is always returning '0'.
Vista Home Premium. _________________
 |
|
| Back to top |
|
 |
Erittaf
Joined: 03 Nov 2007 Posts: 182
|
Posted: Sun Dec 09, 2007 4:05 am Post subject: |
|
|
yeah, it seems that something is wrong there... It returns 4 on my XP SP2 machine just fine, but the vista box I am forced to work with doesn't return 4... ever.
@Joy2DWorld loop 20 defeats the purpose of the entire function. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2542 Location: Australia, Qld
|
Posted: Sun Dec 09, 2007 5:11 am Post subject: |
|
|
On my Vista Business system it opens two windows: one that is eternally "Connecting..." and one that actually loads the page. My guess is 'pie' refers to the one that is eternally connecting, since commenting out Visible= prevents it from showing.
You may have more success starting iexplore.exe, retrieving the WebBrowser of the window, and invoking Navigate() on it. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1331
|
Posted: Sun Dec 09, 2007 7:36 am Post subject: |
|
|
I've never accessed Vista, so I don't have an idea at all about this. Judging from lexikos said, I only have one suggestion to modify "Navigate" as
| Code: | | Invoke(pie, "Navigate", URL_TO_LOAD, 0) |
and/or replace Navigate with Navigate2.
If not work, you have to retrieve the WebBrowser control of the interested page. |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Sun Dec 09, 2007 5:43 pm Post subject: |
|
|
The ready state function is failing. _________________
 |
|
| Back to top |
|
 |
Erittaf
Joined: 03 Nov 2007 Posts: 182
|
Posted: Mon Dec 10, 2007 1:18 am Post subject: |
|
|
Yes I can confirm that this generates double IE windows. Also the "ready State" is failing... I can play around with code all day long and never know when it'll work on vista.
Vista AHKer's!! please help me out on this one! |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1331
|
Posted: Mon Dec 10, 2007 2:05 am Post subject: |
|
|
I'm not sure if it's a feature or a bug of (IE in) Vista. You may replace the ReadyState loop with the following:
| Code: | Loop
If pdoc:=Invoke(pie, "Document")
Break
Else Sleep 100
Loop
If Invoke(pdoc, "readyState") = "complete"
Break
Else Sleep 500
Release(pdoc)
|
Or, I suggest to run the following script after triggering Navigate to see what's running:
http://www.autohotkey.com/forum/topic19255.html |
|
| 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
|