Forums list
New topics
Topics list
Search
Help
Login
Register

Messages 1 - 10 of 14
First | Prev. | 1 2 | Next | Last 

Topic: «[SOLVED] Minimising spurious command windows , How to target selectively based on command / title » on forum: Technical Support   Views: 10656
 
David Lomas
Advanced user
 
Posts: 377
Joined: 03/16/2006
Posted: 05/20/2016 16:36:06
 
 
I've started building node/electron apps, and one 'feature' of them is they need a command window in which the `npm start` command runs to set up and start electron. This then displays the main UI window, but leaves the command window hanging around. I've been trying to make it less irritating and I thought if I could minimise it to tray at startup, at least it wouldn't be cluttering the desktop and taskbar. But I'm struggling to get the AWM config right. So far, things I've tried:

- Just create a specific rule - but this targets _any_ npm command, so running `npm publish` elsewhere causes the window to vanish to the system tray.
- Set the 'minimise' to 'Tray', and then get the shortcut to start minimised - I was hoping this would 'trick' it into minimising to tray, but it seems that AWM setting only affects the actual minimise button
- Get the 'start' script to set the window title to something specific (instead of just 'npm') and then target that window caption in the AWM rule, but it seems there's enough delay in changing the window title to mean that AWM has already declared the window to have a different name (it starts as 'npm', then changes to 'AWSManager' after a short delay).

Is there some other way I might grab just that specific console window and get it out of the way?

Tx.
 
Top
Alex Fadeyev
Administrator

Moderator
 
Posts: 1436
Joined: 09/30/2005
Posted: 05/20/2016 20:02:41
 
 
David,

Here are my settings for a similar situation (I have a specific for a CMD window that runs a script building AT setups). Hope you will find them helpful.

 
Top
David Lomas
Advanced user
 
Posts: 377
Joined: 03/16/2006
Posted: 05/20/2016 21:00:54
 
 
OK - bear with me, as this might get a bit messy...

The problem I have is that the command window title is 'npm', and so if I create a rule which matches that, then although it successfully minimised the window I want, it _also_ minimises _any other window_ when I manually run an npm command, as the window title changes to 'npm' during the execution of the npm command! I'm not sure this is supposed to happen, since I have the option 'Minimise → At startup' ticked, and this window definitely hasn't just appeared. It seems AWMs definition of 'at startup' might be a little confused by command windows?

However, that gave me an idea. My 'npm start' script can change the title of the command window, so I changed it to the specific name of the application it's launching - 'AWSManager' - and changed the AWM rule to match that caption instead. But now the 'At startup' option appears to be working, in that the command window is launched with a title of 'npm' and subsequently changed to 'AWSManager', and the rule isn't applied.

I'm not sure the 'At startup' rule _should_ be applied in this scenario, so perhaps it's a bug that is causing other windows which get retitled to 'npm' to be minimised in this way?
 
Top
Alex Fadeyev
Administrator

Moderator
 
Posts: 1436
Joined: 09/30/2005
Posted: 05/23/2016 14:54:01
 
 
David, just a single question: who/what launches the 'npm start' script?

And a suggestion that may give you a clue: open the Log window, enable the logging, run your 'npm start' script and see what rule applies to it.
 
Top
David Lomas
Advanced user
 
Posts: 377
Joined: 03/16/2006
Posted: 05/24/2016 17:04:15
 
 
I'm using a shortcut within RocketDock. The 'task' is C:\Program Files\nodejs\npm.cmd with arguments 'start'. The log window events are attached. Note that the second event is 'Caption Changed', and the command window title does change on screen, but it still shows as 'npm' in the AWM logs for some reason. I guess that's why the rule isn't being applied? I'm also a little confused why there is a second 'New Window' event - is that just how the command prompt works? Note that the 4th event is the chromium window opening, and this also has the same title, but of course the executable is different.

Many thanks,

David.

 
Top
Alex Fadeyev
Administrator

Moderator
 
Posts: 1436
Joined: 09/30/2005
Posted: 05/25/2016 13:11:08
 
 
David, I suppose the fine details that prevent the rule from applying properly may be either in the npm.cmd or in npm itself.

Please try to change your RocketDock shortcut command to the following:

Code
start.exe "AWSManager" /min cmd.exe /C "C:\Program Files\nodejs\npm.cmd" start


It will start the 'npm start' command in a separate CMD window with a title preset to 'AWSManager'. In my tests, the specific rule I created for that title has been applied as expected.
 
Top
David Lomas
Advanced user
 
Posts: 377
Joined: 03/16/2006
Posted: 05/25/2016 14:49:18
 
 
Hi Alex - many thanks, and maybe I'm being a bit dim, but what is 'start.exe'? I don't have such a file on my machine - Win8.1 64bit. Is it a Windows 10 command?
 
Top
Alex Fadeyev
Administrator

Moderator
 
Posts: 1436
Joined: 09/30/2005
Posted: 05/25/2016 18:37:46
 
 
David, sorry, my fault: just 'start', not 'start.exe' :oops:

It's standard CMD command (BTW, I'm still using WinXP :), not Win10).
 
Top
David Lomas
Advanced user
 
Posts: 377
Joined: 03/16/2006
Posted: 05/25/2016 19:47:51
 
 
Die hard!

I'm still stuck though I'm afraid. If I open a command prompt and run this:

   C:\ start "AWSManager" cmd.exe

I get a new command prompt with the correct title and the rule is matched sending it to the tray. Going one step further to this:

   C:\ start "AWSManager" cmd.exe /C "C:\Program Files\nodejs\npm.cmd" start

opens a new command prompt and launches my electron app. But the command prompt is still visible and has the title npm! I'm assuming the npm.cmd script changes the title, and looking at the AWM logs, this appears to be the case. Is it just too fast? AWM shows the rule was matched, but the window doesn't go to the tray - it stays visible...

 
Top
Alex Fadeyev
Administrator

Moderator
 
Posts: 1436
Joined: 09/30/2005
Posted: 05/27/2016 17:01:05
 
 
Die hard indeed!

Please could you enable the statistics collecting, run your Electron app and send us the CenterEvents.log file from the "%AppData%\Actual Tools\Actual Window Manager" folder?

Also, please attach (better if zipped) the "C:\Program Files\nodejs\npm.cmd" script.
 
Top

Messages 1 - 10 of 14
First | Prev. | 1 2 | Next | Last 

User(s) reading this topic
Number of guests: 1, registered members: 0, in total hidden: 0


Forums list
New topics
Topics list
Search
Help
Login
Register