AutoHotkey Community

It is currently May 26th, 2012, 10:35 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 309 posts ]  Go to page Previous  1 ... 17, 18, 19, 20, 21  Next
Author Message
PostPosted: July 14th, 2009, 4:29 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 2:15 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
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

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: apology
PostPosted: July 15th, 2009, 1:04 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2009, 3:17 pm 
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")


:?:

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


Report this post
Top
  
Reply with quote  
 Post subject: Gui_IE
PostPosted: July 31st, 2009, 12:59 pm 
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?


Report this post
Top
  
Reply with quote  
 Post subject: IE_Copy
PostPosted: September 11th, 2009, 2:58 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2009, 5:12 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Yea dont call it if nothing is selected

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2009, 5:14 pm 
How do I know that nothing is selected ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2009, 5:33 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
and vice versa how would one know if something was selected

here ill point you in the right direction :D since your too lazy to try
:twisted:
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?

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: IE_Copy()
PostPosted: September 11th, 2009, 6:44 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2009, 7:06 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
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")

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: IE_Copy
PostPosted: September 14th, 2009, 12:19 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2009, 12:47 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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()


Report this post
Top
 Profile  
Reply with quote  
 Post subject: IE_Copy
PostPosted: September 14th, 2009, 1:52 pm 
You are right. MY FAULT ! :oops: 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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2009, 2:57 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
They work for me on IE7 and 8
post your code?

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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 309 posts ]  Go to page Previous  1 ... 17, 18, 19, 20, 21  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Cristi®, jrav, Yahoo [Bot] and 15 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