sharpharp Posted August 3, 2010 Share Posted August 3, 2010 Hi all, Wondering if anyone can help. I have an Autoit script which is meant to "log off" the current user, and i'm using the function Shutdown(16) to achieve this. The script works very well when logging of a user and they are using something like a web browser. The problem occurs when a user has a Microsoft Application open and is unsaved, such as MS Word/Excel. AutoIT tried to log off the user, but then a dialogue box pops up in word and says "Do you want to save your work" YES NO or CANCEL. If they hit cancel, the logoff cancels and the user can continue using the PC. I thought a forced logoff would stop all processes, even if a document was unsaved, but it doesn't seem to work. I really must have a surefire script to logoff the current user despite whichever application is open... Can anyone please help? Thanks in advance, Sharpy Link to comment Share on other sites More sharing options...
Fire Posted August 3, 2010 Share Posted August 3, 2010 (edited) Hi I think you need shutdown(20) not shutdown(16) for this reason. Script must be Shutdown(20) #cs 0 = Logoff + 4 = Force + 16= Force if hung = 20 ;SO you need shutdown(20) it must work. #ce BTW you can use another way (but it is not `ideal`) if not ProcessExists("winword.exe") Then Shutdown(16) Else ProcessClose("winword.exe") ; or ; RunWait("cmd.exe /c " & "tskill winwor*",@ScriptDir,@SW_HIDE) RunWait("cmd.exe /c " & @SystemDir & "\logoff.exe",@SystemDir,@SW_HIDE) ; or Shutdown(16) EndIf Edited August 3, 2010 by Fire [size="5"] [/size] 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