PC Shutdown from revBrowser?

Want to move your code and projects to LiveCode but don't know where to start?

Moderators: FourthWorld, heatherlaine, Klaus, robinmiller

Post Reply
ddsinteractive
Posts: 11
Joined: Tue Nov 26, 2013 10:36 pm

PC Shutdown from revBrowser?

Post by ddsinteractive » Thu Mar 27, 2014 4:47 pm

Hello!

I am a Director user converting to LiveCode and we build many standalone kiosk-type applications. In Director, we were able to create an admin function to allow the kiosk administrator to shut the PC (Windows 7) down or restart the PC from within the Projector. In LiveCode, we are using a full screen standalone application with a revBrowser external to display an embedded web application. Is it possible to have the website - which is run locally on the PC using WAMP - "talk" to the LiveCode EXE to pass a command to quit and shut the computer down?

Any alternative ways of providing this functionality would be appreciated.

Thank you!
Cheers,
Monica

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

Re: PC Shutdown from revBrowser?

Post by Simon » Thu Mar 27, 2014 6:31 pm

Hi Monica,
Try
shell("shutdown -r")
Make sure you have saved all your work :)

Simon
Edit; I'm probably too brief. Here is the list
http://www.computerhope.com/shutdown.htm
shutdown -s to shutdown, the above is for reboot.
You will have to read the browser page content looking for a specific key (e.g. <!--Time to shutdown-->) and act on that.
Last edited by Simon on Thu Mar 27, 2014 6:51 pm, edited 1 time in total.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

ddsinteractive
Posts: 11
Joined: Tue Nov 26, 2013 10:36 pm

Re: PC Shutdown from revBrowser?

Post by ddsinteractive » Thu Mar 27, 2014 6:47 pm

Simon wrote:Hi Monica,
Try
shell("shutdown -r")
Make sure you have saved all your work :)

Simon

Hi Simon,
Would this be passed from a PHP script in the web browser back to the livecode revBrowser in some way as a function?

Thank you!
Cheers,
Monica

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

Re: PC Shutdown from revBrowser?

Post by Simon » Thu Mar 27, 2014 6:56 pm

Sorry see my edit.
php? no I don't see it needed.

Code: Select all

put url(www.mysite.com/shutdown.html) into tKill
if "Time to shutdown" is in tKill then
shell("shutdown -s")
end if
:) Welcome to unfettered access.

You will probably want the -f option to force a close.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: PC Shutdown from revBrowser?

Post by Simon » Thu Mar 27, 2014 7:23 pm

Ok another edit.
... for a specific key (e.g. <!--Time to shutdown-->)
Not the best, better
<!--BlueBannanaShutMeDownCauseISaySo-->

if "BlueBannanaShutMeDownCauseISaySo" is in tKill
etc.

Better yes?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

ddsinteractive
Posts: 11
Joined: Tue Nov 26, 2013 10:36 pm

Re: PC Shutdown from revBrowser?

Post by ddsinteractive » Thu Mar 27, 2014 7:59 pm

Hi Simon,

Thank you for the guidance so far. Would the "put" command need to be in a loop of sorts? Because if the webpage is HTML, it would already be on the page and would automatically come back as true?

I hope I am making sense. :)
Cheers,
Monica

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

Re: PC Shutdown from revBrowser?

Post by Simon » Thu Mar 27, 2014 8:07 pm

Hi Monica,
You kind of have me there.
What is the trigger for a shutdown? I was thinking it would be a link.
Is something like "when the animation ends shutdown"?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply

Return to “Converting to LiveCode”