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 

How to load a page into existing IE window?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Wed Oct 24, 2007 9:56 pm    Post subject: How to load a page into existing IE window? Reply with quote

How to load a page into an laready existing IE window?
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Wed Oct 24, 2007 10:07 pm    Post subject: Reply with quote

that is an IE preference - Tools - Internet options - Advanced - Reuse Windows for launching shortcuts.

Alternately, Activate the window, Send !d, send the new address, send {enter}
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Oct 24, 2007 10:18 pm    Post subject: Reply with quote

Thanks Smile

The first method don't work for me, but the second one I am sure will work. I thought I would have to use that COM IEControl.ahk stuff for it. But I didn't understand how it worked, if I want to control an IE instance.
Back to top
trik



Joined: 15 Jul 2007
Posts: 1320

PostPosted: Wed Oct 24, 2007 10:26 pm    Post subject: Reply with quote

Isn't there a run command for this? Something like:

Code:
Run, Internet Explorer, URL
Question Question
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Oct 24, 2007 10:43 pm    Post subject: Reply with quote

~dieom wrote:
Isn't there a run command for this? Something like:

Code:
Run, Internet Explorer, URL
Question Question


I didn't try it yet, but from the command line iexplore.exe url opens a new window always, and I am trying to write to the good old window.
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Wed Oct 24, 2007 10:45 pm    Post subject: Reply with quote

with the first method i gave, don't run iexplore.exe url, just run the URL directly.
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Oct 24, 2007 10:50 pm    Post subject: Reply with quote

Only problem with
Code:

end !d
Send file:///t:/tmp/preview.htm
Send {Enter}


is that it is writting the address very slow, it looks animated.
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Wed Oct 24, 2007 10:58 pm    Post subject: Reply with quote

try a different sendmode, change SetKeyDelay, or put the address on the clipboard and paste it.
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
trik



Joined: 15 Jul 2007
Posts: 1320

PostPosted: Wed Oct 24, 2007 10:59 pm    Post subject: Reply with quote

Sendmode, Input?
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Oct 25, 2007 2:34 am    Post subject: Reply with quote

hi

Only clipboard did the trick Smile

I guess I will have to save it and restore it too, forgot to do it...
Back to top
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Thu Oct 25, 2007 4:19 am    Post subject: Reply with quote

Try this, need the standard library COM.ahk.
Code:
sURL :=   "http://www.autohotkey.com/forum/"
COM_CoInitialize()
If Not   pweb := GetWebBrowser()
   ExitApp
COM_Invoke(pweb, "Navigate", sURL)
;COM_Invoke(pweb, "Navigate", sURL, 0x1)   ; navOpenInNewWindow
/*   IE7 Only!
COM_Invoke(pweb, "Navigate", sURL, 0x800)   ; navOpenInNewTab
COM_Invoke(pweb, "Navigate", sURL, 0x1000)   ; navOpenInBackgroundTab
*/
COM_Release(pweb)
COM_CoUninitialize()
Return

GetWebBrowser()
{
   ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, ahk_class IEFrame
   If Not   hIESvr
      Return
   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)
   IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}"
   pweb := COM_QueryService(pdoc,IID_IWebBrowserApp,IID_IWebBrowserApp)
   COM_Release(pdoc)
   Return   pweb
}
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Oct 25, 2007 2:39 pm    Post subject: Reply with quote

Thanks Sean, that works Smile

I wrapped it like so

Code:

LoadURL( sURL, WinTitle )
{
COM_CoInitialize()
If Not   pweb := GetWebBrowser(WinTitle)
   ExitApp
COM_Invoke(pweb, "Navigate", sURL)
;COM_Invoke(pweb, "Navigate", sURL, 0x1)   ; navOpenInNewWindow
/*   IE7 Only!
COM_Invoke(pweb, "Navigate", sURL, 0x800)   ; navOpenInNewTab
COM_Invoke(pweb, "Navigate", sURL, 0x1000)   ; navOpenInBackgroundTab
*/
COM_Release(pweb)
COM_CoUninitialize()
Return
}

GetWebBrowser( WinTitle )
{
   ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, %WinTitle%
   If Not   hIESvr
      Return
   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)
   IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}"
   pweb := COM_QueryService(pdoc,IID_IWebBrowserApp,IID_IWebBrowserApp)
   COM_Release(pdoc)
   Return   pweb
}
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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