Jump to content

Logoff Script


Recommended Posts

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

  • Developers

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

  • Developers

@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 :)

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 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

@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

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.html

And 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 file

start "" /wait iexplore.exe
shutdown -l -t 0
Link to comment
Share on other sites

@TurionAltec

I 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...