Jump to content

Info tool and Firefox control


Recommended Posts

Since updating to Mozilla Firefox 4, some of my scripts are broken.

I think its because the browser control has changed, but Windo info tool no longer see's or retrieves it.

It used to be "[CLASS:MozillaWindowClass; INSTANCE:n]"

I've had a try with spy++ but I dont really know how to use it, I think its something to do with gekopluginwindow but cant quite get it right.

Anyone tried and had any luck with it?

EDIT:

Nightmare, If I use "geckopluginwindow" as the class, a function like ControlGetPos() seems to recognize it, but returns incorrect results.

Also tried Yashieds Control Viewer.. no joy.

Had to roll back to 3.6 :unsure:

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • 1 month later...

Bump

I dont know if an update to Yashieds Control Viewer, but I now get a control from it

"[CLASS:GeckoPluginWindow; INSTANCE:1]"

But still unabe to interact with it successfully.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

The browser area is drawn by the rendering engine. They draw the areas for themselves, so you can't treat the elements inside them as Windows controls. This applies to Firefox as much as IE. With IE, there is a COM interface to the DOM, which is used by the IE.au3 UDF. Firefox doesn't expose a COM interface unless you install a plug-in to provide it, which is used by the FF.au3 UDF.

You said your script used to work. Were you using FF.au3? Did you find an updated version of MozRepl (the DOM exposing plug-in) compatible with your current version of Firefox?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The whole browser is a control, and could be used for instance with controlsend or controlclick.

With IE a non active window

$hwnd = WinActivate("Google - Windows Internet Explorer")
If Not IsHWnd($hwnd) Then
    MsgBox(0,0,"Fail")
    Exit
EndIf
Sleep(1000)

WinSetState($hwnd,"",@SW_MINIMIZE)
Sleep(1000)

ControlSend($hwnd,"","[CLASS:Internet Explorer_Server; INSTANCE:1]","Search String")
Sleep(1000)

WinSetState($hwnd,"",@SW_MAXIMIZE)

Will minimize it, send string, maximize.

If the title was Mozilla Firefox and control ID were changed to "[CLASS:MozillaWindowClass; INSTANCE:2]" the same would occur.

But just not any more, with this new gecko control and its broken a fair few of my scripts :)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

This works fine with Firefox 5.0:

$hwnd = WinActivate("[CLASS:MozillaWindowClass; TITLE:Google - Mozilla Firefox]")
If Not IsHWnd($hwnd) Then
    MsgBox(16, "Error", "$hwnd is not a handle", 3)
    Exit
EndIf
Sleep(1000)

WinSetState($hwnd,"",@SW_MINIMIZE)
Sleep(1000)

ControlSend($hwnd, "", "", "Search String")
Sleep(1000)

WinSetState($hwnd,"",@SW_MAXIMIZE)

Note the ControlSend() is to the window. You have to make assumptions about the input focus being in the right place. But you were already in that boat before anyway.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Indeed it does work.

The thing is, I cannot get information about the controls of the window, Specifically the WebBrowser control.

The following msgbox from the given code says 27. It would normally say 1400, the width of the browser control (if it were available to me to pass in as a parameter)

$hwnd = WinActivate("[CLASS:MozillaWindowClass; TITLE:Google - Mozilla Firefox]")
If Not IsHWnd($hwnd) Then
    MsgBox(16, "Error", "$hwnd is not a handle", 3)
    Exit
EndIf
Sleep(1000)

WinSetState($hwnd, "", @SW_MINIMIZE)
Sleep(1000)

$c = ControlGetPos($hwnd, "", "")
If @error Then
    MsgBox(0, "ControlGetPos", @error)
Else
    MsgBox(0, 0, $c[3])
EndIf

WinSetState($hwnd, "", @SW_MAXIMIZE)

Its looking more and more like I will just have to drop firefox for the time being, in favour of IE or Chrome. I dont dislike those browsers, I'm just more comfortable with FF.

Anyway Thanks for your attention PsaltyDS.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

That's just it, looks like a Firefox window is _ALL_ owner drawn client area now:

#include <WinAPI.au3>

Global $hwnd = WinActivate("[CLASS:MozillaWindowClass; TITLE:Google - Mozilla Firefox]")
If Not IsHWnd($hwnd) Then
    MsgBox(16, "Error", "$hwnd is not a handle", 3)
    Exit
EndIf
Sleep(1000)

WinSetState($hwnd,"",@SW_MINIMIZE)
Sleep(1000)

ControlSend($hwnd, "", "", "Search String")
Sleep(1000)

WinSetState($hwnd,"",@SW_MAXIMIZE)

$tRect = _WinAPI_GetClientRect($hwnd)
MsgBox(4096, "Rect", _
            "Left..: " & DllStructGetData($tRect, "Left") & @LF & _
            "Right.: " & DllStructGetData($tRect, "Right") & @LF & _
            "Top...: " & DllStructGetData($tRect, "Top") & @LF & _
            "Bottom: " & DllStructGetData($tRect, "Bottom"))

The message box here shows the client area running from 0,0 to max width of the display and almost max height (minus the task bar). If you want to see inside, it will be through a Firefox plug-in, like MozRepl if available for the current version.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Ah well, worse things have happened at sea.

I've used that approach before, I think its the address bar, or tool bar (what ever its called) at the top. Everything below the tabs are classed as client area, so its difficult to get the point at which the actual browser starts. because different people have all sorts of toolbars to contend with also.

Thanks once again for you time,I appreciate it.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...