close a program - not minimise it

If you have a question or need help, this is the place to be.
longplayer
Posts: 35
Joined: Sun Mar 31, 2013 10:13 am
Location: Dordogne France

close a program - not minimise it

Post by longplayer » Tue Oct 03, 2017 9:56 am

Hi all

Following on from my earlier request for help on close a program and open the next I have another problem. On my Win 7 setup everything works perfectly. Using one key which is mapped as the shutdown program key in the jukebox program. I can open an exe. file ( wincab.exe) to open the program (DW jukebox) Press the key again and the second installation of DW jukebox opens (different music collection) after closing the first. Same again for third time.
I did exactly the same with exact copies of files etc. ( also with new installation of EG) on my home built jukebox which uses Win XP and a problem arises. The example of DW jukebox which is running. only minimises instead of closing and then the second instance opens. As I contininue to press the key I eventually end up with so many minimised programs that the sofware will crash
Any thoughts on what is happening here? how can I solve it.

LONGPLAYER

longplayer
Posts: 35
Joined: Sun Mar 31, 2013 10:13 am
Location: Dordogne France

Re: close a program - not minimise it UPDATE

Post by longplayer » Tue Oct 03, 2017 12:21 pm

Hi all

I just tried using python script ( using kill) to close the DW Jukebox program on Win XP and Win 7. On both I only get minimised and not shut right down.
I am baffled.

LONGPLAYER

User avatar
Neytrino-OnLine
Experienced User
Posts: 100
Joined: Tue Aug 20, 2013 7:14 pm
Location: Moscow, Russia

Re: close a program - not minimise it

Post by Neytrino-OnLine » Tue Oct 03, 2017 12:40 pm

longplayer, why you don't use "Find Window" and "Close" actions, from "Add Action.../Window"?
Image
I can open an exe. file ( wincab.exe) to open the program...
also, why you don't use "Run Application"?
Image
Sin©erely yours, Neytrino.

longplayer
Posts: 35
Joined: Sun Mar 31, 2013 10:13 am
Location: Dordogne France

Re: close a program - not minimise it

Post by longplayer » Tue Oct 03, 2017 1:29 pm

Hi - Neytrino-OnLine

I am already using the RUN APPLICATION TO OPEN THE PROGRAM. Sorry if I did not mention this. I also tried using the 'CLOSE' in window menu but without using the 'FIND A WINDOW' first. Next I will try closing in the manner you suggest.
I seem to think that a problem exists with the amount of time the program takes to close and does not close properly. I will try your suggestions and if this still only minimises the program I will add 'WAIT SOME TIME' to allow the program to close properly before the next one opens.
I will report back.
Many thanks

LONGPLAYER

jachin99
Experienced User
Posts: 646
Joined: Sat Feb 13, 2016 8:39 pm

Re: close a program - not minimise it

Post by jachin99 » Tue Oct 03, 2017 2:12 pm

If you open the command line and run tasklist you should be able to see a list of what is running on your PC. From here find the program you want to close and run a taskkill command on said task from EG. Just a thought

longplayer
Posts: 35
Joined: Sun Mar 31, 2013 10:13 am
Location: Dordogne France

Re: close a program - not minimise it

Post by longplayer » Tue Oct 03, 2017 3:33 pm

Hi jachin09

I have tried all options available to me now in EG and various windows options such as hot-keys and so on. Always the same result. Program minimizes only and does not close. Next program opens doesn't close only minimises, and so on until everything clogs up with too many minimised windows

It looks like the problem is within the jukebox software but I have not had any luck with the DW Jukebox forum either. The program runs without any
close/minimise/maximise buttons at the top right corner- the full cseen is designed to look like a jukebox. Close program is achieved within the program, by what I guess is not a straightfoward windows method. This is actioned by any key ( I use esc. ) which is selected when setting up the installation. I cannot get into the programing of DW Jukebox and I do not think I would achieve much if I did. User settings are acheived through several
ini.files using a text editor.
It is time for me to have a complete rethink and start again.

Many thanks for everyones help and suggestions

I will post again when I get further on.


LONGPLAYER

User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: close a program - not minimise it

Post by yokel22 » Tue Oct 03, 2017 4:51 pm

Try it like jachin09 suggested. A forced taskKill like this should work. You'll have to find out what the name of the 'jukebox.exe' is then replace the "Kodi.exe" in this example with the correct .exe name.
egTaskKill.jpg
taskKill

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc4">
    <Macro Name="Run Command: taskkill /IM Kodi.exe /F" XML_Guid="{D77E9549-F2E2-4E9B-8D9A-29E0505F89E2}" Expanded="True">
        <Action XML_Guid="{32C062C0-3F99-4790-8FEB-C636F7EEDDB5}">
            System.Command(u'taskkill /IM Kodi.exe /F', True, False, u'', True, False, False, True, False)
        </Action>
    </Macro>
</EventGhost>

User avatar
kgschlosser
Site Admin
Posts: 5495
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: close a program - not minimise it

