Start Application - Ignore if already running option

Got a good idea? You can suggest new features here.
Post Reply
katana80
Posts: 8
Joined: Fri May 23, 2008 5:48 pm

Start Application - Ignore if already running option

Post by katana80 » Sun May 25, 2008 5:21 pm

I use the Start Application action to start an app. Sometimes I start the app when it is already running or would like to use the same button to start the app as well as get focus back to the app when it is already running. Depending on the application, if you run an app already running it might display an error or message ("instance already running", etc).

My feature suggestion is to provide a check box (just like the "wait till app is terminated before proceed") for the option to "ignore if application is already running".

I'm sure there is a simple way to do this using python script and conditional jumps with find window function (if possible can you provide an example?)

But I think the feature is also basic and standard enough to be in future releases.

Thanks.
katana80

bskchaos
Experienced User
Posts: 55
Joined: Tue Mar 25, 2008 3:04 pm

Re: Start Application - Ignore if already running option

Post by bskchaos » Sun May 25, 2008 7:00 pm

Try playing with this... Action -> Window -> Find a window

katana80
Posts: 8
Joined: Fri May 23, 2008 5:48 pm

Re: Start Application - Ignore if already running option

Post by katana80 » Sun May 25, 2008 9:21 pm

bskchaos:

Thx for the reply. Yeah I tried playing around with the already existing Find Window action.
That action works nice when you already expect the window (application) to be up and running.
And you can specify to 'ABORT if window is NOT FOUND'.

But it doesn't provide the inverse option of 'ABORT if the window IS FOUND' or 'CONTINUE if window is NOT FOUND' ... which is basically what I want.

User avatar
topix
Experienced User
Posts: 417
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: Start Application - Ignore if already running option

Post by topix » Mon May 26, 2008 3:47 pm

Or you could use Task.(created|activated|deactivated...) to enable/disable different macros for the same event.

User
Posts: 47
Joined: Sun May 11, 2008 12:56 pm

Re: Start Application - Ignore if already running option

Post by User » Tue May 27, 2008 1:09 am

In my case, I just use this:

+Macro: Green - Start
  • Event: HID.Button.15
  • Action: Find Window: MediaPortal.exe
  • Action: Jump - if (above action) sucessful jump to "Green - MediaPortal Home"
  • Action: Jump - if (above action) unsucessful jump to "Green - Run MediaPortal"
+Macro: Green - MediaPortal Home
  • Action: Find Window: MediPortal.exe
  • Emulate Keystroke: h
+Macro: Green - Run MediaPortal
  • Start Program: MediaPortalLoader.bat
    *Where this bat is where I configure to disable the monitor shutdown timeout, etc.

Or, in xml style:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1399">
    <Macro Name="Green - Start">
        <Event Name="HID.Button.15" />
        <Action>
            Window.FindWindow(u'MediaPortal.exe', None, None, None, None, None, False, 0.0, 2)
        </Action>
        <Action>
            EventGhost.NewJumpIf(XmlIdLink(74), 0, False)
        </Action>
        <Action>
            EventGhost.NewJumpIf(XmlIdLink(77), 1, False)
        </Action>
    </Macro>
    <Macro Name="Green -  MediaPortal Home" id="74">
        <Action>
            Window.FindWindow(u'MediaPortal.exe', None, None, None, None, None, False, 0.0, 2)
        </Action>
        <Action>
            Window.SendKeys(u'h', False)
        </Action>
    </Macro>
    <Macro Name="Green - Run MediaPortal" id="77">
        <Action>
            System.Execute(u'C:\\Program Files\\Team MediaPortal\\MediaPortalLoader.bat', u'', 3, False, 2, u'')
        </Action>
    </Macro>
</EventGhost>

PS: I just love this software =D

katana80
Posts: 8
Joined: Fri May 23, 2008 5:48 pm

Re: Start Application - Ignore if already running option

Post by katana80 » Tue May 27, 2008 7:46 am

User:

Thanks so much! Yes that is exactly what I wanted! I can't believe I overlooked such a useful feature. The more I familiarize myself with what's possible with EventGhost the more I love this software. Time to go reconfigure my macros again!

