image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
Thread Tools
  #1  
Old February 26th, 2007, 07:49 PM
Registered User
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
throatmonster is on a distinguished road
Question Getting Apache PHP script to do something in GUI?

I'm trying to use a Mac Mini as a Digital Signage display driver, and also as a controller for the display. I'm using Python and a Keyspan USB Serial adapter driven by PHP scripts to control the display, and all that is working really well.

What I can't seem to figure out is how to get the GUI to open a PowerPoint Slideshow in the GUI via PHP. I'm running Apache as the logged in GUI user, I can do an "open powerpoint.pps" in the shell and that works, but the same command in PHP ( exec("open powerpoint.pps") ) does not work.

Maybe I can get automator to watch a folder or file, and when the file timestamp changes, provoke the action? Then a new file upload, or an exec command that copies and rewrites the existing file should do it.

But, does anyone know a better way than that, maybe how to get a PHP script to directly provoke some action in the logged in GUI user?

Thanks,
Reply With Quote
  #2  
Old March 13th, 2007, 02:23 PM
billbaloney's Avatar
House pianist
 
Join Date: Oct 2000
Location: Brooklyn, NY
Posts: 509
Thanks: 0
Thanked 0 Times in 0 Posts
billbaloney is on a distinguished road
Possible

This actually should be possible, provided
1. You wrap the open command in a shell script
2. httpd has execute permission for the shell script
3. httpd has read permission for the document, including the entire path to the document

For instance, if you write a shell script at /tmp/open.sh that looks like this:

Code:
#!/bin/sh
/usr/bin/open /tmp/my-presentation.pps
And set permissions to 777 (or chown it to www, etc.), and write a PHP script that looks like this:

Code:
<?php
exec("/tmp/open.sh");
?>
You should be in business, provided the PHP script is in htdocs somewhere. If this script chain fails somewhere, it will be due to permissions / access issues, not to an inherent limitation in the scheme.
__________________
Matt (billbaloney)
1.67GHz "October 2005" G4 Aluminum 1.5 GB RAM, OS 10.5.2
Lots of other things around
Helen Marie
Holford Industries

Last edited by billbaloney; March 13th, 2007 at 02:26 PM. Reason: Code markup change for readability
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 08:09 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.