| View previous topic :: View next topic |
| Author |
Message |
oman00339
Joined: 28 Jan 2007 Posts: 7
Digg It |
Posted: Tue Feb 06, 2007 3:34 am Post subject: Open a program |
|
|
| Is there a way that when I press a button it will open a program, and when I press it again it will close that program? I know there is a way to do it, I just don't know how. |
|
| Back to top |
|
 |
TylerK

Joined: 18 Dec 2006 Posts: 384 Location: Springfield, IL
Digg It |
Posted: Tue Feb 06, 2007 4:10 am Post subject: |
|
|
Basic, but does the trick.
| Code: | if (!var.init) then
var.switch = false
var.init = true
endif
if (Pressed(Wiimote.A)) then
if (var.switch) then
Alt && F4 = true
wait 30 ms;
Alt && F4 = false
else
Execute("C:\somefolder\someprogram.exe")
endif
var.switch = !var.switch
endif
|
|
|
| Back to top |
|
 |
oman00339
Joined: 28 Jan 2007 Posts: 7
Digg It |
Posted: Wed Feb 07, 2007 3:51 am Post subject: |
|
|
| It works to open the program, but it won't shut it down. Is there a way to close a specific program? I was thinking about if there was a command to stop a specific process, like you can do in the windows task manager |
|
| Back to top |
|
 |
JoCliMe
Joined: 15 Dec 2006 Posts: 16 Location: El Centro, CA
Digg It |
Posted: Wed Feb 07, 2007 4:54 am Post subject: |
|
|
Maybe map a key to "alt + f4"?
Edit: Wait, you mean you want to close a program/window that does not have the focus? The above script opens/closes the window that's open. |
|
| Back to top |
|
 |
ZW
Joined: 11 Jan 2007 Posts: 18
Digg It |
Posted: Fri Feb 09, 2007 7:00 pm Post subject: |
|
|
Here's a way to do it even if the program you want to close isn't the active window:
Have a counter variable which increments anytime you open a program. Then have separate variables for each program you open that store the value of the counter when you opened that program. From that number you could know how many alt+tabs you need to do before you alt+f4.
There is probably a better way to do it though, because with what I am describing everything has to be opened through glovepie...otherwise the numbers will be off. |
|
| Back to top |
|
 |
|