Page 1 of 1

Logging User off

Posted: Wed Dec 17, 2014 9:48 pm
by robison.scott
The grand scheme of what I want to do it to have a floating timer that will log people off when it hits 0:00. I have the timer working and everything else around it. The issue is that I can't get livecode to log the user off. I've used the two code snippets from below. The .bat file contains the same shell command used in the top. This command used in command prompt works just fine. What am i doing wrong?

Code: Select all

on logout
shell("shutdown /l /f")
end logout

Code: Select all

on logout
launch "logout.bat"
end logout

Re: Logging User off

Posted: Wed Dec 17, 2014 10:02 pm
by Simon
Hi robison.scott,
Welcome to the forum!

I'm thinking the command is waiting for a return value so it can't shut down.
Not clear if "shell("shutdown /l /f")" is directed at the liveCode stack?
If so, try "quit".

Simon

Re: Logging User off

Posted: Wed Dec 17, 2014 10:12 pm
by SparkOut
When the timer reaches zero the "logout" handler is fired?
So you want to log out from Windows while LiveCode invokes the shell command.
I haven't tested (using phone to read forum atm) but in the logout handler you might need to quit Livecode. But the first thing I would try is

Code: Select all

get shell(shutdown /l /f)
in LiveCode shell is a function rather than a command, I believe.

Re: Logging User off

Posted: Wed Dec 17, 2014 10:32 pm
by sturgis
don't forget the quotes..

get shell("shutdown /l /f")

Just tried it here, works fine (win 7)

Also added a quit to close the app properly.

Re: Logging User off

Posted: Wed Dec 17, 2014 11:08 pm
by SparkOut
oops, yes quotes (sussenfrussen phone keyboard forgot bleagh)