 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
BeetleTX330
Joined: 09 Jun 2005 Posts: 29
|
Posted: Tue Oct 14, 2008 9:15 am Post subject: |
|
|
| SKAN wrote: | How to Auto Refresh IE Window from a script ?
http://www.autohotkey.com/forum/viewtopic.php?p=53704#53704
I have this need to keep a stock quote window refreshed (atleast 6 times a minute) and I found a solution with
PostMessage (using SPY++)
Msg = 0x111 and wParam = 41504
You may test it on Internet Explorer with following code:
| Code: | #F2::
AhkID:=WinExist("A")
WinGetClass,AHKClass, ahk_id %AhkID%
If AHKClass = IEFrame
PostMessage, 0x111, 41504, 0 , , ahk_id %AhkID%
Return |
|
Hi all. This has been driving me crazy. I've recently upgraded to Internet Explorer 7 (in order to support my users who also upgraded). Now I find that the PostMessage function doesn't work anymore! I've driven myself even further crazy by trying to determine the IE7 "Control ID" (the wParam) value for refreshing it's window. It looks to me like IE7 is doing/using something completely different from IE6.
I've been using Winspector Spy (which is how I found the Control ID wparam in IE6 before I found this tip) but instead of finding the WM_COMMAND messages, all I see are WM_USER. I've followed (over and over again) Rajat's SendMessage/PostMessage tutorial to the letter and yet I still can't find a WM_COMMAND message.
What's weird is that I can't find a WM_USER in the list of filters at all. I have tested the detection process with MSPAINT.EXE and NOTEPAD.EXE -- they work perfectly and I'm able to filter and see the WM_COMMANDs. However, IE7 and other apps show WM_USER where I would expect to see WM_COMMAND (and the WM_USER does NOT have the Control ID, etc... info) that I can tell.
I use this code to refresh a lot of IE pages (local weather radar, webmail that normally times me out after 10 minutes, etc...) and now I'm forced to do a simple WinActivate & SendInput {F5} combination -- definitely cave-dweller-type coding. I've tried to understand the COM stuff but it explodes my head.
Does anyone know if (and how) I can work a PostMessage REFRESH command against IE7 like I did with IE6? ...or maybe y'all can help me figure out how to use Winspector Spy correctly to determine this info? _________________ -- Thanks, BeetleTX330 |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2416 Location: Louisville KY USA
|
Posted: Sat Oct 18, 2008 2:45 am Post subject: |
|
|
Non cave dweller exploding head stuff | Code: | COM_Initialize()
pwb:=newIe()
nav(pwb,"http:\\Subsstitute your url here")
complete(pwb)
loop
{
COM_Invoke(pwb , "Refresh2") ; refresh page and do not use cache
complete(pwb) wait for page load to complete
}
newIe()
{
pwb := COM_CreateObject("InternetExplorer.Application")
COM_Invoke(pwb , "Visible=", "True") ;"False" ;"True" ;uncomment to show
Return pwb ? pwb : "Error"
}
nav(pwb,url) ; returns bool
{
If not pwb is Integer ; test to see if we have a valid interface pointer
ExitApp ; ExitApp if we dont
;~ http://msdn.microsoft.com/en-us/library/aa752133(VS.85).aspx
navTrustedForActiveX = 0x0400
COM_Invoke(pwb, "Navigate", url, 0x0400, "_self")
Return ; return the result(bool) of the complete function
}
complete(pwb) ; returns bool for success or failure
{
If not pwb is Integer ; test to see if we have a valid interface pointer
ExitApp ; ExitApp if we dont
loop 80 ; sets limit if itenerations to 40 seconds 80*500=40000=40 secs
{
If (rdy:=COM_Invoke(pwb,"readyState") = 4)
Return 1 ; return success
Sleep,500 ; sleep half second between cycles
}
Return 0 ; lets face it if it got this far it failed
} | alternatively you can substitute | Code: | pwb:=newIe()
nav(pwb,"http:\\Subsstitute your url here")
complete(pwb) | with | Code: | | pwb:=getwin("title of page already open") |
_________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
BeetleTX330
Joined: 09 Jun 2005 Posts: 29
|
Posted: Thu Oct 23, 2008 10:03 pm Post subject: |
|
|
Aaah Tank, you're a real sweetheart for posting the COM stuff -- I swear that I'll try to figger it out and incorporate it.
However, I'd still very much like to know why I couldn't use Winspector Spy on IE7 like I did on IE6. Anyone wanna chime in on this aspect of my original issue?
I'm pretty irritated at MS for changing stuff just for the 'eff' of it (like: IE6's title bar used to say, "Microsoft Internet Explorer" and now in IE7 it says, "Windows Internet Explorer") -- this torques me off 'cuz some of my older, compiled code that I've already passed out to folks had the old title which now causes the windows to not be recognized. Oh well.
So, any ideas on how to figure out a PostMessage WM_Command on IE7 and the other apps that I can't find a WM_Command on? Thanks to all who are so helpful -- it's appreciated by more than just myself.  _________________ -- Thanks, BeetleTX330 |
|
| Back to top |
|
 |
