Damien56546 Posted December 23, 2008 Share Posted December 23, 2008 Hi everyone! Just after a bit of help. Basically, I want a simple script that will initiate a logoff if internet explorer is closed. Is this possible? I don't really know where to start. I had a script that automatically opened up CMD when I did something, like open up a certain page. So I think it's possible. If anyone has something similar or would be willing to help me out it would be greatly appreciated. Merry Xmas Link to comment Share on other sites More sharing options...
BrettF Posted December 23, 2008 Share Posted December 23, 2008 Shutdown () Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Damien56546 Posted December 23, 2008 Author Share Posted December 23, 2008 Thanks, is there an on exit function? Link to comment Share on other sites More sharing options...
FireFox Posted December 23, 2008 Share Posted December 23, 2008 Func OnAutoitExit() ;blabla EndFunc Link to comment Share on other sites More sharing options...
FireFox Posted December 23, 2008 Share Posted December 23, 2008 If internet explorer is closed : If Not ProcessExists("iexplorer.exe") Then ;blabla EndIf Link to comment Share on other sites More sharing options...
Damien56546 Posted December 23, 2008 Author Share Posted December 23, 2008 I think ti has to be in a loop to continuously check if it's running? Link to comment Share on other sites More sharing options...
FireFox Posted December 24, 2008 Share Posted December 24, 2008 @Damien56546 Exactly, I think this is what you want : While 1 Sleep(250) If Not ProcessExists("iexplore.exe") Then ;explorer is closed Shutdown(0) ;Log off EndIf WEnd Func OnAutoItExit() ;Script is closed MsgBox(64,"Exit","Exiting script...") EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted December 24, 2008 Developers Share Posted December 24, 2008 or simply: While ProcessExists("iexplore.exe") Sleep(250) WEnd Shutdown(0);Log off SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
FireFox Posted December 24, 2008 Share Posted December 24, 2008 @Jos Yep its another way, but I dont know if its better because Shutdown(0) could be executed at launch of script if another while exists for another thing Link to comment Share on other sites More sharing options...
Developers Jos Posted December 24, 2008 Developers Share Posted December 24, 2008 (edited) @JosYep its another way, but I dont know if its better because Shutdown(0) could be executed at launch of script if another while exists for another thing The script you shown stays within the While-Wend loop processes 4 times a second the Shutdown() command untill the PC is shutdown when IE isn't running.Not sure what you mean with your other comments.Jos Edited December 24, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
FireFox Posted December 24, 2008 Share Posted December 24, 2008 @Jos I meant when you add something to while like that While 1 Sleep(250) If Not ProcessExists("iexplore.exe") Then;explorer is closed Shutdown(0);Log off EndIf If ProcessExists("Notepad.exe") Then Shutdown(0) EndIf WEnd While Not ProcessExists("iexplore.exe") Sleep(250) WEnd Shutdown(0);Log off While ProcessExists("Notepad.exe") Sleep(250) WEnd Shutdown(0);Log off Its different because in the 2nd script the 2nd while wont work until 1st while isnt finish Link to comment Share on other sites More sharing options...
TurionAltec Posted December 24, 2008 Share Posted December 24, 2008 What is the purpose of this script?If the computer is only used for internet explorer, and no other applications, investigate both Internet explorer kiosk mode:http://www.windowsnetworking.com/kbase/Win...nKioskMode.htmlAnd changing the Windows shell from explorer, to internet explorer.With IE as the shell, the Windows desktop and start menu will not be available, but when IE is closed, it will log out.To continue with the train of thought in other responses, if this script is being run at login, it may be checking for IE before IE is started, and immediately log out. Two things you can do for this,1) Code in a check to wait for IE to start:I also chose to use processwaitclose.While Not ProcessExists("iexplore.exe") sleep(250) WEnd ;wait for IE to start $pid=ProcessExists("iexplore.exe") ProcessWaitclose($pid) shutdown(0)oÝ÷ Û`¨uëazËZ®Ø§È«®éðj+ZºÚ"µÍ[ØZ] ][ÝÚY^ÜK^I][ÝÊBÚ]ÝÛYou could even do the second option as a batch filestart "" /wait iexplore.exe shutdown -l -t 0 Link to comment Share on other sites More sharing options...
FireFox Posted December 24, 2008 Share Posted December 24, 2008 @TurionAltec I you knew read replys you would know that we have already answered to this topic Link to comment Share on other sites More sharing options...
TurionAltec Posted December 24, 2008 Share Posted December 24, 2008 @TurionAltecI you knew read replys you would know that we have already answered to this topic Damien56546 has yet to reply as to whether or not their problem is fully solved or not. I was just offering a different opinion. For example no one mentioned ProcessWait / ProcessWaitClose function, which might be better than a While / Wend loop.Also I looked at the root purpose of the script, which some people overlook, and there may be a better solution, for example if the computer is going to act as a kiosk of some kind. 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