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 ... , 19, 20, 21  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Joel's
Guest





PostPosted: Tue Jul 14, 2009 3:29 am    Post subject: passing the enter command through to embed ie if active Reply with quote

I'm using Sean's Com script to embed a very basic IE into a gui but the problem I have is trying to pass the enter key through to the browser. I'm very new to this so bear with me.

To add a little more detail, I have a virtual desktop with a smal browser embed and a few quick launch buttons but i have multiple gui that are set to be children of a parent. My goal is to pass the enter key through to IE if it is active. Right now when i'm a search page (google) I have to hit the search button instead of hitting enter to get it to actually search. It's driving me crazy. This is what I'm for the embed IE.


Code:
Gui, 1:Default
Gui +LastFound
Gui, Margin, 0, 0
Gui, +ToolWindow -Caption ; no title, no taskbar icon
Gui, Show, w%A_ScreenWidth% h%A_ScreenHeight%, Parent
Wi := "ahk_id" . WinExist()
Gui_1_ID := WinExist()






      ;Embeds and IE in the Gui


#Include IEControl.ahk
Gui, 2:Default
GoSub, GuiStart
 

Gui, +LastFound
Gui, Margin, 0, 0
Gui, +ToolWindow -Caption ; no title, no taskbar icon
Set_Parent_by_id(Gui_1_ID, 2) ; Window_ID, Gui_Number
Gui, Show, x380 y40 w900 h680, Child
hWnd := WinExist()

Run, "Y:\Custom Application\PLC Messages\PLC Messages.ahk"

CLSID_WebBrowser := "{8856F961-340A-11D0-A96B-00C04FD705A2}"
IID_IWebBrowser2 := "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}"
pwb := CreateObject(CLSID_WebBrowser, IID_IWebBrowser2)

AtlAxAttachControl(pwb, hWnd)
IE_LoadURL(pwb, "http://www.blackle.com/")


This is only a snippet of the entire code but it should be enough. Can anyone show me how to set it up? I'm thinking I would have to set up a hotkey, than identify wether the IE is active (selected) and send a command through to it if is or just Send, {Enter} if not. ???

Any help would be appreciated. Thanks in advance.
Back to top
tank



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

PostPosted: Tue Jul 14, 2009 1:15 pm    Post subject: Reply with quote

I know its alot to ask but so is asking to repost content. do you think you could manage to read this thread firs before asking?
This subject has been discussed at length by members. I will tell you there is a solution
_________________

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
joel's
Guest





PostPosted: Wed Jul 15, 2009 12:04 am    Post subject: apology Reply with quote

Thanks for being curtious about my stupidity. Much appreciated. I thought I went through the whole post and didn't find anything... obviously i was wrong. i have solved the problem thanks to all of the info on the page I missed.
Once again.... my apologies and thanks
Back to top
n-l-i-d
Guest





PostPosted: Wed Jul 15, 2009 2:17 pm    Post subject: Reply with quote

Can someone demonstrate the NewWindow2 event? I'm fiddling around with Xulrunner, and it doesn't have the NewWindow3 event, only the NewWindow2 event.

I found the example by Sean to redirect calls for a new window to the same control. I want to be able to do the same in Xulrunner (redirect to same control or new control)

Code:
Navigate:
COM_Invoke(pweb, "Navigate2", _URL_)
Return

Web_NewWindow3(prms)
{
   Global   _URL_:=   COM_DispGetParam(prms,4)
   COM_DispSetParam(-1,prms,1,11)
   SetTimer, Navigate, -10
}


Also, in Xulrunner, I cannot get elements from the page like expected.

This works fine:

Code:
COM_Invoke(pwb, "Navigate2", "javascript:alert(document.images.length)")


But this doesn't:

Code:
MsgBox % COM_Invoke(pwb, "document.images.length")


Question

It works with IE. I cannot seem to get handles in Xulrunner to all page elements.

Anybody willing to test this?

You'll need Xulrunner. Then you need to register the ActiveX

Code:
MozAxDir = %A_ScriptDir%\bin\xulrunner ; path to your xulrunner folder

RunWait, regsvr32.exe /s mozctlx.dll, %MozAxDir%, UseErrorLevel
      If ErrorLevel
          msgbox error registering ActiveX