BeetleTX330
Joined: 09 Jun 2005 Posts: 29
|
Posted: Thu Oct 30, 2008 8:08 pm Post subject: |
|
|
Tank, do I need any special files or librarys for this to work?
I've gone through the code you gave me and I'm Not Sure if it's going to work for me (please understand that I'm not a programmer besides BATch programming -- this stuff is very confusing to me). Here's a sample of my code that doesn't work in IE7 but does in IE6:
| Code: |
; ---Auto-Execute------------------------------
#SingleInstance force
#KeyHistory 500
#Persistent
DetectHiddenWindows, On
DetectHiddenText, On
SetTitleMatchMode, 2
SetTitleMatchMode, Slow
SetKeyDelay, 50
; --- SetTimer --------------------------------
SetTimer, 900000TIMER, 900000 ; 15 minutes
; ---------------------------------------------
900000TIMER: ; 15 minutes
; --- RefreshRadar ----------------------------
IfWinExist, NWS Enhanced Radar Mosaic: South Plains Sector Loop
{
PostMessage, 0x111, 41504,,,NWS Enhanced Radar Mosaic: South Plains Sector Loop
}
Return
|
I know, it's pretty simple stuff. So, looking at your code, I'm thinking that it MUST have a URL in it -- but I was wanting to refresh webpages by their window text, etc... AFTER I browse to them and I can't figure out how to adjust your code to do that.
Man, this would be SO SIMPLE if I could just figure out how to determine the PostMessage command for refreshing IE7 like I did for IE6. I have a hard time believing that I'm the only one who's struggling with the differences between IE6 and IE7.
Tank, if there's anything you can do for me, I'll appreciate it. I'll also appreciate anyone who can answer my original and still-in-effect question of how to work Winspector Spy to determine the WM_COMMAND for refreshing IE7's webpages. I think I might re-post this as it's own topic instead of at the end of another topic's 25 pages -- I don't think many folks are seeing this.
Thanks to all in advance! _________________ -- Thanks, BeetleTX330 |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 2416 Location: Louisville KY USA
|
Posted: Thu Oct 30, 2008 8:41 pm Post subject: |
|
|
Beatle I am sorry i almost never use post message and am really quite ignorant on what command will make it work
I can offer you COM based alternative My examples require you to have downloaded Seans COM library found in my sig. and have it stored in the lib folder within your autohotkey instalation for example c:\program files\autohotkey\lib\COM.ahk
to use COM to refresh a page
| Code: | COM_Initialize()
pwb:=newIe()
nav(pwb,"http:\\Subsstitute your url here")
complete(pwb)
;then to refresh
nav(pwb,"refresh")
complete(pwb)
loop
{
COM_Invoke(pwb , "Refresh2") ; refresh page and do not use cache
complete(pwb) wait for page load to complete
}
newIe()
{
pwb := COM_CreateObject("InternetExplorer.Application")
COM_Invoke(pwb , "Visible=", "True") ;"False" ;"True" ;uncomment to show
Return pwb ? pwb : "Error"
}
nav(pwb,url) ; returns bool
{
If not pwb is Integer ; test to see if we have a valid interface pointer
ExitApp ; ExitApp if we dont
;~ http://msdn.microsoft.com/en-us/library/aa752133(VS.85).aspx
navTrustedForActiveX = 0x0400
COM_Invoke(pwb, "Navigate", url, 0x0400, "_self")
Return ; return the result(bool) of the complete function
}
complete(pwb) ; returns bool for success or failure
{
If not pwb is Integer ; test to see if we have a valid interface pointer
ExitApp ; ExitApp if we dont
loop 80 ; sets limit if itenerations to 40 seconds 80*500=40000=40 secs
{
If (rdy:=COM_Invoke(pwb,"readyState") = 4)
Return 1 ; return success
Sleep,500 ; sleep half second between cycles
}
Return 0 ; lets face it if it got this far it failed
} |
_________________ Basic Webpage Controls with JavaScript / COM - Tutorial by Jethrow
 |
