 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Adzie Guest
|
Posted: Sat Aug 16, 2008 1:52 pm Post subject: Browser within app? |
|
|
Hey
Just want to run an idea past you before I try it, to see if it's possible.
I created a little program, which loads a URL, redirects it twice, and then closes the browser. (It's an automated search tool)
But the main issue is that it opens and closes browser windows at random intervals, and if the person is doing something, it gets annoying. My personal workaround for it is to use a virtual pc, but not everyone who has the program has enough computing knowledge or confidence to set one up.
So is it possible to have a frame within the app, or another gui, that works like a browser? It doesn't have to be user controllable either, just a little screen that shows the internet page that the program loads up, redirects and closes, within the app itself, so that it runs discretely.
If it is possible, what code should I be looking at?
Thanks,
-Adzie |
|
| Back to top |
|
 |
n-l-i-d Guest
|
|
| Back to top |
|
 |
Adzie Guest
|
Posted: Tue Aug 19, 2008 1:35 am Post subject: |
|
|
| Thank you. |
|
| Back to top |
|
 |
Adzie Guest
|
Posted: Tue Aug 19, 2008 11:36 pm Post subject: |
|
|
Right, I've read through that whole thread, and spend the day trying to get it to work, but all I've got is a massive headache, so I'm going to need some help.
From the Wiki:
| Code: | #Include IEControl.ahk
#SingleInstance force
GoSub, GuiStart
Gui, +LastFound +Resize
Gui, Show, w800 h600 Center, WebBrowser
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.autohotkey.com/")
Sleep 5000
IE_LoadURL(pwb, "http://www.autohotkey.com/forum/")
Sleep 5000
IE_GoBack(pwb)
Sleep 3000
IE_GoForward(pwb)
Return
GuiStart:
AtlAxWinInit()
CoInitialize()
Return
GuiClose:
Gui, %A_Gui%:Destroy
Release(pwb)
CoUninitialize()
AtlAxWinTerm()
ExitApp
|
If I put that into a separate AHK file and run it, it works, but when I try to integrate it with the rest of my script, nothing happens, or it mutilates the whole GUI.
Also from Wiki:
| Code: | Gui, +lastfound
h := WinExist()
IE_Add( h, 0, 0, 500, 500)
; Must be equal to or larger than the IE_Add size
; or some of the displayed web page will be cut off.
Gui, Show, h500 w500
IE_LoadURL("www.yahoo.com")
return
|
I've also tried implementing that to no success. I downloaded the IEControl.ahk and CoHelper.ahk from the wiki page.
What I am trying to do is have a webpage within a GroupBox in an existing GUI, which can then be redirected. Below is a snippet from my existing code:
| Code: | w = 530
h = 600
bx := (530 - 180) / 2
bx2 := (bx + 100)
Gui, Add, Button, w75 x%bx% section y200 gVolExit,Exit
Gui, Add, Button, w75 x%bx2% ys gCredits, About
gui, add, groupbox, x10 w%w1% h365 +center, Browser
h2 := WinExist()
IE_Add( h2, 10, 300, 500, 200)
gui,show, W%w% H%h% ,%title%
IE_LoadURL(pwb, "http://www.autohotkey.com/")
Sleep 5000
IE_LoadURL(pwb, "http://www.autohotkey.com/forum/")
Sleep 5000
IE_GoBack(pwb)
Sleep 3000
IE_GoForward(pwb)
Return |
And this is a screenshot of what happens:
As I said, I've looked through the other threads and COM/DOM stuff is way over my head. I'm certain it can be done simpler than that, I just don't know how.
Any help would be appreciated. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 1033
|
Posted: Wed Aug 20, 2008 12:06 pm Post subject: |
|
|
no not simpler but it only looks complicated till you do it a bit
ill fix your code this evening _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
Adzie Guest
|
Posted: Wed Aug 20, 2008 3:27 pm Post subject: |
|
|
| tank wrote: | no not simpler but it only looks complicated till you do it a bit
ill fix your code this evening |
Thank you! |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 1033
|
Posted: Thu Aug 21, 2008 1:19 am Post subject: |
|
|
bout all the effort im gonna put into partial code
| Code: | w = 530
h = 600
bx := (530 - 180) / 2
bx2 := (bx + 100)
;~ Gui, Add, Button, w75 x%bx% section y200 gVolExit,Exit
;~ Gui, Add, Button, w75 x%bx2% ys gCredits, About
Gui, +LastFound +Resize
COM_AtlAxWinInit()
pwb:= IE_Add( WinExist(), 10,245,500,345)
gui, add, groupbox, x10 y235 w500 h365 +center, Browser
gui,show, w510 h600 ,%title%
IE_LoadURL(pwb, "http://www.autohotkey.com/")
Sleep 5000
IE_LoadURL(pwb, "http://www.autohotkey.com/forum/")
Sleep 5000
IE_GoBack(pwb)
Sleep 3000
IE_GoForward(pwb)
Return
GuiClose:
ExitApp |
i use com.ahk not cohelper.ahk im not sure that sean even still update cohelper _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
Adzie Guest
|
Posted: Thu Aug 21, 2008 2:38 pm Post subject: |
|
|
| Thank you so much! It works perfectly. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 1033
|
Posted: Fri Aug 22, 2008 5:45 pm Post subject: |
|
|
| Code: | Gui, +LastFound +Resize
COM_AtlAxWinInit()
pwb:= IE_Add( WinExist(), 0,245,510,355)
gui, add, groupbox, x0 y235 w510 h375 +center, Browser
gui,show, w510 h600 ,%title%
COM_Invoke(pwb, "Navigate","http://www.google.com")
load_complete(pwb)
COM_Invoke(pwb,"Navigate","http://www.autohotkey.com/")
load_complete(pwb)
COM_Invoke(pwb,"Navigate","http://www.autohotkey.com/forum/")
load_complete(pwb)
COM_Invoke(pwb, "GoBack")
load_complete(pwb)
COM_Invoke(pwb, "GoForward")
Return
GuiClose:
ExitApp
load_complete(pwb)
{
Loop
if rdy:=COM_Invoke(pwb,"readyState") = 4
Break
} |
another way to do exactly as above with only the com library _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
SDC Toxin Guest
|
Posted: Fri Aug 22, 2008 9:48 pm Post subject: |
|
|
| Could I get a copy of your entire script? I would not release it, I am just trying to create a program that does a similar thing, but I am not that good with AHK, so I think it would help to have a finished project, so that I can see how everything works and then go ahead and create my own. If not that's cool too the info in this thread helped a lot |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 1033
|
|
| Back to top |
|
 |
SDC Toxin Guest
|
Posted: Fri Aug 22, 2008 10:19 pm Post subject: |
|
|
| Thanks a ton |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|