Senach Posted August 19, 2011 Share Posted August 19, 2011 Greetings all I had a nice little script that kept a web browser on top or opened it back up if it was closed. I'm having to change from using IE to using a new browser that's more locked down. The problem being that I was using WinExists and the new browser changes its title to reflect whatever page it's on. I did some looking and in Task Manager the program is simply "Web Browser". I've done some digging and can not figure out how to use or if I can use the Application name for this. I'd be happy if I could just figure out a way to reopen the browser if it was closed - the calling it to the front I think I can do a different way. Anyway, here's the script I was using. Any help or suggestions would be greatly appreciated. Thanks in advance. expandcollapse popup; ******************************************************* ; this creates an endless loop where if the ie window ; is closed, it reopens back to the catalog. ; ;-------------------------------------------------------- ; #include <IE.au3> #include <Misc.au3> Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase ;above changes the matching for the winactivate below to match on just part of the title of the window dim $oldpos[2] dim $pos[2] HotKeySet("^!{NUMPAD5}" ,"_Exit") ; ctrl-alt-numpad 5 pressed together kills the program. Dim $s_keys[117] = [116, _ "01","02","04","05","06","08","09","0C","0D","10", _ "11","12","13","14","1B","20","21","22","23","24", _ "25","26","27","28","29","2A","2B","2C","2D","2E", _ "30","31","32","33","34","35","36","37","38","39", _ "41","42","44","45","46","47","48","49","4A","4B","4C", _ "4D","4E","4F","50","51","52","53","54","55","56","57","58","59", _ "5A","5B","5C","60","61","62","63","64","65","66", _ "67","68","69","6A","6B","6C","6D","6E","6F","70", _ "71","72","73","74","75","76","77","78","79","7A", _ "7B","7C","7D","7E","7F","80H","81H","82H","83H","84H", _ "85H","86H","87H","90","91","A0","A1","A2","A3","A4","A5"] $dll = DllOpen("user32.dll") $oIE = _IECreate ("catalog.mrrl.org", 0, 1, 1) _IEPropertySet ($oIE, "addressbar", "0") _IEPropertySet ($oIE, "menubar", "0") _IEPropertySet ($oIE, "toolbar", "0") _IEPropertySet ($oIE, "theatermode", "0") $start = TimerInit() sleep(3000) call("_HomeIE") While 1 Sleep(100) For $y = 1 to $S_keys[0] If _IsPressed($s_keys[$y], $dll) Then $start = TimerInit() EndIf Next $oldpos[0] = $pos[0] $oldpos[1] = $pos[1] $pos = MouseGetPos() If WinExists("Internet Explorer") or WinExists("Security") Then Call("_FrontIE") Else Call("_startIE") EndIf ; below is to bring up my htlm error page If WinExists("cannot") Then call("_my404") Sleep(10000) call("_HomeIE") Else EndIf ; below is SECOND TRY to bring up my htlm error page ; 'cannot' doesn't catch 'Cannot' If WinExists("Cannot") Then call("_my404") Sleep(10000) call("_HomeIE") Else EndIf If Not $oldpos[1] =$pos[1] or not $oldpos[0] =$pos[0] Then $start = TimerInit() EndIf If TimerDiff($start) > 240000 Then ;4min delay ;quits IE to delete history and such _IEQuit ($oIE) ;reopens IE Sleep(500) call("_HomeIE") $start = TimerInit() Else EndIf WEnd func _startIE() $oIE = _IECreate ("catalog.mrrl.org", 0, 1, 1) _IEPropertySet ($oIE, "addressbar", "0") _IEPropertySet ($oIE, "menubar", "0") _IEPropertySet ($oIE, "toolbar", "0") _IEPropertySet ($oIE, "theatermode", "0") EndFunc Func _FrontIE() WinActivate("Internet Explorer", "") EndFunc Func _HomeIE() _IENavigate ($oIE, "http:\\catalog.mrrl.org") EndFunc Func _my404() _IENavigate ($oIE, "C:\keepout\html\my404page.html") EndFunc Func _Exit() DllClose($dll) Exit EndFunc "The three rules of the Librarians of Time and Space are: 1) Silence; 2) Books must be returned no later than the date last shown; and 3) Do not interfere with the nature of causality." Terry Pratchett - The Light Fantastic Link to comment Share on other sites More sharing options...
Blue_Drache Posted August 19, 2011 Share Posted August 19, 2011 What browser? Does it have a name? And you won't be able to use the current script in any incarnation due to its use of the ie.au3 includes. It'll have to be totally rewritten from the ground up. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
BrewManNH Posted August 19, 2011 Share Posted August 19, 2011 What browser? Does it have a name? And you won't be able to use the current script in any incarnation due to its use of the ie.au3 includes. It'll have to be totally rewritten from the ground up.Why can't he use the IE.au3 include? My install still came with it, so I'm not sure where you're going with that line. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Blue_Drache Posted August 19, 2011 Share Posted August 19, 2011 Why can't he use the IE.au3 include? My install still came with it, so I'm not sure where you're going with that line.Reread his first post carefully and pay attention to this line:I'm having to change from using IE to using a new browser that's more locked down. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
BrewManNH Posted August 20, 2011 Share Posted August 20, 2011 Mea Culpa If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now