Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 08, 2016, 04:08:03 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: A little help with an AHK web-browser?  (Read 6082 times)

wreckedcarzz

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,623
    • View Profile
    • Donate to Member
A little help with an AHK web-browser?
« on: November 21, 2007, 06:42:54 PM »
Hi all...

Been working on this thing for a bit (few days) and I am starting to grasp how it all works. I have a fully (see note @ bottom) working web browser, with working (see note again) controls. An options area is planned, and it is made to be a bare-bones, get-on-the-internet-and-find-what-I-want-in-5-seconds-flat type of browser. Just totally...basic. (Some icons wouldn't hurt, but thats not what I need help with.)

So, its all going well. Except for a couple things...

1) I am using mostly my own code, with a little from examples from the AHK site. Problem is (shhhhh...) I don't know what half the stuff is that I end up editing. I understand it, then...I don't. Then, I have a problem (duh). (I now understand all but this one piece here, and I think I can fix it)
Example:
ieM := Gui_IEAdd (HWnd, 300, 38, 338, 378) ;I have no idea how I got this. I pulled it from somewhere...

2) This is the main issue. I can't get the thing to load any pages via my URL bar! >:( Its driving me mad! I have my variables setup, they submit and then are read and the browser is told to go to that...but...it...doesn't :'(
Example:
Gui,2: Add, ComboBox, x10 y75 w300 vAddressBar
... ;Insert loads of code here...
Go:
Gui, Submit, NoHide
IE_LoadURL(pwb, "AddressBar")
Gui,2: Hide
Return

3) The enter key doesn't work. This made no sense to me at all. The freaking key doesn't work. And its the ONLY key that doesn't work. I tried making a hotkey for when Enter is pressed, to relay Enter to the window...and that didn't go so well.
Example:
Enter::
IfWinActive, CompuTech SmartBrowse
Send {Enter}
Return

4) I can't move the web page anywhere!!! GAH!!! I have tried 2 3 methods, and it still won't work. :huh:
Example:
ieM := Gui_IEAdd (HWnd, 300, 38, 338, 378)
... ;Insert a lot of code here
hWnd := WinExist()

CLSID_WebBrowser := "{8856F961-340A-11D0-A96B-00C04FD705A2}"
IID_IWebBrowser2 := "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}"
pwb := CreateObject(CLSID_WebBrowser, IID_IWebBrowser2)
AtlAxAttachControl(pwb, hWnd)

5) I can't move the web page, so therefore, I can't put the controls in the same window. You have to hit Control + Shift + Z to get to your Back/Forward/Stop etc buttons.
Example:
See above

A lot of problems, minor (mostly) but problems. You can effectively use the browser, but unless you can find everything by Google, don't mind clicking Login and Search, can handle Ctrl + Shift + Z for EVERY command, and no options whatsoever (to be implemented), it's not really that user-friendly.

 :tellme: Can anyone help? I have a sinking ship, and right now it's not looking so good. :tellme:

All code below:
Spoiler
#Include IEControl.ahk
#SingleInstance force

GoSub, GuiStart
Gui, +LastFound +Resize
Gui,2: Add, Button, x10 y10 gBack, <-- Back
Gui,2: Add, Button, x63 y10 gForward, Forward ->>
Gui,2: Add, Button, x132 y10 gStop, Stop [X]
Gui,2: Add, Button, x183 y10 gRefresh, Refresh
Gui,2: Add, Button, x233 y10 gHome, Home
Gui,2: Add, Button, x274 y10 gOptions, Options
Gui,2: Add, ComboBox, x10 y75 w300 vAddressBar
Gui,2: Add, Button, x315 y75 gGo, Go ->>
ieM := Gui_IEAdd (HWnd, 300, 38, 338, 378)
Gui, Show, w800 h700 Center, CompuTech SmartBrowse
MsgBox, 0, CompuTech SmartBrowse, Welcome to CompuTech SmartBrowse- the no hassle

web browser. Running with Internet Explorer and coded in AutoHotkey this browser is bare-

bones. It allows quick and basic web browsing without annoying toolbars or add-ons in your

way.`n`nTo show controls (Back/Forward/Stop etc) you just need to push Control+Shift+Z.`nYou

may start using SmartBrowse now.
hWnd := WinExist()

CLSID_WebBrowser := "{8856F961-340A-11D0-A96B-00C04FD705A2}"
IID_IWebBrowser2 := "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}"
pwb := CreateObject(CLSID_WebBrowser, IID_IWebBrowser2)
AtlAxAttachControl(pwb, hWnd)

IE_LoadURL(pwb, "http://www.google.com/")
Return

GuiStart:
AtlAxWinInit()
CoInitialize()
Return

Back:
IE_GoBack(pwb)
Gui,2: Hide
Return

Forward:
IE_GoForward(pwb)
Return

Stop:
Gui,2: Hide
Return

Refresh:
Gui,2: Hide
Return

Home:
IE_GoHome(pwb)
Gui,2: Hide
Return

Go:
Gui, Submit, NoHide
IE_LoadURL(pwb, "AddressBar")
Gui,2: Hide
Return

Options:
Gui,2: Hide
Return

^+Z::
Gui,2: Show, Center, CompuTech SmartBrowse Control Panel
Return

Enter::
IfWinActive, CompuTech SmartBrowse
Send {Enter}
Return

GuiClose:
Gui, %A_Gui%:Destroy
Release(pwb)
CoUninitialize()
AtlAxWinTerm()
ExitApp


wolf.b

  • Member
  • Joined in 2007
  • **
  • Posts: 70
    • View Profile
    • Donate to Member
Re: A little help with an AHK web-browser?
« Reply #1 on: November 22, 2007, 01:39:48 AM »
Hi wreckedcarzz,

the author (Sean) said something about IEControl.ahk here:

I uploaded the standard library IE.ahk, which can be downloaded from the first post in this thread.
I'll discontinue the support of the old IEControl.ahk, so updated COM.ahk accordingly to be used with IE.ahk.

The mentioned download link is in the first post.



Problem #2: URL bar does not work. I have had success with it, after I removed the quotation marks from this line:

IE_LoadURL(pwb, "AddressBar")

like so:

Go:
Gui, Submit, NoHide
IE_LoadURL(pwb, AddressBar)
Gui,2: Hide
Return



Problem #3: I also have the same problem with the Enter key in your example. :(
Confusingly there is this post which states that the problem with the Enter key has been solved by using the mozilla activex control, but I don't understand a word of it. Maybe you can make sense out of it. I think it relates to a AutoHotkey script that, like yours, uses the "library".



Problem #4,5: I don't understand where you want to move the webpage to? sorry


I hope that helps a little


Greetings
Wolf
Schön wär's, wenn's schön wär!

wreckedcarzz

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,623
    • View Profile
    • Donate to Member
Re: A little help with an AHK web-browser?
« Reply #2 on: November 22, 2007, 12:35:26 PM »
Wolf.b

Thanks, the Go button was really bugging me. Couldn't go anywhere ;D Didn't try it without quotes.

The Enter key thing sounds like a pain, might have to use Right Shift as Enter then that sends Enter. :-\ Odd.

---

I just want to use IE_Add to move the webpage down ~100 pixels, to fit in the control bar (Back buttons and whatnot). Thats my problem there.

Thanks for the help! :)

-Brandon