Jump to content

Help With Small Web Browser Function!


Recommended Posts

I downloaded this script that I will improve from here:

http://www.autoitscript.com/forum/index.php?showtopic=10874

But there's one problem, I can't type the URL in the text field and then enter I have to click on go, but I want to enabled enter to that too.

There's also an problem in forums when I try to click enter for a breakline in the text field but that doesn't work either.

I also want to enable to copy text from the site that the browser is on but that doesn't work.

So copy the text with eg: CTRL & C and Enter to textfields.

But I have no clue on how to do this. So I need help :/

Here's the code:

#include <GuiConstants.au3>

;Creates the parent gui

$gui = GUICreate("Troyzilla 1.0", @DesktopWidth, @DesktopHeight, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_OVERLAPPEDWINDOW + $WS_MAXIMIZE)

$back = GUICtrlCreateButton("Back", 10, 20, 40, 30, $BS_BITMAP)

$forward = GUICtrlCreateButton("Forward", 55, 20, 40, 30, $BS_BITMAP)

$refresh = GUICtrlCreateButton("Refresh", 100, 20, 40, 30, $BS_BITMAP)

$GO = GUICtrlCreateButton("GO", 810, 20, 50, 30, $BS_BITMAP)

$Combo_5 = GUICtrlCreateCombo("http://www.google.com", 150, 25, 640, 21)

$Progress_6 = GUICtrlCreateProgress(840, 670, 70, 15)

$Date_8 = GUICtrlCreateDate("Date7", 20, 670, 200, 20)

$pic = GUICtrlCreatePic("images\troyzilla.jpg", 890, 5, 85, 53)

GUICtrlSetImage ( $back, "images\back.bmp")

GUICtrlSetImage ( $Forward, "images\forward.bmp")

GUICtrlSetImage ( $refresh, "images\refresh.bmp")

GUICtrlSetImage ( $GO, "images\go.bmp")

GUISetState()

;creates the child gui that the dll will be held in.

$internetgui = GUICreate("", 1000, 600, 10, 60, $WS_CHILD + $WS_BORDER, "", $gui)

GUISetState()

;opens dll then calls it.

$dll = DllOpen("cwebpage.dll")

DllCall($dll, "long", "EmbedBrowserObject", "hwnd", $internetgui)

DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $internetgui, "str", "http://www.google.com")

;DLLCall($dll,"none","ResizeBrowser","hwnd", $gui ,"int", 800, "int", 500 )

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE ; states that if the close button is it hte script will exit

ExitLoop

Case $msg = $GO ;gets the message of the button

DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $internetgui, "str", GUICtrlRead($Combo_5)) ; tells the dll to go to the web page thats in the combobox

Case $msg = $back

DLLCall($dll,"none","DoPageAction","hwnd",$internetgui,"int", 0)

Case $msg = $forward

DLLCall($dll,"none","DoPageAction","hwnd",$internetgui,"int", 1)

Case $msg = $refresh

DLLCall($dll,"none","DoPageAction","hwnd",$internetgui,"int", 4)

EndSelect

WEnd

Exit

Link to comment
Share on other sites

in beta check out _ispressed and or hotkeyset also winactive cuz u probaly wont want the hotkey and stuff working if the troyzilla window isnt on top

Can you give me an example code? Because I'm pretty much new to Auto It not coded anything befor beside download and watch the code :/

Btw: I've tried those examples in that thread but they doesn't work thought.

Edited by Frettub
Link to comment
Share on other sites

sumtin like hahahah hold on that sucked

#include <GuiConstants.au3>

;Creates the parent gui
$gui = GUICreate("Troyzilla 1.0", @DesktopWidth, @DesktopHeight, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_OVERLAPPEDWINDOW + $WS_MAXIMIZE)
$back = GUICtrlCreateButton("Back", 10, 20, 40, 30, $BS_BITMAP)
$forward = GUICtrlCreateButton("Forward", 55, 20, 40, 30, $BS_BITMAP)
$refresh = GUICtrlCreateButton("Refresh", 100, 20, 40, 30, $BS_BITMAP)
$GO = GUICtrlCreateButton("GO", 810, 20, 50, 30, $BS_BITMAP)
$Combo_5 = GUICtrlCreateCombo("http://www.google.com", 150, 25, 640, 21)
$Progress_6 = GUICtrlCreateProgress(840, 670, 70, 15)
$Date_8 = GUICtrlCreateDate("Date7", 20, 670, 200, 20)
$pic = GUICtrlCreatePic("images\troyzilla.jpg", 890, 5, 85, 53)
GUICtrlSetImage ( $back, "images\back.bmp")
GUICtrlSetImage ( $Forward, "images\forward.bmp")
GUICtrlSetImage ( $refresh, "images\refresh.bmp")
GUICtrlSetImage ( $GO, "images\go.bmp")
GUISetState()