mfsav2
Posts: 9
Joined: Tue Apr 28, 2009 11:00 pm

Re: Start Application - Ignore if already running option

Post by mfsav2 » Sun May 03, 2009 6:00 pm

User wrote:In my case, I just use this:

+Macro: Green - Start
  • Event: HID.Button.15
  • Action: Find Window: MediaPortal.exe
  • Action: Jump - if (above action) sucessful jump to "Green - MediaPortal Home"
  • Action: Jump - if (above action) unsucessful jump to "Green - Run MediaPortal"
+Macro: Green - MediaPortal Home
  • Action: Find Window: MediPortal.exe
  • Emulate Keystroke: h
+Macro: Green - Run MediaPortal
  • Start Program: MediaPortalLoader.bat
    *Where this bat is where I configure to disable the monitor shutdown timeout, etc.
I've done exactly the same but it hangs on the Find Window.
It does not go on.

can you help me ?

User avatar
jinxdone
Plugin Developer
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Start Application - Ignore if already running option

Post by jinxdone » Sun May 03, 2009 10:27 pm

You probably have the "stop macro if target is not found" checkbox turned on in the find window acition's config

mfsav2
Posts: 9
Joined: Tue Apr 28, 2009 11:00 pm

Re: Start Application - Ignore if already running option

Post by mfsav2 » Mon May 04, 2009 8:13 am

jinxdone wrote:You probably have the "stop macro if target is not found" checkbox turned on in the find window acition's config
I have not seen that flag in the config... where is it ?

User avatar
jinxdone
Plugin Developer
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Start Application - Ignore if already running option

Post by jinxdone » Mon May 04, 2009 9:58 am

+Macro: Green - Start

* Event: HID.Button.15
* Action: Find Window: MediaPortal.exe <---- here
* Action: Jump - if (above action) sucessful jump to "Green - MediaPortal Home"
* Action: Jump - if (above action) unsucessful jump to "Green - Run MediaPortal"
Configure the "find window" action. The checkbox is in the top portion of the config window.

eyal670
Posts: 1
Joined: Fri Oct 31, 2014 5:26 am

Re: Start Application - Ignore if already running option

Post by eyal670 » Fri Oct 31, 2014 5:33 am

Hi
here an example of what you need with tow different apps running based on autoremote and tasker app from android phone

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1669">
    <Folder Name="web development">
        <Macro Name="check if running" Expanded="True">
            <Event Name="AutoRemote.Message.web" />
            <Action>
                Window.FindWindow(u'AptanaStudio3.exe', None, None, None, None, None, False, 0.0, 2)
            </Action>
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(34), 1, True)
            </Action>
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(26), 0, True)
            </Action>
            <Action>
                Window.FindWindow(u'navicat.exe', None, None, None, None, None, False, 0.0, 2)
            </Action>
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(30), 1, False)
            </Action>
        </Macro>
        <Macro Name="maximaiz aptana" id="26" Expanded="True">
            <Action>
                Window.FindWindow(u'AptanaStudio3.exe', None, None, None, None, None, False, 0.0, 0)
            </Action>
            <Action>
                Window.Maximize()
            </Action>
            <Action>
                Window.BringToFront()
            </Action>
        </Macro>
        <Macro Name="start navicat" id="30" Expanded="True">
            <Action>
                System.Execute(u'C:\\Program Files (x86)\\Navicat Lite 8.2\\navicat.exe', u'', 0, False, 2, u'', False, False)
            </Action>
            <Action>
                EventGhost.Wait(3.0)
            </Action>
            <Action>
                Window.Minimize()
            </Action>
        </Macro>
        <Macro Name="start aptana" id="34" Expanded="True">
            <Action>
                System.Execute(u'C:\\Users\\Eyal\\AppData\\Local\\Aptana Studio 3\\AptanaStudio3.exe', u'', 0, False, 2, u'', False, False)
            </Action>
        </Macro>
    </Folder>
</EventGhost>

Post Reply