Post by kgschlosser » Tue Oct 03, 2017 6:15 pm

the thing is with this software that he is using it is a dos based program not designed to run on a windows OS you may have to kill the WOW32 (i think it's 32) don't remember it has been so long since I have had to deal with something like this. But also because of the direct access this program uses for the sound card hardware i do not know if killing the process will lead to an unstable system or cause odd behavior like described. the best method would be to use the Find Window action to locate the program and then use the Close action to close it. if this does not work i can key out a line or 2 of code that will destroy the window (kinda sorta but not really closing the window). but this all depends on how the program runs. so if the window is a separate entity from the actual program then either keystroke emulation sent into that window for the program to emulate the keys pressed to exit it or you would have to identify the actual process for the program and not the window and kill that along with the window process
If you like the work I have been doing then feel free to Image

longplayer
Posts: 35
Joined: Sun Mar 31, 2013 10:13 am
Location: Dordogne France

Re: close a program - not minimise it

Post by longplayer » Wed Oct 04, 2017 10:28 am

Hi all.

The DW Jukebox, although origionally a DOS program was re-written as a windows program many years ago ( the DOS version is still available but is a completely different program. ) The thing about my problem of only minimising when I call for a close through EG is that it works perfectly in
WIN 7 using simple key commands but the problem exists only on my WIN XP based jukebox. I have installed the same versions of both EG and DWJ on both machines. I have used taskkill in a python code and will now try your suggestions using action item settings. i will your suggestions a go and report back.
Many thanks for everybody's support in this issue

LONGPLAYER

longplayer
Posts: 35
Joined: Sun Mar 31, 2013 10:13 am
Location: Dordogne France

Re: close a program - not minimise it

Post by longplayer » Thu Oct 05, 2017 3:57 pm

Hi again.
I have now tried those things suggested, ie taskill in action item settings and so on. Still the same result as if I use a simple emulate key action. I have however had another thought. When I assumed that the dwjukebox program was minimising, it of course was partially closing in that any track playing at that point and any songs in the queue all were cancelled as if the program was closed. What remained was a minimise type icon on the bottom bar and if I clicked on this the program starts againas if being opened as a new run. From this I assume that I am only getting a partial shut down in that the graphic is not fully closing. If taskkill can not deal with this then I do not know what will. Any more ideas?

LONGPLAYER

User avatar
kgschlosser
Site Admin
Posts: 5495
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: close a program - not minimise it

Post by kgschlosser » Thu Oct 05, 2017 5:53 pm

as i said before. the software is a dos based program. it has not been fully ported to windows. there is another process that is running and you have to locate it. easiest thing to do it write down all the processes in your task list. start the program and find the ones that were added. then use EG to kill the bugger and see which ones are remaining. and those are the ones you will have to kill as well.
If you like the work I have been doing then feel free to Image

longplayer
Posts: 35
Joined: Sun Mar 31, 2013 10:13 am
Location: Dordogne France

Re: close a program - not minimise it

Post by longplayer » Fri Oct 06, 2017 10:38 am

Hi again KG
I have tried as you suggested and checked all running items in task manager. Then I ran through my event ghost sequence - opened and closed 3 instances of DWJ. As always happens the closed ones only minimise. At this point, looking at task manager again, the only added items are the .ini files of the three minimised DWJ instances. If I try using taskkill in EG to get rid of these nothing happens. At present I use an emulate key action to close DWJ but it makes no difference if I use taskkill for that instead. I tried using emulate key ( which minimises DWJ only and then Taskkill. Still no luck. If I close the events of DWJ .ini files in task manager the minimised DWJ instances close without problem that way. I just cannot seem to make it happen in EG. I do not know what to try next. As I mentioned in previous posts, this problem is only happening on my XP setup, and all is perfect with the same setup on my Win 7 machine.

LONGPLAYER

User avatar
kgschlosser
Site Admin
Posts: 5495
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: close a program - not minimise it

Post by kgschlosser » Fri Oct 06, 2017 2:11 pm

are you using the /T and the /F switches on taskkill?
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5495
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: close a program - not minimise it

Post by kgschlosser » Fri Oct 06, 2017 2:20 pm

you can try this tidbit of code in a python script

Instructions:
create a macro with the Find Window action in it. Set up Find Window to locate your program.
Then Create a Python Script action after the Find Window Action and paste this code into it.
run you're dj program and then right click the macro in the tree and click on execute.

Code: Select all

import win32con
import win32gui

win32gui.PostMessage(eg.lastFoundWindows[0], win32con.WM_DESTROY, 0, 0)
you can check and see if this will work for ya.
If you like the work I have been doing then feel free to Image

longplayer
Posts: 35
Joined: Sun Mar 31, 2013 10:13 am
Location: Dordogne France

Re: close a program - not minimise it

Post by longplayer » Fri Oct 06, 2017 3:02 pm

Hi again KG

I will try that this evening.

Many thanks again.

LONGPLAYER

Post Reply