RE: [MI-L] Run Application

2006-03-17 Thread Spencer Simpson
The real answer to this question is "By understanding the nature of the
first application".  Depending on that nature, you can either always be
sure, or never be sure. 

Simon doesn't specify the environment his script runs in, so I'm going to
assume it's all native MapInfo (i.e. workspaces or other MapBasic
applications). 

MapBasic applications come in two flavors: "scripts" and "tools".   Which
flavor depends upon the actions performed in a subroutine (called "Main")
built into every application.   
 
When a workspace or MapBasic application issues a Run Mapbasic Application
command, MapInfo takes control away from the "outer" application and gives
it to the "inner" one.   The "inner" application runs its Sub Main, then
MapInfo returns control to the "outer" application. 
 
A "script" runs some commands from its Sub Main and terminates.   If your
program gets to the next line of code after the Run Mapbasic Application
command that invoked the first application, you can be sure it's done.

A "tool"'s Sub Main installs some custom commands in menus and toolbars.
The application goes to sleep, waiting for the user to invoke the custom
commands.  Usually, one of these custom commands unloads the application.
The application isn't "finished" until the user invokes the command that
unloads it.
 
There are some DDE tricks that you can use to test if a "tool" has been
unloaded by the user, or if a particular task has completed, or to force it
to unload, but those mechanisms depend entirely on the application (i.e.
your first application) you want to test for or force closed. 

If you have access to the first application's source code, it's a better
idea to create a modified version that acts like a "script".   I sometimes
code in a "Batch Mode" setting that reads a value from an INI file to
determine whether the app should install menu commands or not.

Hope this helps
Spencer



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Simon Allen
Sent: Friday, March 17, 2006 4:58 AM
To: mapinfo-l@lists.directionsmag.com
Subject: [MI-L] Run Application


Hi
 
I have a script which issues two Run Application commands.
 
How can I ensure that the first application has finished running before
issuing the second command?
 
Ta
 
Simon Allen
Senior GIS Officer
 
[EMAIL PROTECTED]
 
South Gloucestershire Council
01454 863655 (direct)
01454 863855 (fax)
 
http://www.southglos.gov.uk  
 
**
This email and any files transmitted with it from South
Gloucestershire Council are confidential and intended 
solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error 
please notify the South Gloucestershire Council 
Postmaster at the address below.

This footnote also confirms that this email message has 
been swept for the presence of computer viruses.

[EMAIL PROTECTED]
**



___
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l


RE: [MI-L] Run Application

2006-03-17 Thread Driver, Greg 9434
Title: Message



You 
could use DDE to to check that the 1st MapBasic app is running before executing 
the 2nd.  Have a look at the APPINFO.MB sample that comes with MapBasic for 
more information.
 
