Jump to content

How to flip the page down {PGDN} when the page is in a GUI?


tommytx
 Share

Recommended Posts

Normally in IE I simply use winactivate("My title Page") when I want to issue a command such as Send("{PGDN}" and the page will flip down... but how is that done when the same page is inside a GUI?

For example the GUI Title is "My Gui Page" and the page loaded into the window of the GUI is titled "My Title Page". What is the command to make the page flip either directly or via activation...

I am using Zero Winactivate on the program right now so i would love to have a command to flip the page without activation, but I can do Winactivate if necessary..

The reason I like not using winactivate, is that the entire program can run now on the bottom line without it ever popping up. I am assuming when i do winactivate it will pop up at that time.

I have tried Winactivate("My Title Page") and WinActivate("My GUI Page") and neither work for me.

Thanks

Link to comment
Share on other sites

I modified the example in the AutoIt help file to show you a way it can be done. It works by pressing the PageDown button manually or by clicking a button. Or you could send it silently.

If you are afraid of losing focus to the IE window later on, you could set a hotkey for PageDown and run a function that activates the window.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister()

Local $oIE = _IECreateEmbedded()
GUICtrlSetState($oIE, $GUI_FOCUS)
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
Local $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
Local $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
Local $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Local $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)
Local $GUI_Button_PGDown = GUICtrlCreateButton("PG Down", 450, 420, 100, 30)

GUISetState()

_IENavigate($oIE, "http://www.autoitscript.com")

ControlFocus("Embedded Web control Test", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]") ; This line sets focus to the IE window

; Waiting for user to close the window
While 1
    Local $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Home
            _IENavigate($oIE, "http://www.autoitscript.com")
        Case $msg = $GUI_Button_Back
            _IEAction($oIE, "back")
        Case $msg = $GUI_Button_Forward
            _IEAction($oIE, "forward")
        Case $msg = $GUI_Button_Stop
            _IEAction($oIE, "stop")
        Case $msg = $GUI_Button_PGDown ; This is your Page Down
            ControlFocus("Embedded Web control Test", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]") ; You have to add it here because when you click the button, you lose focus of the IE Window
            Send("{PGDN}")
    EndSelect
WEnd

GUIDelete()

Exit

#include <ByteMe.au3>

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...