Hi, I'm trying to create a single shortcut in Windows XP Pro that will open three programs (if they are not already open).
So far, I have this:
<?php
if (!extension_loaded('gtk')) {
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}
$progs[0]['path'] = "D:\\Program Files\\Mozilla Thunderbird\\";
$progs[0]['exe'] = "thunderbird.exe";
$progs[1]['path'] = "D:\\Program Files\\Mozilla Sunbird\\";
$progs[1]['exe'] = "sunbird.exe";
$progs[2]['path'] = "D:\\Program Files\\Mozilla Thunderbird\\TrayIt\\";
$progs[2]['exe'] = "trayit!.exe";
$tasklist = `tasklist`;
foreach($progs as $key => $attr)
{
if(!eregi($attr['exe'], $tasklist))
{
exec("cd /D ".$progs[$key]['path']);
exec("start ".$progs[$key]['exe']);
}
}
Gtk::main();
?>
The script is called via a shortcut: G:\PHP\php_win.exe G:\PHP\scripts\email.php
I can't seem to fix the following behavior:
Goes through my $progs array and when it comes to a program that is not open, it opens it. It then WILL NOT open any other program until the original program has been closed. So for example if I run this script and Thunderbird is open but the other two are not, it will open up Sunbird and run in the background. When Sunbird is closed, it tries to run TrayIt!.
It cannot open TrayIt!. I have tried creating a copy of trayit!.exe that does not contain an exclamation mark, but that didn't help. It just says that Windows can't find whatever executable I put in there.
php.exe never stops running until I close it myself.
My system is as follows:
- Windows XP Pro SP2 fully updated
- PHP-GTK 1.0.2