Greg Driver 
System 
Administrator Applications Support ICT NOT PROTECTIVELY MARKED 

  
  -Original Message-From: Simon Allen 
  [mailto:[EMAIL PROTECTED] Sent: 17 March 2006 
  09:58To: mapinfo-l@lists.directionsmag.comSubject: 
  [MI-L] Run Application
  
  Hi
   
  I have a script 
  which issues two Run Application commands.
   
  How can I ensure 
  that the first application has finished running before issuing the second 
  command?
   
  Ta
   
  Simon 
  Allen
  Senior GIS Officer
   
  [EMAIL PROTECTED]
   
  South Gloucestershire 
  Council
  
  
  01454 863655 (direct)
  01454 863855 (fax)
   
  http://www.southglos.gov.uk
   **
This email and any files transmitted with it from South
Gloucestershire Council are confidential and intended 
solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error 
please notify the South Gloucestershire Council 
Postmaster at the address below.

This footnote also confirms that this email message has 
been swept for the presence of computer viruses.

[EMAIL PROTECTED]
**




Internet communications are not secure and therefore Surrey Police does not accept legal responsibility for the contents of this message.  This email and any attachments may be confidential. They may contain privileged information and are intended for the named addressee (s) only. They must not be distributed without our consent. If you are not the intended recipient, please notify us immediately and delete the message and any attachments from your computer, do not disclose, distribute, or retain this email or any part of it. Unless expressly stated, opinions in this email are those of the individual sender, and not of Surrey Police. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking. Surrey Police reserves the right to monitor all email communications through their networks.


___
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l


RE: [MI-L] Run Application

2006-03-17 Thread Peter Horsbøll Møller





Simon,
 
Some time ago I hade the same request and 
a friendly person (I think it was Bo Thomsen) on MapInfo-L supplied me with 
a Delphi DLL, that could do the trick.
 
The trick is to use a Windows API function 
that can wait for the called application to finish, before returning to the 
caller.
 
Let me know if you are interested and I'll 
send you the snippet that was given to me. As it contains files, I can't send 
them thru MapInfo-L
 


Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
5260 Odense S.
Denmark
 
Tel   + 45 6311 4900
Dir   +45 6311 4908
Mob +45 5156 1045
Fax  + 45 6311 4949
E-mail [EMAIL PROTECTED]
http://www.cowi.dk


From: [EMAIL PROTECTED] 
on behalf of Terry McDonnellSent: Fri 17-Mar-06 12:08To: 
Simon Allen; [EMAIL PROTECTED]Subject: RE: [MI-L] Run 
Application

Simon
 
Not sure that the 1st will have finished before the 2nd 
begins?  Don't know myself.
 
The first 
could set like a semaphore flag, in a table, and the second could wait for this 
flag to have been set before running.  e.g.
 
Dim 
llGoAhead as logical
 
llGoAhead = 
FALSE
Run 
application "App1"  ' When this app finishes it sets flag 
SemaTable.LSEMFLAG 
 
Do while not 
llGoAhead
  Select LSEMFLAG from SemaTable into 
csrTemp
  
llGoAhead = csrTemp.LSEMFLAG  
Loop

Run 
application "App2"
 
This might 
not be necessary if the apps run discretely but HTH
 
Terry
 

From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Simon 
AllenSent: 17 March 2006 10:46To: Terry 
McDonnellSubject: [MI-L] Run Application


Hi
 
I have a script 
which issues two Run Application commands.
 
How can I ensure 
that the first application has finished running before issuing the second 
command?
 
Ta
 
Simon 
Allen
Senior GIS Officer
 
[EMAIL PROTECTED]
 
South Gloucestershire 
Council


01454 863655 (direct)
01454 863855 (fax)
 
http://www.southglos.gov.uk
 **
This email and any files transmitted with it from South
Gloucestershire Council are confidential and intended 
solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error 
please notify the South Gloucestershire Council 
Postmaster at the address below.

This footnote also confirms that this email message has 
been swept for the presence of computer viruses.

[EMAIL PROTECTED]
**

___
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l


RE: [MI-L] Run Application

2006-03-17 Thread Terry McDonnell



Simon
 
Not sure that the 1st will have finished before the 2nd 
begins?  Don't know myself.
 
The first 
could set like a semaphore flag, in a table, and the second could wait for this 
flag to have been set before running.  e.g.
 
Dim 
llGoAhead as logical
 
llGoAhead = 
FALSE
Run 
application "App1"  ' When this app finishes it sets flag 
SemaTable.LSEMFLAG 
 
Do while not 
llGoAhead
  Select LSEMFLAG from SemaTable into 
csrTemp
  
llGoAhead = csrTemp.LSEMFLAG  
Loop

Run 
application "App2"
 
This might 
not be necessary if the apps run discretely but HTH
 
Terry
 

From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Simon 
AllenSent: 17 March 2006 10:46To: Terry 
McDonnellSubject: [MI-L] Run Application


Hi
 
I have a script 
which issues two Run Application commands.
 
How can I ensure 
that the first application has finished running before issuing the second 
command?
 
Ta
 
Simon 
Allen
Senior GIS Officer
 
[EMAIL PROTECTED]
 
South Gloucestershire 
Council


01454 863655 (direct)
01454 863855 (fax)
 
http://www.southglos.gov.uk
 **
This email and any files transmitted with it from South
Gloucestershire Council are confidential and intended 
solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error 
please notify the South Gloucestershire Council 
Postmaster at the address below.

This footnote also confirms that this email message has 
been swept for the presence of computer viruses.

[EMAIL PROTECTED]
**

___
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l


RE: MI-L Run Application

2005-09-16 Thread David Reid
Once you find how easy it is to run other programs you might want to have a
look at User Menu by Christophe Barbier. I believe it is available from the
Directions Tool crib.

It allows you to add very customizable menus to the menu bar which can do
anything from open tab files, to run DOS batch files and open other
programs. User menus is managed by a user editable .ini file.

I don’t know what was handier than a shirt pocket before it came along, but
UserMenus is handier :)

