Hello there, just wandered by doing some research for a cell phone to home phone blog post. Truly more information that you can imagine on the web. Wasn't exactly what I was looking for, but cool site. Have a great day.
For anyone who wants it, you can add these two lines:
exec("osascript -e 'tell application \"System Events\" to set visible of process \"$app\" to true'"); exec("osascript -e 'tell application \"System Events\" to set frontmost of process \"$app\" to true'");
to
function startapp($app) { exec("osascript -e 'tell application \"$app\" to launch'",$response); if (isrunning($app) == "1") return "$app launched"; else return "Error launching $app"; }
between return "Error launching $app"; and the bracket to make the application you launch come to the front. (it's in functions.php)
Oh yeah, forgot to mention what it does - when you launch an application, it will set it's visible and frontmost to true. Or, in other words, when you launch an application, it will come up in front of all your other open applications.
I wrote a script to generate HTML for the application launcher. It isn't great, but it works. See it at: https://github.com/kuyanata... Just for anyone who might be able to use it.
Cool! My only concern would be that when you load the page from your server, by default it checks every process in the list to determine if it's running. Because it's doing that with AppleScript, the thread/memory control is pretty bad and a long list could probably hang the server… I haven't tried it, though… how long a list have you been able to load?
It wouldn't be too difficult to remove the check for initial state and just check an app when it's requested. For example, don't have the switch show up when the page loads, tap the app name to check it's state, then get the switch set to the correct on/off state for toggling. That would circumvent the whole issue, and you could run your entire Apps folder out of it.
I've been able to load a list of about 54 applications. There /is/ a bit of lag when I go to the page, but not that much. I agree with your solution. As an alternative. you could remove the switches and just have a button that performs the same function.
Oh, and I found out if an application's name takes up too much space, then the on/off switches will be pushed down, pushing some of the switches below it with it.
Hi, I installed the homecontrol scripts on my webserver and the page loads fine. the first time I went to the application section it figured out that sendtome was started but did not recognize itunes running. since then it does not recognise any app being launched . whenever i turn any app on, it says "error loading itunes" on the info bar.
I've been tinkering with AppleScript, and I love what you're doing here. Thing is, I'm having the same problems as Max above. Any help would be greatly appreciated.
I just got a screenshot from Jeff, and it appears to be a permissions problem with writing the volume out to a text file, at least in part. In Terminal, change to the folder where homecontrol lives (cd ~/Sites/homecontrol) and then type
Still doesn't work. Every time I use "volume up" it says volume 10 no matter how many times; volume down yields -10 every time. mute doesn't seem to do anything. itunes still doesn't respond to anything. no more error messages though!
I cannot seem to get the web app working. Every time a function is called, I get errors regarding a parameter needing to be a resource, but given as a boolean. This is true of the volume commands and app launching commands. The iTunes commands don't seem to do much of anything. I have my personal web server up and running with PHP5 installed. Any ideas?
Are you running the stock Snow Leopard PHP5, or a custom build? I'll email you directly and see if I can get a screenshot of the error message so I'm sure I know what you're seeing.
hi guys, is it possible to control the "apple's special keys" (like volume +/- or brightness +/-) with this app? i haven't found any program that can actually do this :(
I'm getting all sorts of errors when I try to use it. Everything shows up, but when I push buttons, I get script errors at the top of the screen and nothing happens. What have I done wrong?
It looks like you may be missing a few images from the zip file. I'm getting a few 404's while things are running. I'm adding support for toggling Airfoil speakers. Let me know if you're interested in my (very hacky) code!
Wow, this looks very cool! I have just been on a parallel path the last week or so, actually, and came up with this : http://code.google.com/p/bu...
Your web development skills are much better then mine, I see :-)
I also started off with PHP and apache, but moved over to using Python and the Tornado web server package (http://www.tornadoweb.org/). Using Platypus ( http://www.sveinbjorn.org/p..., I was able to make a user launchable web-server app with custom password and port.
Comments
Hello there, just wandered by doing some research for a cell phone to home phone blog post. Truly more information that you can imagine on the web. Wasn't exactly what I was looking for, but cool site. Have a great day.
export
For anyone who wants it, you can add these two lines:
exec("osascript -e 'tell application \"System Events\" to set visible of process \"$app\" to true'");
exec("osascript -e 'tell application \"System Events\" to set frontmost of process \"$app\" to true'");
to
function startapp($app) {
exec("osascript -e 'tell application \"$app\" to launch'",$response);
if (isrunning($app) == "1")
return "$app launched";
else
return "Error launching $app";
}
between return "Error launching $app"; and the bracket to make the application you launch come to the front.
(it's in functions.php)
export
Kewl you should come up with that. Ecxenllet!
export
Oh yeah, forgot to mention what it does -
when you launch an application, it will set it's visible and frontmost to true. Or, in other words, when you launch an application, it will come up in front of all your other open applications.
export
I wrote a script to generate HTML for the application launcher. It isn't great, but it works.
See it at: https://github.com/kuyanata...
Just for anyone who might be able to use it.
export
Cool! My only concern would be that when you load the page from your server, by default it checks every process in the list to determine if it's running. Because it's doing that with AppleScript, the thread/memory control is pretty bad and a long list could probably hang the server… I haven't tried it, though… how long a list have you been able to load?
It wouldn't be too difficult to remove the check for initial state and just check an app when it's requested. For example, don't have the switch show up when the page loads, tap the app name to check it's state, then get the switch set to the correct on/off state for toggling. That would circumvent the whole issue, and you could run your entire Apps folder out of it.
export
I've been able to load a list of about 54 applications. There /is/ a bit of lag when I go to the page, but not that much.
I agree with your solution. As an alternative. you could remove the switches and just have a button that performs the same function.
Oh, and I found out if an application's name takes up too much space, then the on/off switches will be pushed down, pushing some of the switches below it with it.
export
Hi,
I installed the homecontrol scripts on my webserver and the page loads fine. the first time I went to the application section it figured out that sendtome was started but did not recognize itunes running. since then it does not recognise any app being launched . whenever i turn any app on, it says "error loading itunes" on the info bar.
i have got php5 installed.
any idea?
export
Are the other functions working for you? System Volume, iTunes control, etc.?
export
no, none of the functions are working.... :(
export
I've been tinkering with AppleScript, and I love what you're doing here. Thing is, I'm having the same problems as Max above. Any help would be greatly appreciated.
export
I haven't had much time to do "support" on this project, but I'll try to get back to you both with some suggestions as soon as I'm able.
export
I'm getting the same thing as Jeff!
export
I just got a screenshot from Jeff, and it appears to be a permissions problem with writing the volume out to a text file, at least in part. In Terminal, change to the folder where homecontrol lives (cd ~/Sites/homecontrol) and then type
touch volume.txt; chmod 777 volume.txtSee if that helps, and let me know.
export
Still doesn't work. Every time I use "volume up" it says volume 10 no matter how many times; volume down yields -10 every time. mute doesn't seem to do anything. itunes still doesn't respond to anything. no more error messages though!
export
I cannot seem to get the web app working. Every time a function is called, I get errors regarding a parameter needing to be a resource, but given as a boolean. This is true of the volume commands and app launching commands. The iTunes commands don't seem to do much of anything. I have my personal web server up and running with PHP5 installed. Any ideas?
export
Are you running the stock Snow Leopard PHP5, or a custom build? I'll email you directly and see if I can get a screenshot of the error message so I'm sure I know what you're seeing.
export
hi guys, is it possible to control the "apple's special keys" (like volume +/- or brightness +/-) with this app?
i haven't found any program that can actually do this :(
export
It can control anything AppleScript can control, and volume is easy. Brightness would require some System Event scripting, like this.
export
I'm getting all sorts of errors when I try to use it. Everything shows up, but when I push buttons, I get script errors at the top of the screen and nothing happens. What have I done wrong?
export
Did you make sure php was enabled? Most of those errors are usually raw php that isn't being processed by the server.
export
It looks like you may be missing a few images from the zip file. I'm getting a few 404's while things are running. I'm adding support for toggling Airfoil speakers. Let me know if you're interested in my (very hacky) code!
export
I'll take a look at the zip and see what's up. I'd definitely love to see what you do with the Airfoil toggle. Feel free to contact me with an update!
export
Wow, this looks very cool! I have just been on a parallel path the last week or so, actually, and came up with this : http://code.google.com/p/bu...
Your web development skills are much better then mine, I see :-)
I also started off with PHP and apache, but moved over to using Python and the Tornado web server package (http://www.tornadoweb.org/). Using Platypus ( http://www.sveinbjorn.org/p..., I was able to make a user launchable web-server app with custom password and port.
Can't wait to look at your stuff this evening!
export
That's actually a really awesome solution to the web server security issue. Looking forward to digging into your code, too!
export
Wow! You turned my silly little script into a highly functioning application. Cool
export