Source language: Translate to:

Minimize and Maximize two applications

General questions about NeoBook

Moderator: Neosoft Support

Minimize and Maximize two applications

Postby ebear » Thu Jun 26, 2014 6:21 am

Hello All,

Maybe a simple one....

I need to minimize and maximize two applications with one button click.
Let say I have the main application who opens via "run" another application. If the main application is minimized or maximized also the second application will do the same.

The second application is started with:
Code: Select all
Run "[PubDir]mods/[EdB.TM_OnClick_TMP.Mod].ebm" "" "RunOnce" "" "[AppId]"
.
Through "[AppId] the following variables exist: [AppID.ProcessID], [AppID.ProcessHandle], [AppID.WinHandle] and [AppID.ExitCode].

Thanks for any response

Eric
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic

Re: Minimize and Maximize two applications

Postby dec » Thu Jun 26, 2014 2:15 pm

Hello,

I think we can achieve it using the Window (application) handle.

I try to add a couple of actions to my npUtil plugin tomorrow Eric. ;)

P.S. Of course another mates can put here other's possible alternatives.
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Minimize and Maximize two applications

Postby dec » Fri Jun 27, 2014 5:50 am

Hello,

Take a look at the new two actions on the npUtil plugin:

+ npMinimizeWindow
+ npRestoreWindow
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Minimize and Maximize two applications

Postby ebear » Fri Jun 27, 2014 1:37 pm

Hello David,

Thanks a lot you're great as always ;-) I think this will be the solution, although I didn't had the time to test it.

Best regards,

Eric
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic

Re: Minimize and Maximize two applications

Postby virger » Mon Jun 30, 2014 9:56 am

Hi:
Again with a trick using "ClipBoard", could serve ...
From Costa Rica / Pura Vida
Next is Holland

APPLICATION 'A'
In StartUp:
setvar "[ClipBoard]" ""

In Shutdown:
TimerStop "TimerAppA"
setvar "[ClipBoard]" "Exit"

APPLICATION 'B'
In StartUp:
setvar "[Win]" "[ClipBoard]"
TimerStart "TimerAppB" "100"

In Shutdown:
TimerStop "TimerAppB"
setvar "[ClipBoard]" "Exit"

IN BOTH APPLICATIONS
TimerAppA for application 'A' and TimerAppB for application 'B'

if "[ClipBoard]" "=" "Exit"
exit "" ""
endif
if "[WindowState]" "<>" "[Win]"
setvar "[ClipBoard]" "[WindowState]"
setvar "[Win]" "[WindowState]"
else
setvar "[WindowState]" "[ClipBoard]"
setvar "[Win]" "[WindowState]"
endif
~~~~~~~~~~~~~
Making History
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 509
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Minimize and Maximize two applications

Postby Gaev » Mon Jun 30, 2014 10:26 am

Eric:

If only one copy of the publications is allowed to run at one time, you might also consider exploiting the facilities of the [Commandline] variable ... from the Help file ...

Prevent multiple copies of this publication from running at the same time: Enable this option to prevent more than one copy of your publication from running at the same time. This is a good idea for most publications, since multiple instances of the same program waste system resources and can confuse users.

You can detect when a user attempts to launch a second instance of your publication by creating a special subroutine called CommandLine_OnChange. NeoBook will automatically execute this subroutine whenever the user attempts to start more than one copy of your publication. For example:

:CommandLine_OnChange

AlertBox "Warning" "An attempt was made to launch a second copy of this app."

Return

The CommandLine_OnChange subroutine is particularly useful if your publication uses the global [CommandLine] variable to load external files at startup. Prior to executing CommandLine_OnChange, NeoBook will automatically update the contents of the [CommandLine] variable with the command line of the second instance. This is useful if you have registered a file type association with Windows, which allows users to start your publication by double clicking on a file matching the association. Windows passes the name of clicked file to your publication via the command line which you can intercept using the [CommandLine] variable.

In particular, note that ...
Prior to executing CommandLine_OnChange, NeoBook will automatically update the contents of the [CommandLine] variable with the command line of the second instance.


So, before you minimize Application A ...
Code: Select all
SetVar "[WindowState]" "Minimized"
... you Run Application B with a special command line parameter like "MaximizeYourself" ... in the :CommandLine_OnChange subroutine of Application B, you check for this parameter ... and if present ...
Code: Select all
SetVar "[WindowState]" "Maxized"


Do something similar in Application B.

Haven't verified it myself; hope it works.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests