AutoHotkey Community

It is currently May 25th, 2012, 8:22 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: October 24th, 2007, 10:56 pm 
How to load a page into an laready existing IE window?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2007, 11:07 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
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}

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2007, 11:18 pm 
Thanks :)

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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2007, 11:26 pm 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
Isn't there a run command for this? Something like:

Code:
Run, Internet Explorer, URL
:?: :?:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2007, 11:43 pm 
~dieom wrote:
Isn't there a run command for this? Something like:

Code:
Run, Internet Explorer, URL
:?: :?:


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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2007, 11:45 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
with the first method i gave, don't run iexplore.exe url, just run the URL directly.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2007, 11:50 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2007, 11:58 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
try a different sendmode, change SetKeyDelay, or put the address on the clipboard and paste it.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2007, 11:59 pm 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
Sendmode, Input?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 25th, 2007, 3:34 am 
hi

Only clipboard did the trick :)

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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 25th, 2007, 5:19 am 
Offline

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 25th, 2007, 3:39 pm 
Thanks Sean, that works :)

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
}


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Azevedo, krajan, rbrtryn, sks, vsub and 66 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