Sign in to follow this  
Followers 0
Damien56546

Logoff Script

14 posts in this topic

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

Share this post


Link to post
Share on other sites



Thanks, is there an on exit function?

Share this post


Link to post
Share on other sites

Func OnAutoitExit()
;blabla
EndFunc


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

If internet explorer is closed :

If Not ProcessExists("iexplorer.exe") Then
;blabla
EndIf

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

I think ti has to be in a loop to continuously check if it's running?

Share this post


Link to post
Share on other sites

@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

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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 :)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

@TurionAltec

I you knew read replys you would know that we have already answered to this topic :)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0