Jump to content

Recommended Posts

Posted (edited)

I have created a gui that embeds a website. The problem is that i dont want to display all of the website. i only want to show the shoutbox which is just a small part of the page. Is there any way to do this? like a crop or only showing a form?

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

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 620, 480)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 530, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 530, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 530, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 530, 100, 30)

GUISetState()       ;Show GUI

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

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Home
            _IENavigate ($oIE, "http://www.google.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")
    EndSelect
WEnd

GUIDelete()

Exit
Edited by Hadez
Posted

Welcome to Autoit 1-2-3 has many lessons on how to......

here is the link

Here is the lesson that reflects what you want to do....

; This is a demonstration for Object Create, similar to Level I.
; We are using AU3Info to get the Pixel search color.

#include <GuiConstants.au3> 

Dim $My_Color = 0xA8FF93 ; from AU3Info.
Dim $Game, $MID
HotKeySet("{F8}","Get_coord")
HotKeySet("{F9}","Game_Bot")



Opt("MouseCoordMode", 0)        ;see Level I or Search Help for "options".
Opt("PixelCoordMode", 0)       

GUICreate("Object - Game Bot", 614, 370) 
GUISetFont(9, 400, -1, "MS Sans Serif") 
$B_oIE3 = ObjCreate("Shell.Explorer.2") 
$Breaktime = GUICtrlCreateObj($B_oIE3, -45, -140, 540, 510) 
$html2 = "about:<br><br><br><br><br><br><br><br><br><br><Text>..........  Game Bots... Yes, You can Create Game Bots in AutoIt. <br><br>........... Check this easy one out!...   Please Press *Enter Game* </Text>"
$B_oIE3.navigate ($html2) 
GUICtrlCreateLabel ("*Game Bots*", 503, 80,150)
GUICtrlSetFont( -1, 12, 700)
GUICtrlCreateLabel ("PixelSearch", 505, 120,150)
GUICtrlSetFont( -1, 12, 700)
$BrkStart = GUICtrlCreateButton("&Enter Game", 505, 300, 80, 25)
$BrkEnd = GUICtrlCreateButton("&Exit", 505, 330, 80, 25)
GUISetState() 

While 1 
    
    $msg = GUIGetMsg() 
    
    If $msg = $GUI_EVENT_CLOSE Or $msg = $BrkEnd Then 
        Exit
    EndIf
    
    If $msg = $BrkStart Then 
        ;http://av.vet.ksu.edu/flash/curveball/curveball.swf
        $B_oIE3.navigate ("http://www.albinoblacksheep.com/flash/curveball.php")
        Sleep(1500) ; wait to load
        $B_oIE3.navigate ("http://www.albinoblacksheep.com/flash/curveball.php")
        Sleep(1500) ; bypass the advertisement
        MsgBox(262208, "How to Play", "Move the Racket to Hit the Ball   " & @CRLF & "Or, Press [F9] to Use the Game Bot    ")
        ToolTip('Press (F9) to Use the Game Bot',0,0)
    EndIf
    
WEnd 

Func Game_Bot() ; if $Game then $Game = True, If Not $Game then $Game = False, maybe think of $Game as "1".
    $Game = NOT $Game 
    If $Game Then ToolTip('Press (F9) to Exit Game Bot',0,0)
    While $Game ; search left, top, right bottom for my color, color varience of 50 shades, check every 10 pixels.
        $ball = PixelSearch( 49, 75, 430, 330, $My_Color, 50, 10) 
        If Not @error Then MouseClick("left", $ball[0], $ball[1], 1, 0)
    WEnd
    ToolTip("")
EndFunc

Func Get_coord() ; press F8 to get mouse coordinates
    $MID = NOT $MID
    While $MID
        $pos = MouseGetPos()
        ToolTip('Mouse coordinates     ' & @CRLF & " X = " & $pos[0] & @CRLF & " Y = " & $pos[1],0,0)
        Sleep(20)
    WEnd
    ToolTip("")
EndFunc

8)

NEWHeader1.png

Posted

$Breaktime = GUICtrlCreateObj($B_oIE3, -45, -140, 540, 510)

:(

Thanks. that was a great help, although i see that if i press tab on the webpage, it moves off from what i want it to show. That aswell as the gui having scroll bars that i cant get rid of. Will look out for ways to get rid of them. :graduated:

Thanks again.

Posted

So far no luck on disabling _IECreateEmbedded () scroll bar. I was thinking of a way around it may be to make the GUISetBkColor (0x000000) so its black, then add a black picture over the scroll bar so it makes them unusable. If that works, then i could probably also create a transparent label to put over the actual _IECreateEmbedded () so that the IE becomes unclickable. This may round the user not being able to navigate away from the section of the page i want to view. Any pointers on doing this? Can it be done? Thanks for any help.

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
  • Recently Browsing   0 members

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