;creates the child gui that the dll will be held in.
$internetgui = GUICreate("", 1000, 600, 10, 60, $WS_CHILD + $WS_BORDER, "", $gui)
GUISetState()

;opens dll then calls it.
$dll = DllOpen("cwebpage.dll")
DllCall($dll, "long", "EmbedBrowserObject", "hwnd", $internetgui)
DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $internetgui, "str", "http://www.google.com")
;DLLCall($dll,"none","ResizeBrowser","hwnd", $gui ,"int", 800, "int", 500 )

if Winactive("Troyzilla 1.0") Then
    HotKeySet("{enter}","go")
EndIf
func go()
    DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $internetgui, "str", GUICtrlRead($Combo_5))
    EndFunc
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE; states that if the close button is it hte script will exit
ExitLoop
Case $msg = $GO;gets the message of the button
DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $internetgui, "str", GUICtrlRead($Combo_5)); tells the dll to go to the web page thats in the combobox
Case $msg = $back
DLLCall($dll,"none","DoPageAction","hwnd",$internetgui,"int", 0)
Case $msg = $forward
DLLCall($dll,"none","DoPageAction","hwnd",$internetgui,"int", 1)
Case $msg = $refresh
DLLCall($dll,"none","DoPageAction","hwnd",$internetgui,"int", 4)
EndSelect

WEnd
Exit
Edited by thatsgreat2345
Link to comment
Share on other sites

Thanks alot, doesn't work though when you want to copy the code only mark it, but that's not needed the most needed thing to work is when you type a message in a text box is that it should make a space to your text but that doesn't work it somehow :/ only type URL then enter works but thanks though! :think:

Link to comment
Share on other sites

Bump

Still need help fixing this, doesn't work at all :/

Can't you make so that if you hold down "SHIFT & ENTER" it will make a break line in text boxes?

Because I know it wont work with the same button on two diffrent things :think: Also does it work to make it copy text with "CTRL & C" and paste with "CTRL & V?

Edited by Frettub
Link to comment
Share on other sites

  • Moderators

Bump, still need help.

Are you just wanting to be able to press enter for the input control and go?
#include <guiconstants.au3>
$main = GUICreate('')
$in = GUICtrlCreateInput('', 10, 10, 200, 20)
$go = GUICtrlCreateButton('go', 10, 40, 50, 30, BitOR($BS_BITMAP, $BS_DEFPUSHBUTTON))
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = - 3 Then Exit
    If $msg = $go Then 
        _GO(GUICtrlRead($in))
    EndIf
WEnd
    
Func _GO($s_INPUT)
    MsgBox(0, 'SUCCESS', 'YOU PUSHED GO OR CLICKED ENTER IN THE INPUT BOX' & @CR & 'THE INPUT READS: ' & $s_INPUT)
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

SmOke_N: Thank you alot, if bother could you put it in the code that

thatsgreat2345 posted, because I don't know where to put it :think:

BitOR($BS_BITMAP, $BS_DEFPUSHBUTTON)

That's the only thing you have to put somewhere... nothing quite like trying to work it out and figure it out for yourself where to put (hint: the button that would normally have to be clicked to go to the function you want to use). By figuring it out for yourself, you'll have a better understanding. It's really not that difficult (if you actually tried).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ok I replaced

"$GO = GUICtrlCreateButton("GO", 810, 20, 50, 30, $BS_BITMAP)"

With

"$go = GUICtrlCreateButton('go', 10, 40, 50, 30, BitOR($BS_BITMAP, $BS_DEFPUSHBUTTON))"

But now the page didn't load on the page rame :/

Link to comment
Share on other sites

  • Moderators

Ok I replaced

"$GO = GUICtrlCreateButton("GO", 810, 20, 50, 30, $BS_BITMAP)"

With

"$go = GUICtrlCreateButton('go', 10, 40, 50, 30, BitOR($BS_BITMAP, $BS_DEFPUSHBUTTON))"

But now the page didn't load on the page rame :/

Do you actually have the cwebpage.dll on your computer?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ok now it works, but it's still the same in text boxes when I try to <br> in a text message like this one it goes to the page stated in the input instead of doing an break line, so if I type an URL in the Adress bar it goes there but when i try to press enter in a post message it goes to the URL in the Adress bar :/

Link to comment
Share on other sites

  • Moderators

7 Bumps in one thread no matter how desperate you are is rediculous... nevermind the fact that it's disrespectful. If people understand what you want, and know how to do it, they will post to it, if they don't, well then I suggest doing some more homework.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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