|
| Back to top |
|
 |
BeetleTX330
Joined: 09 Jun 2005 Posts: 29
|
Posted: Thu Oct 30, 2008 10:49 pm Post subject: |
|
|
Wow, you are so cool to keep working with me on this. Hey, no problem that you don't "know-it-all" regarding PostMessage -- at least you're knocking yourself out to COM me out of this mess. I do appreciate it (and I would LOVE to get a handle on COM -- your code, although extremely confusing to me, will help in some way ramp me up in COM, I'm sure).
I won't be able to play with this until at least tomorrow or the weekend but as soon as I do, I'll reply with my progress. Thanks again!
-- Beetle Bailey (TX330) |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Dec 08, 2008 10:59 pm Post subject: |
|
|
ExtractInteger() has been removed from AutoHotkey Help - so this link shows the page but nothing re ExtractInteger()
this has happened without word from Chris - nothing about it in the Changelog
does anyone know why?
where can i find ExtractInteger() ?
|
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 2393
|
Posted: Mon Dec 08, 2008 11:09 pm Post subject: |
|
|
| Anonymous wrote: | | where can i find ExtractInteger() ? |
That function has been made obsolete by NumGet(). _________________ My Home Thread
Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags ! |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Dec 14, 2008 11:46 pm Post subject: |
|
|
[VxE] - thank you very much
i now find it in the changlog:
| Quote: | | Added NumGet() and NumPut(), which retrieve/store binary numbers with much greater speed than Extract/InsertInteger. |
no wonder that i couldn't find it with a search for ExtractInteger
if Chris will only change Extract/InsertInteger to ExtractInteger & InsertInteger then it can be found with a search (but at least this post will turn up) |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4473 Location: Qld, Australia
|
Posted: Mon Dec 15, 2008 9:13 am Post subject: |
|
|
| Anonymous wrote: | | no wonder that i couldn't find it with a search for ExtractInteger | I guess you didn't try the help file, which has an item in the index "ExtractInteger -> NumGet()"... |
|
| Back to top |
|
 |
Murp|e
Joined: 12 Jan 2007 Posts: 474 Location: Norway
|
Posted: Wed Dec 17, 2008 2:40 pm Post subject: |
|
|
SKAN,
Thanks for the great scripts. Is it possible to use the method described in "How to Hook on to Shell to receive its messages?" to execute code when a standard "Save as" window is created? I've been using the following code for testing:
| Code: | #Persistent
#singleinstance force
SetBatchLines, -1
Process, Priority,, High
Gui +LastFound
hWnd := WinExist()
DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return
ShellMessage( wParam,lParam ) {
If ( wParam = 1 ) ; HSHELL_WINDOWCREATED := 1
{
WinGetClass, class, ahk_id %lParam%
traytip, New Window, New "%class%"-class window created.
if class = #32770
msgbox, Fired on a "#32770"-class window!
}
} |
The traytip pops up for all new windows, but not for any "Save as" type windows. The kind of window I'm talking about is the kind that pops up when you click "File -> Save as" in for example Notepad. The ahk class is #32770, but since the ShellMessage doesn't fire nothing happens. Do you have any advise on this? |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7187
|
Posted: Thu Dec 18, 2008 6:00 am Post subject: |
|
|
Unfortunately, SHELLHOOK method will detect only top level windows.
The file save dialog is a child window of notepad.
So, notepad will be detected but not its child window. |
|
| Back to top |
|
 |
Murp|e
Joined: 12 Jan 2007 Posts: 474 Location: Norway
|
Posted: Thu Dec 18, 2008 9:26 am Post subject: |
|
|
| Thanks, that explains it. If anyone knows of something similar I could apply to child windows I much appreciate hearing about it. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7187
|
|
| Back to top |
|
 |
mb777
Joined: 08 Jan 2009 Posts: 42
|
Posted: Fri Jan 09, 2009 4:06 am Post subject: Brilliant |
|
|
This is brilliant!
I wish i had seen it earlier. I was looking for ways to improve the appearance of the application i am writing. |
|
| 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
|