PDA

View Full Version : Newbie question: Toggling something on/off


juarez
February 1st, 2005, 01:42 AM
I just got into Girder a few days ago, and I can't seem to get this figured out. I have a remote that came with my TV card that I'm setting up for use with other programs. What I want to do is have one button turn a program on, and if it's on, it'll turn it off. I've tried but I can't seem to figure it out. This also goes for turning my monitor on and off. I searched the forums and found nothing. Thanks.

Jlee
February 1st, 2005, 07:32 AM
http://www.promixis.com/phpBB2/viewtopic.php?t=6971&highlight=state+disable+group+enable

quixote
February 1st, 2005, 07:37 AM
You'll want to look at the state settings. If you right click the command or multigroup there is a state settings selection. Create 2 commands with the same button or key to execute the command then set the states to 2 and 1 for the first command and 2 and 2 for the second command.
This way when you hit the button/key the first time it fires the command and remembers that it is in state 2, so that when you hit the button again it will fire the second one. I hope I've explained this clearly.
The alternate solution would be to use LUA variables in the Girder variable manipulation script box. This is slightly more complicated, though, but not much. Take a look at some of the script that people have posted.

juarez
February 1st, 2005, 10:46 PM
Kinf of confusing, but I think I get it.

edit: Excellent, I got it.

Now, is there a way to close a program?

Jlee
February 2nd, 2005, 02:23 AM
Kinf of confusing, but I think I get it.

edit: Excellent, I got it.

Now, is there a way to close a program?
Keep looking though those tabs and list boxes and you'll find it.

quixote
February 2nd, 2005, 09:56 AM
You'll need to target the app. It's kind of tricky getting the right combination, but what you do is open the program and drag the target in the top right over to the window and release the mouse button. Then the tricky part is checking off the correct boxes in the target dialog. (It depends on the program, I think.

juarez
February 2nd, 2005, 06:33 PM
That's where I'm confused. I can't get it to check if the window is there, and if it is, it'll close the app. Otherwise it opens the app.

Also, I can't find Page Up and Page Down in the 'Special Key' part of the Keyboard tab

quixote
February 3rd, 2005, 07:44 AM
Page up and Page down are "previous" and "next", if I recall correctly.

Treetop
February 3rd, 2005, 09:22 AM
Under the Girder tab

juarez
February 5th, 2005, 03:23 PM
Under the Girder tab
Thanks, I'll check it out.

juarez
February 5th, 2005, 03:55 PM
OK, I sorta got it working, but when I try to turn it on, it opens it, then closes it right away. Should I add a 'Stop Processing' command in the multigroup so if the window isn't there, it'll open it and stop?

edit: I tried that and it didn't work :(

Treetop
February 6th, 2005, 12:40 AM
I have a feeling that this is gonna be really simple in the end...

But, first things first. What program is this, that you are working on?

Next: to open the program, are you using:
OS (tab): Execute (with the proper path to the exe file)
Sidenote -- you can use parameters for the app in the "Step Size" box

To close the program:

Windows (tab): Close (targetting the app itself)

To use the above you need three seperate commands. The remote event is only attached to the "If exists" command.

True = Execute (path to app)
False = Close (targetting app)

Please attach your gml file so that we can take a look.

Treetop

juarez
February 6th, 2005, 12:58 AM
Hehe, for the closing of the app I was just sending Alt+F4 to the program. Didn't even see the Close option. I'll try that and get back to you.

juarez
February 6th, 2005, 01:17 AM
Ok, it's still being weird. The program is DScaler.

Treetop
February 6th, 2005, 02:22 AM
Bugger... I don't use DScaler. (or Media Classic Player for that matter) :(

Do you have the same problems with WinAmp?

Regardless, I tweaked your gml file a bit ... got rid of some things (brought it down to the basics), and changed some targetting properties for DScaler.

Does this do anything? -- Probably not, but I'm driving blind here.

Treetop
February 6th, 2005, 02:25 AM
One thing about the "ALT + F4"

Since its a generic windows keyboard command, it will only work on an app if it is in focus! Not ideal for my particular setup (Dual-monitor), but it may work for you nontheless.

By using the "Close" option, you can set the target for a specific application, regardless if its inthe foreground (focused) or not.

juarez
February 6th, 2005, 03:31 PM
I get the same problem with the GML file you posted. :(

The problem with MPC is that it just closes the file and reopens it. Even when I use the "Close" command. :-?

mattsoftnet
May 12th, 2005, 10:59 PM
I tried the on/off thing using states, but I can't get it to work. I press the button and the monitor turns off, then I press it again and it goes to turn on but turns right back off again. I don't get how to do this or how to use multigroups.