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 

Embed an Internet Explorer control in your AHK Gui via COM
Goto page Previous  1, 2, 3 ... 15, 16, 17 ... 19, 20, 21  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Sun Mar 08, 2009 9:07 pm    Post subject: Reply with quote

Anonymous wrote:
How can one focus the embedded explorer?

GuiControl, Focus, Internet Explorer_Server1

doesn't seem to work
i dont understand the question
it has focus when you click it for sure are you after a particular element ?
explain your intent
_________________

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





PostPosted: Sun Mar 08, 2009 9:20 pm    Post subject: Reply with quote

What does this line do?
Code:
COM_Invoke(pweb,"document.parentwindow.execscript","alert('javascript')")
Back to top
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Sun Mar 08, 2009 9:21 pm    Post subject: Reply with quote

executes a javascript alert from the browser object referenced by pweb
_________________

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






PostPosted: Sun Mar 08, 2009 9:28 pm    Post subject: Reply with quote

tank wrote:
i dont understand the question
it has focus when you click it for sure are you after a particular element ?
explain your intent


I'd like to put keyboard focus onto the embedded IE control programatically, so when the GUI appears the embedded IE can be scrolled immediately with the cursor keys without having to click on it first with the mouse.
Back to top
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Sun Mar 08, 2009 9:44 pm    Post subject: Reply with quote

you should read the thread
http://www.autohotkey.com/forum/viewtopic.php?p=219999#219999
_________________

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






PostPosted: Mon Mar 09, 2009 5:18 am    Post subject: Reply with quote

Thank you.
Back to top
Guest






PostPosted: Fri Mar 13, 2009 9:13 pm    Post subject: Reply with quote

I tried IE4AHK and other embedded IE GUIs and it seems to me I cannot copy text from the embedded IE window.

Paste does nothing or pastes the thing previously copied elsewhere.

Isn't copy/paste supported here?
Back to top
soccer18soccer18



Joined: 18 Nov 2008
Posts: 101

PostPosted: Fri Mar 20, 2009 10:06 pm    Post subject: Reply with quote

Sean wrote:
soccer18soccer18 wrote:
What does the IE_SaveAs command do?
It does what does Save as ... command in the menu bar.


i knew that. thats not what i meant. i meant how do you use it?

and whats the difference between IE_Save and IE_SaveAs?



thanks.
Back to top
View user's profile Send private message
rulfzid



Joined: 27 Nov 2008
Posts: 62

PostPosted: Wed Mar 25, 2009 5:35 pm    Post subject: Reply with quote

[quote]
Code:
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
;  Critical 20
tooltip % wparam
  ;If  (wParam = 0x09 || wParam = 0x0D || wParam = 0x2E || wParam = 0x26 || wParam = 0x28) ; tab enter delete up down
  If  (wParam = 9 || wParam = 13 || wParam = 46 || wParam = 38 || wParam = 40) ; tab enter delete up down
  {
      WinGetClass, Class, ahk_id %hWnd%
     
      If  (Class == "Internet Explorer_Server")
          {
             Global pipa
             VarSetCapacity(Msg, 28)
             NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
             NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
             DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
             Return 0
          }
  }
}


Using this code, I can get everything but the "Enter" keystroke to work in an IE control. I double-checked the vkcode, and it is correct. Does anybody have ideas as to why "Enter" specifically would not work?
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Wed Mar 25, 2009 11:34 pm    Post subject: Reply with quote

rulfzid wrote:
Using this code, I can get everything but the "Enter" keystroke to work in an IE control. I double-checked the vkcode, and it is correct. Does anybody have ideas as to why "Enter" specifically would not work?
FYI, Enter key works fine with both IE7 & IE8 in my English XPSP3. I noticed you added tooltip, did you confirm the key appeared in tooltip? Then, I suggest to check the classname Class too.
Back to top
View user's profile Send private message
rulfzid



Joined: 27 Nov 2008
Posts: 62

PostPosted: Thu Mar 26, 2009 12:31 am    Post subject: Reply with quote

Sean wrote:
rulfzid wrote:
Using this code, I can get everything but the "Enter" keystroke to work in an IE control. I double-checked the vkcode, and it is correct. Does anybody have ideas as to why "Enter" specifically would not work?
FYI, Enter key works fine with both IE7 & IE8 in my English XPSP3. I noticed you added tooltip, did you confirm the key appeared in tooltip? Then, I suggest to check the classname Class too.


The key did appear in the tooltip, with the correct code.

It's weird, I added a tooltip to show me the class after the WinGetClass command, and it says "Internet Explorer_Server", but AHKWindowInfo shows me "Internet Explorer_Server1".

Now, that said, up, down, and tab work just fine when the class checks for "Internet Explorer_Server", but nothing works for me when i append the "1".

I'm also getting the same behavior on XPSP3 and Windows 7.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Thu Mar 26, 2009 2:56 am    Post subject: Reply with quote

