On keypress
i want start a program, if it┬┤s not startet yet.
If it┬┤s already started, then put the program in foreground.
How do i write the if then else ?
Can i use the windows finder or would you use a other way ?
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
"Program started" condition query
Re: "Program started" condition query
unfortunately we don't have If-Then-Else statements until Brett gets farther along with his rewrite of EG but until then I do just what you are talking about using what I call a "Restore" routine. Here's the method...
Restore Macro
Find Window
If unsuccessful jump to <Load Macro>
Python Script: Restore if Minimized
Then create a Macro to do the load of the app
Restore if Minimized script...
Restore Macro
Find Window
If unsuccessful jump to <Load Macro>
Python Script: Restore if Minimized
Then create a Macro to do the load of the app
Restore if Minimized script...
Code: Select all
from eg.WinApi.Dynamic import GetWindowLong, ShowWindow, SW_RESTORE, SW_MAXIMIZE, SW_MINIMIZE
# Check that we have a window to try to minimize/restore
# Use Find Window action before this script!
if len(result) > 0:
# Check if WS_MINIMIZE bit is set
if(GetWindowLong(result[0], -16) & 0x20000000):
eg.plugins.EventGhost.ShowOSD('Minimized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
ShowWindow(result[0], SW_RESTORE)setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
Re: "Program started" condition query
Thank you.
Where can i read over the variables ?
The documentation or the wiki don┬┤t tell about.
if len (result) >0
I know now the function len, but i don┬┤t understand how to create the result variable.
(For all other newbies : http://docs.python.org/library/index.html )
*******************************************
I have two programs (foobar and powerpoint). Both startet maximised.
I start foobar with a commandline + playlist, so foobar starts play immediately.
Problem is, if i press the "Start foobar" button again, the music starts fresh from first track.
I think, i don┬┤t need minimize or maximise the windows, but even then, i think it do no harm
if i send a maximize window order to an windows that is already max.
How i use the find window variable ?
Can i use only true or false ?
Where can i read over the variables ?
The documentation or the wiki don┬┤t tell about.
if len (result) >0
I know now the function len, but i don┬┤t understand how to create the result variable.
(For all other newbies : http://docs.python.org/library/index.html )
*******************************************
I have two programs (foobar and powerpoint). Both startet maximised.
I start foobar with a commandline + playlist, so foobar starts play immediately.
Problem is, if i press the "Start foobar" button again, the music starts fresh from first track.
I think, i don┬┤t need minimize or maximise the windows, but even then, i think it do no harm
if i send a maximize window order to an windows that is already max.
How i use the find window variable ?
Can i use only true or false ?
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: "Program started" condition query
I'm not sure what you need.
Maybe it can be expressed as follows:
I need to macro "Run foobar2000" worked only when foobar2000 is not yet running.
If so, then here's the deal:Note: Check box Stop macro, if target is not found in action Find window should not be marked!
Pako
Maybe it can be expressed as follows:
I need to macro "Run foobar2000" worked only when foobar2000 is not yet running.
If so, then here's the deal:Note: Check box Stop macro, if target is not found in action Find window should not be marked!
Pako
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: "Program started" condition query
Up until now I read the original post.
I think you need this:Pako
I think you need this:Pako
Re: "Program started" condition query
I got it to work.
After i try to set a find window before a bring to front.
Now, i know the find window can only be used for the next comand.
I did it with jump if success.
After i try to set a find window before a bring to front.
Now, i know the find window can only be used for the next comand.
I did it with jump if success.
Re: "Program started" condition query
If the target window is minimized, and you use 'Bring to Front' is it maximizing it?
I seem to remember having problems with 'Bring to Front' so I'm using the script to Maximize it.
I seem to remember having problems with 'Bring to Front' so I'm using the script to Maximize it.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system