After that, you can use any IE COM example. All you need to do is replace "Shell.Explorer" with "Mozilla.Browser" when you add the control with COM_AtlAxCreateContainer
Back to top
yosy11
Guest





PostPosted: Fri Jul 31, 2009 11:59 am    Post subject: Gui_IE Reply with quote

I'm using "IE4AHK" but the code of
Gui_IECut:
Gui_IECopy:
Gui_IEPaste:
Gui_IESelectAll:
is missing there,

so anyone knows the right code?
Back to top
YIessa
Guest





PostPosted: Fri Sep 11, 2009 1:58 pm    Post subject: IE_Copy Reply with quote

It seems that if I call IE_Copy() when no text is selected, it selects the whole paragraph.
Is there a way to get nothing copied when no text is selected ?
Thanks
Back to top
tank



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

PostPosted: Fri Sep 11, 2009 4:12 pm    Post subject: Reply with quote

Yea dont call it if nothing is selected
_________________

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
IE_Copy()
Guest





PostPosted: Fri Sep 11, 2009 4:14 pm    Post subject: Reply with quote

How do I know that nothing is selected ?
Back to top
tank



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

PostPosted: Fri Sep 11, 2009 4:33 pm    Post subject: Reply with quote

and vice versa how would one know if something was selected

here ill point you in the right direction Very Happy since your too lazy to try
Twisted Evil
http://msdn.microsoft.com/en-us/library/ms535869.aspx
Code:
document.selection.createRange.text
think you could figure out how to turn that into an invokeable statement?
well you will have to try if you want more help
But i doubt Sean will update the code you might just have to try figure it out a bit

why not just send ^c?
_________________

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
YIessa
Guest





PostPosted: Fri Sep 11, 2009 5:44 pm    Post subject: IE_Copy() Reply with quote

Thanks for your reply.

Not too lazy, just hoped there was a more top level solution

^C was the first thing I have tried, but the solution found in this forum to manage keys in IE Control, doesn't work for me

Code:
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
;   If   (wParam = 0x08 || wParam = 0x09 || wParam = 0x0D || wParam = 0x26 || wParam = 0x28 || wParam = 0x2E || wParam = 0x43 || wParam = 0x56 || wParam = 0x58)
   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)
      If   DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)=0
      Return   0
   }
}



No ^C, so I tried the given IE_Copy()
It works well when there is some text selected but selects the entire paragraph when where is no text selected

I will follow your suggestion and try looking into the document for the selection

Thanks again for your answer
Back to top
tank



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

PostPosted: Fri Sep 11, 2009 6:06 pm    Post subject: Reply with quote

did you set pipa variable cause if you didnt then it woudlnt work

Code:
pipa := COM_QueryInterface(pwb, IOleInPlaceActiveObject_Interface)
OnMessage(WM_KEYDOWN:=0x0100, "WM_KEYDOWN")
OnMessage(WM_KEYUP:=0x0101, "WM_KEYDOWN")

_________________

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
YIessa
Guest





PostPosted: Mon Sep 14, 2009 11:19 am    Post subject: IE_Copy Reply with quote

Unfortunately, it doesn't work for me.

Maybe I ain't got the right DLL version ?
Can you tell me which dll is called and where I can find that DLL ?
Code:
If   DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)=0


Thanks in advance
Back to top
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Mon Sep 14, 2009 11:47 am    Post subject: Reply with quote

It didn't make a sense to me, so I tested, and nothing was copied if there was no selection. So, it's not a IE_Copy() problem. Just test it after defining a hotkey:
Code:
^+C::IE_Copy()
Back to top
View user's profile Send private message
YIessa
Guest





PostPosted: Mon Sep 14, 2009 12:52 pm    Post subject: IE_Copy Reply with quote

You are right. MY FAULT ! Embarassed Sorry for wasting your time.

Any idea about my problem : keys (Enter for example) not responding in IE Control ?
My IE version is 7.0.5730.13 and I read that it should work with IE7 and IE8.
Back to top
tank



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

PostPosted: Mon Sep 14, 2009 1:57 pm    Post subject: Reply with quote

They work for me on IE7 and 8
post your code?
_________________

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
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... , 19, 20, 21  Next
Page 20 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