rulfzid wrote:
It's weird, I added a tooltip to show me the class after the WinGetClass command, and it says "Internet Explorer_Server", but AHKWindowInfo shows me "Internet Explorer_Server1".
The number 1 etc is AHK's custom index appended to the class name to differentiate among the controls with the same class name.
Quote:
Now, that said, up, down, and tab work just fine when the class checks for "Internet Explorer_Server"
Post the whole code you used and explain where it didn't work, or if you don't want to, then I suggest to test it with the well-known page, e.g. Google. The form field itself can ignore the key strokes.
Back to top
View user's profile Send private message
rulfzid



Joined: 27 Nov 2008
Posts: 62

PostPosted: Thu Mar 26, 2009 4:45 am    Post subject: Reply with quote

Sean wrote:
Post the whole code you used and explain where it didn't work, or if you don't want to, then I suggest to test it with the well-known page, e.g. Google. The form field itself can ignore the key strokes.


Code:
#SingleInstance force

Gui, +LastFound +Resize
Gui, Show, w350 h500, Gmail Tasks via AHK
mgh := WinExist()
OnMessage(WM_KEYDOWN:=0x0100, "WM_KEYDOWN")
COM_AtlAxWinInit()
pwb := COM_AtlAxCreateControl(mgh, "Shell.Explorer")
pipa := COM_QueryInterface(pwb, "{00000117-0000-0000-C000-000000000046}")
COM_Invoke(pwb, "Navigate","https://mail.google.com/tasks/ig")

return

GuiClose:
   Gui, Destroy
   COM_Release(pipa)
   COM_Release(pwb)
   COM_AtlAxWinTerm()
ExitApp


WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
    ; backspace tab enter delete up down
     If  (wParam = 0x8 || wParam = 0x09 || wParam = 0x0D || wParam = 0x2E || wParam = 0x26 || wParam = 0x28)
     {
         WinGetClass, Class, ahk_id %hWnd%
         If  (Class = "Internet Explorer_Server")
             {
                Global pipa
                VarSetCapacity(Msg, 28)
                NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
                NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
                DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
                Return 0
             }
     }
}


I think it may have something to do with the Gmail Tasks app specifically, because Enter seems to work if I navigate to google.com.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Thu Mar 26, 2009 7:19 am    Post subject: Reply with quote

rulfzid wrote:
I think it may have something to do with the Gmail Tasks app specifically, because Enter seems to work if I navigate to google.com.
Enter works with the script in my test. I don't know why it didn't work with you, however, you may add one more line.
Code:
OnMessage(WM_KEYUP:=0x0101, "WM_KEYDOWN")
Back to top
View user's profile Send private message
rulfzid



Joined: 27 Nov 2008
Posts: 62

PostPosted: Thu Mar 26, 2009 7:58 am    Post subject: Reply with quote

Code:
#SingleInstance force

Gui, +LastFound +Resize
Gui, Show, w350 h500, Gmail Tasks via AHK
mgh := WinExist()
OnMessage(WM_KEYDOWN:=0x0100, "WM_KEYDOWN")
OnMessage(WM_KEYUP:=0x0101, "WM_KEYDOWN")
COM_AtlAxWinInit()
pwb := COM_AtlAxCreateControl(mgh, "Shell.Explorer")
pipa := COM_QueryInterface(pwb, "{00000117-0000-0000-C000-000000000046}")
COM_Invoke(pwb, "Navigate","https://mail.google.com/tasks/ig")

return

GuiClose:
   Gui, Destroy
   COM_Release(pipa)
   COM_Release(pwb)
   COM_AtlAxWinTerm()
ExitApp


WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
   ; backspace tab enter delete up down
     If  (wParam = 0x8 || wParam = 0x09 || wParam = 0x0D || wParam = 0x2E || wParam = 0x26 || wParam = 0x28)
     {
         WinGetClass, Class, ahk_id %hWnd%
         If  (Class = "Internet Explorer_Server")
             {
                Global pipa
                VarSetCapacity(Msg, 28)
                NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
                NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
                OutputDebug, % wParam " : " DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
                Return 0
             }
   }
}


I added the extra OnMessage and an OutputDebug for the DllCAll.

Interestingly, for the keys that work (up, down, backspace, delete, tab), it returns a 0 for the keydown and a 1 for the keyup.

For the Enter key, however, it returns 1 for both. I have absolutely no idea why.

Quote:
[4664] 8 : 0
[4664] 8 : 1
[4664] 9 : 0
[4664] 9 : 1
[4664] 46 : 0
[4664] 46 : 1
[4664] 38 : 0
[4664] 38 : 1
[4664] 40 : 0
[4664] 40 : 1
[4664] 13 : 1
[4664] 13 : 1



And here's the really weird thing: when I change the url to "http://www.google.com", the same series of OutputDebug logs shows:

Quote:
[5364] 38 : 0
[5364] 38 : 1
[5364] 40 : 0
[5364] 40 : 1
[5364] 8 : 0
[5364] 8 : 1
[5364] 46 : 0
[5364] 46 : 1
[5364] 9 : 0
[5364] 9 : 1
[5364] 13 : 0
[5364] 13 : 1


Can other people test this and see if you get similar results?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 15, 16, 17 ... 19, 20, 21  Next
Page 16 of 21

 
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