I run DOS batch files that cause Access to do things, Open various Excel
files which I use for reference etc. just to name a few.

HTH

Dave



-Original Message-
From: Alan Gunn [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 16, 2005 9:39 AM
To: mapinfo-l@lists.directionsmag.com
Subject: MI-L Run Application


Hey, me again. 

Is it possible to start another non-MI or non-MB application from a
mapbasic application? For example, I want to have a button on my tool
bar that will launch an access database outside of MI.

I have tried a few things but all I get is "could not execute - program
could not be run". 

Any hints?

Thanks, 

Alan


-- 

Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.1/104 - Release Date: 09/16/2005
 

-- 
Outgoing mail is certified Virus Free
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.1/104 - Release Date: 09/16/2005
 


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 17911



RE: MI-L Run Application

2005-09-16 Thread Jakob Lanstorp
use msaccess instead of access and normally you do not need the path to
access.

/J


-Original Message-
From: Alan Gunn [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 16, 2005 5:14 PM
To: Jakob Lanstorp; mapinfo-l@lists.directionsmag.com
Subject: RE: MI-L Run Application


Yeah, I was checking that out, but it isn't working for me. How would
the notepad.exe know where the file is? In my example, would I use 
Run Program "Access.exe C:\TestDB\DataBasetest.mdb"
Or would it be something like
Run Program "Access.exe DataBasetest"
Neither of those seems to work.
Thanks for the help. I am also a big fan of the help menu.:) alan

-Original Message-
From: Jakob Lanstorp [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 16, 2005 10:03 AM
To: Alan Gunn
Cc: mapinfo-l@lists.directionsmag.com
Subject: RE: MI-L Run Application

>From the MapBasic help:

The following Run Program statement runs the Windows text editor,
"Notepad," and instructs Notepad to open the text file THINGS.2DO. 

 Run Program  "notepad.exe  things.2do" 

The following statement issues a DOS command. 

 Run Program "command.com /c  dir c:\mapinfo\ > C:\temp\dirlist.txt"

TGIF
Jakob


Jakob Lanstorp
Senior Consultant
Geographical Information & IT

COWI A/S
Odensevej 95
5260 Odense S.

Tel   +45 6311 4900
Fax  +45 6311 4949
Mob +45 5050 8087
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
http://www.cowi.com


-Original Message-
From: Alan Gunn [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 16, 2005 4:39 PM
To: mapinfo-l@lists.directionsmag.com
Subject: MI-L Run Application


Hey, me again. 

Is it possible to start another non-MI or non-MB application from a
mapbasic application? For example, I want to have a button on my tool
bar that will launch an access database outside of MI.

I have tried a few things but all I get is "could not execute - program
could not be run". 

Any hints?

Thanks, 

Alan



-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 17910



RE: MI-L Run Application

2005-09-16 Thread Dewen Hou

Try this:  "C:\Program Files\Microsoft Office\Office\MSAccess.exe" "C:\TestDB\DataBasetest.mdb"


">"Alan Gunn" <[EMAIL PROTECTED]>








"Alan Gunn" <[EMAIL PROTECTED]> 
09/16/2005 10:14 AM






To
"Jakob Lanstorp" <[EMAIL PROTECTED]>, 


cc



Subject
RE: MI-L Run Application








Yeah, I was checking that out, but it isn't working for me. How would
the notepad.exe know where the file is? In my example, would I use 
Run Program "Access.exe C:\TestDB\DataBasetest.mdb"
Or would it be something like
Run Program "Access.exe DataBasetest"
Neither of those seems to work.
Thanks for the help. I am also a big fan of the help menu.:)
alan

-Original Message-
From: Jakob Lanstorp [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 16, 2005 10:03 AM
To: Alan Gunn
Cc: mapinfo-l@lists.directionsmag.com
Subject: RE: MI-L Run Application

>From the MapBasic help:

The following Run Program statement runs the Windows text editor,
"Notepad," and instructs Notepad to open the text file THINGS.2DO. 

 Run Program  "notepad.exe  things.2do" 

The following statement issues a DOS command. 

 Run Program "command.com /c  dir c:\mapinfo\ > C:\temp\dirlist.txt"

TGIF
Jakob


Jakob Lanstorp
Senior Consultant
Geographical Information & IT

COWI A/S
Odensevej 95
5260 Odense S.

Tel   +45 6311 4900
Fax  +45 6311 4949
Mob +45 5050 8087
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
http://www.cowi.com


-Original Message-
From: Alan Gunn [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 16, 2005 4:39 PM
To: mapinfo-l@lists.directionsmag.com
Subject: MI-L Run Application


Hey, me again. 

Is it possible to start another non-MI or non-MB application from a
mapbasic application? For example, I want to have a button on my tool
bar that will launch an access database outside of MI.

I have tried a few things but all I get is "could not execute - program
could not be run". 

Any hints?

Thanks, 

Alan


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 17908





RE: MI-L Run Application

2005-09-16 Thread Alan Gunn
Yeah, I was checking that out, but it isn't working for me. How would
the notepad.exe know where the file is? In my example, would I use 
Run Program "Access.exe C:\TestDB\DataBasetest.mdb"
Or would it be something like
Run Program "Access.exe DataBasetest"
Neither of those seems to work.
Thanks for the help. I am also a big fan of the help menu.:)
alan

-Original Message-
From: Jakob Lanstorp [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 16, 2005 10:03 AM
To: Alan Gunn
Cc: mapinfo-l@lists.directionsmag.com
Subject: RE: MI-L Run Application

>From the MapBasic help:

The following Run Program statement runs the Windows text editor,
"Notepad," and instructs Notepad to open the text file THINGS.2DO. 

 Run Program  "notepad.exe  things.2do" 

The following statement issues a DOS command. 

 Run Program "command.com /c  dir c:\mapinfo\ > C:\temp\dirlist.txt"

TGIF
Jakob


Jakob Lanstorp
Senior Consultant
Geographical Information & IT

COWI A/S
Odensevej 95
5260 Odense S.

Tel   +45 6311 4900
Fax  +45 6311 4949
Mob +45 5050 8087
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
http://www.cowi.com


-Original Message-
From: Alan Gunn [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 16, 2005 4:39 PM
To: mapinfo-l@lists.directionsmag.com
Subject: MI-L Run Application


Hey, me again. 

Is it possible to start another non-MI or non-MB application from a
mapbasic application? For example, I want to have a button on my tool
bar that will launch an access database outside of MI.

I have tried a few things but all I get is "could not execute - program
could not be run". 

Any hints?

Thanks, 

Alan


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 17908



RE: MI-L Run Application

2005-09-16 Thread Jakob Lanstorp
>From the MapBasic help:

The following Run Program statement runs the Windows text editor,
"Notepad," and instructs Notepad to open the text file THINGS.2DO. 

 Run Program  "notepad.exe  things.2do" 

The following statement issues a DOS command. 

 Run Program "command.com /c  dir c:\mapinfo\ > C:\temp\dirlist.txt"

TGIF
Jakob


Jakob Lanstorp
Senior Consultant
Geographical Information & IT

COWI A/S
Odensevej 95
5260 Odense S.

Tel   +45 6311 4900
Fax  +45 6311 4949
Mob +45 5050 8087
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
http://www.cowi.com


-Original Message-
From: Alan Gunn [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 16, 2005 4:39 PM
To: mapinfo-l@lists.directionsmag.com
Subject: MI-L Run Application


Hey, me again. 

Is it possible to start another non-MI or non-MB application from a
mapbasic application? For example, I want to have a button on my tool
bar that will launch an access database outside of MI.

I have tried a few things but all I get is "could not execute - program
could not be run". 

Any hints?

Thanks, 

Alan


-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 17907