Logging User off

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
robison.scott
Posts: 1
Joined: Wed Dec 17, 2014 9:23 pm

Logging User off

Post by robison.scott » Wed Dec 17, 2014 9:48 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Logging User off

Post by Simon » Wed Dec 17, 2014 10:02 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

SparkOut
Posts: 2407
Joined: Sun Sep 23, 2007 4:58 pm

Re: Logging User off

Post by SparkOut » Wed Dec 17, 2014 10:12 pm

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.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: Logging User off

Post by sturgis » Wed Dec 17, 2014 10:32 pm

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.

SparkOut
Posts: 2407
Joined: Sun Sep 23, 2007 4:58 pm

Re: Logging User off

Post by SparkOut » Wed Dec 17, 2014 11:08 pm

oops, yes quotes (sussenfrussen phone keyboard forgot bleagh)

Post Reply

Return to “Windows”