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 

IE and Gui Browser Com Tutorial
Goto page Previous  1, 2, 3, 4, 5  Next
 
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
smikkelsen (not logged in
Guest





PostPosted: Thu May 28, 2009 11:40 pm    Post subject: Reply with quote

I can't even get this to work:

Code:

#q::        ; test hotkey
{
windowname="Google"
java=yahoo.com

COM_Init() ; Initialize COM - requires COM.ahk library
pageSearched:="Samikkelsen.com - Windows Internet Explorer"

Loop, %   COM_Invoke(psw := COM_Invoke(psh:=COM_CreateObject("Shell.Application"), "Windows"), "Count")
   {
      LocationName:=COM_Invoke(pwb:=COM_Invoke(psw, "Item", A_Index-1), "LocationName")
      IfInString,LocationName,%windowname%
         Break
      COM_Release(pwb) ;didnt break so release the one we didnt use
   }
COM_Invoke(pwb, "Navigate", java)
COM_Release(pwb)
COM_Term()

Return
}


I open an instance of IE7 and open Google.com, then run the script. Still gives me the not connected error. This is driving me crazy!
Back to top
tank



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

PostPosted: Fri May 29, 2009 2:21 am    Post subject: Reply with quote

so the question is
how in the @#$%^&*() can a page google.com going to have a title of Samikkelsen.com - Windows Internet Explorer

how
think
i already told you the problem was the title you used and yet you insist on continuing

Code:
pageSearched:="Google"
Loop, %   COM_Invoke(psw := COM_Invoke(psh:=COM_CreateObject("Shell.Application"), "Windows"), "Count")
   {
      LocationName:=COM_Invoke(pwb:=COM_Invoke(psw, "Item", A_Index-1), "LocationName")
      IfInString,LocationName,%pageSearched%
         Break
      COM_Release(pwb) ;didnt break so release the one we didnt use
   }
would return a pointer to a goole page open in a browser
Samikkelsen.com - Windows Internet Explorer isnt ever going to give you didly because the
- Windows Internet Explorer
is a suffix added by IE it has nothing to do with the page title
Samikkelsen.com would only work if a page was open to that page and the <title>...</title> if the page was Samikkelsen.com
_________________

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
smikkelsen



Joined: 24 Jun 2008
Posts: 104

PostPosted: Fri May 29, 2009 7:55 am    Post subject: Reply with quote

I don't mean to be rude, but I don't think you read my code all the way through. It was my mistake to leave that extra peice of code in there, but if you look, the variable referenced for the wintitle, it is "windowname" not "pagesearched".


It still doesn't work for me, i'm at a loss here.
Back to top
View user's profile Send private message
tank



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

PostPosted: Fri May 29, 2009 11:45 am    Post subject: Reply with quote

ok right you are my apologies
and your using internet explorer????????
_________________

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
smikkelsen



Joined: 24 Jun 2008
Posts: 104

PostPosted: Fri May 29, 2009 7:00 pm    Post subject: Reply with quote

Yes, IE7.

I actually figured out the problem, and it did in fact have something to do with the variables.

I was using the variable like this:
Code:

windowname="Google"


instead of:
Code:

windowname:="Google"


Small error makes a huge difference!

Thanks for all the help.
Back to top
View user's profile Send private message
Shaun



Joined: 11 Jul 2009
Posts: 67

PostPosted: Tue Jul 14, 2009 4:19 pm    Post subject: Reply with quote

Using the info in this thread i was able understand my browser better and got it to work the way i wanted.

2 questions i wanted to asked, can i input information and get data back without a webpage visible and if i make my script an exe do i need the com file in the same folder if i want to send my finished script to other people?
Back to top
View user's profile Send private message
tank



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

PostPosted: Tue Jul 14, 2009 4:33 pm    Post subject: Reply with quote

There is nothing about the techniques demonstrated within this thread for Internet explorer that require the browser to be visible. But be cautious. Invisible windows and lax security are the hackers play ground
_________________

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
Shaun



Joined: 11 Jul 2009
Posts: 67

PostPosted: Tue Jul 14, 2009 5:16 pm    Post subject: Reply with quote

i used this script and changed it to my specs but i could not undertsnad how to reuse the same browser instead of a new browser.

Code:

gUser:="myName"
gPass:="myPass"
COM_Init()
pwb := COM_CreateObject("InternetExplorer.Application")
COM_Invoke(pwb , "Visible=", "True") ;"False" ;"True" ;
GETdata := "?Email=" gUser "&Passwd=" gPass "&ltmpl=default&ltmplcache=2&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3F&service=mail&rm=false&ltmpl=default&ltmpl=default&rmShown=1&signIn=Sign+in"
url:="https://www.google.com/accounts/ServiceLoginAuth"
COM_Invoke(pwb, "Navigate", url GETdata)
COM_Release(pwb)
COM_Term()
Back to top
View user's profile Send private message
tank



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

PostPosted: Tue Jul 14, 2009 6:33 pm    Post subject: Reply with quote

seriously if your not gonna read the tutorial dont post a question
first fragging post on the first friggin page wrote:
Re-using exisitng instances of IE

_________________

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
Shaun



Joined: 11 Jul 2009
Posts: 67

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

Gees if you are not going to read the question don't bother answering, i said I DID NOT UNDERSTAND, there was nothing in there about not reading the pages.
Back to top
View user's profile Send private message
Krunk
Guest





PostPosted: Wed Jul 29, 2009 3:44 am    Post subject: Reply with quote

Thanks ALOT for the tutorial, I'm not 100% clear on everything tank, sean, and everybody else but you guys rock. Besides who wants to end up pushing buttons all day like that mom on the jet-sons cartoon!
Back to top
vlcek



Joined: 19 Feb 2007
Posts: 338
Location: Czech Republic

PostPosted: Wed Jul 29, 2009 6:23 pm    Post subject: Reply with quote

Good evening.
Can you help me?
I have problems.
I want create web browser with your tutorial, but I have problem with my script.
Can you create for me gui window with loaded page google.com and keyboard navigation?
I'm blind and I browse pages with key up, down, left, right and with tab key.

I created this, but navigation with tab key not work.


Code:

#include com.ahk

COM_AtlAxWinInit()
Gui, +LastFound +Resize
;pwb := COM_AtlAxGetControl(COM_AtlAxCreateContainer(WinExist(),top,left,width,height, "Shell.Explorer") )  ;left these here just for reference of the parameters
pwb := COM_AtlAxGetControl(COM_AtlAxCreateContainer(WinExist(),0,0,510,600, "Shell.Explorer") )
;http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.ole.interop.ioleinplaceactiveobject(VS.80).aspx
IOleInPlaceActiveObject_Interface:="{00000117-0000-0000-C000-000000000046}"
pipa := COM_QueryInterface(pwb, "IOleInPlaceActiveObject_Interface")
OnMessage(WM_KEYDOWN:=0x0100, "WM_KEYDOWN")
OnMessage(WM_KEYUP:=0x0101, "WM_KEYDOWN")
gui,show, w510 h600 ,Gui Browser
;take from the IE example
url:="http://www.google.com"
COM_Invoke(pwb, "Navigate", url)
loop
      If (rdy:=COM_Invoke(pwb,"readyState") = 4)
         break
return

GuiClose:
Gui, Destroy
COM_CoUninitialize()
COM_AtlAxWinTerm()
ExitApp

GuiSize:
WinMove, % "ahk_id " . COM_AtlAxGetContainer(pwb), , 0,0, A_GuiWidth, A_GuiHeight
return
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%
      ;tooltip % class
      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
          }
  }
}


_________________
Thanks.
Back to top
View user's profile Send private message Visit poster's website
tank



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

PostPosted: Wed Aug 05, 2009 7:58 pm    Post subject: Reply with quote

I have had no luck with the tab key either ??? Sean, Lexikos either of you have any ideas?
_________________

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
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Thu Aug 06, 2009 12:30 am    Post subject: Reply with quote

Code:
pipa := COM_QueryInterface(pwb, IOleInPlaceActiveObject_Interface)
Notice no quotes here.
Back to top
View user's profile Send private message
tank



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

PostPosted: Thu Aug 06, 2009 3:23 am    Post subject: Reply with quote

roflma wow cant beleive i missed that
_________________

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:   
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 4 of 5

 
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