Re: MC on Windows and the same stack opened several times

2001-01-29 Thread Kevin Miller

On 29/1/01 6:46 pm, Ernst Michael Reicher <[EMAIL PROTECTED]> wrote:

> but what if windows crashes - MC has not closed - has not deleted the file -
> and wouldn´t open again

Thats a common problem with this type of application: the warning dialog
usually has instructions for deleting the file in that event.

> is there no function in MC to get the running apps??

Not that I know of.

Regards,

Kevin

Kevin Miller <[EMAIL PROTECTED]> 
Runtime Revolution Limited (formerly Cross Worlds Computing).
Tel: +44 (0)131 672 2909.  Fax: +44 (0)1639 830 707.


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.




Re: MC on Windows and the same stack opened several times

2001-01-29 Thread Ernst Michael Reicher

Hi Kevin,
but what if windows crashes - MC has not closed - has not deleted the file -
and wouldn´t open again

is there no function in MC to get the running apps??

Regards,
  Ernst

> From: Kevin Miller <[EMAIL PROTECTED]>
> On 29/1/01 10:32 am, jbv <[EMAIL PROTECTED]> wrote:
> > But if your mc app runs from a CD-ROM, this solution might get a bit
> > tricky...
> > Why not use a global variable for each stack ? At startup you declare
the
> > variable and test its value. If the value is empty, that means the stack
opens
> This would work on the Mac, but on Windows a seperate "instance" of the
> program is run each time you double click a stack or standalone in Windows
> (unless you use DDE and the externals collection to load just one
instance).
> As these instances are completely seperate globals cannot be passed
between
> them.  So you do need to resort to using a file.  If you're using a locked
> disk such as a CD-ROM, you can save the file into the temporary directory
> (the tempname function will always return the path to a file you can write
> to).
> Regards,
> Kevin


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.




Re: MC on Windows and the same stack opened several times

2001-01-29 Thread Ernst Michael Reicher

hm... good idea but.
it sounds like You are working on a Mac...
there MC will only start once and it works - thats not the problem...
but on Windows you can start MC several times and so you can open a stack
several times
and you can´t trap this with an openstack handler
You have to know if in the Windows®-environment a second MC is running

Regards,
  Ernst

> From: jbv <[EMAIL PROTECTED]>
> Subject: Re: MC on Windows and the same stack opened several times
> Date: Mon, 29 Jan 2001 10:32:33 +
> Kevin Miller  :
> > One way you could do it (any platform) is to create a "lock file" that
> > prevents multiple copies being run.  The idea is simple: on loading,
create
> > a text file in a specific place (e.g. the same directory as the stack).
On
> > closing, delete the file.  On startUp, if the file exists, put up an
error
> > message that the program is already running, and exit.
> But if your mc app runs from a CD-ROM, this solution might get a bit
> tricky...
> Why not use a global variable for each stack ? At startup you declare the
> variable and test its value. If the value is empty, that means the stack
opens
>
> for the 1st time. Then put "1" (or any other value) in the global.
> If global isn't empty, prompt an error message then exit.
> Further attempts to launch the same stack will result in error & exit.
>
> I don't have much programming experience with MC, but that's what I'd
> do in HC or OMO, so I guess it should work with MC too...
>
> Of course, the above solution implies that the MC stack remains open from
> the beginning to the end of a work session. If several different stacks
will
> open & close during a work session, and if you still want to prevent
multiple
> copies of each stck to run at the same time, then you'll have to set the
value
>
> of each global back to empty when closing each stack. This can be achieved
> with a "closestack" handler in which the global is set to empty.
> To prevent additional copies to set the global back to empty when closing,
> then you'll have to inhibit the closestack message for other copies of the
> same
> stack. This is easily done by putting a "set lockmessages to true" after
the
> error
> message.
>
> on openstack
> global stackA
> if stackA is not empty then
> --prompt error message
> set lockmessages to true
> -- exit stack
> else
> put 1 into stackA
> end if
> ...
>
>
> on closestack
> global stackA
> put "" into stackA
> ...
>
> Hope that helps.
>
> JB


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.




Re: MC on Windows and the same stack opened several times

2001-01-29 Thread Kevin Miller

On 29/1/01 10:32 am, jbv <[EMAIL PROTECTED]> wrote:

> But if your mc app runs from a CD-ROM, this solution might get a bit
> tricky...
> 
> Why not use a global variable for each stack ? At startup you declare the
> variable and test its value. If the value is empty, that means the stack opens

This would work on the Mac, but on Windows a seperate "instance" of the
program is run each time you double click a stack or standalone in Windows
(unless you use DDE and the externals collection to load just one instance).
As these instances are completely seperate globals cannot be passed between
them.  So you do need to resort to using a file.  If you're using a locked
disk such as a CD-ROM, you can save the file into the temporary directory
(the tempname function will always return the path to a file you can write
to).

Regards,

Kevin

Kevin Miller <[EMAIL PROTECTED]> 
Runtime Revolution Limited (formerly Cross Worlds Computing).
Tel: +44 (0)131 672 2909.  Fax: +44 (0)1639 830 707.


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.




Re: MC on Windows and the same stack opened several times

2001-01-29 Thread jbv



Kevin Miller  :

>
>
> One way you could do it (any platform) is to create a "lock file" that
> prevents multiple copies being run.  The idea is simple: on loading, create
> a text file in a specific place (e.g. the same directory as the stack).  On
> closing, delete the file.  On startUp, if the file exists, put up an error
> message that the program is already running, and exit.
>



But if your mc app runs from a CD-ROM, this solution might get a bit
tricky...

Why not use a global variable for each stack ? At startup you declare the
variable and test its value. If the value is empty, that means the stack opens

for the 1st time. Then put "1" (or any other value) in the global.
If global isn't empty, prompt an error message then exit.
Further attempts to launch the same stack will result in error & exit.

I don't have much programming experience with MC, but that's what I'd
do in HC or OMO, so I guess it should work with MC too...

Of course, the above solution implies that the MC stack remains open from
the beginning to the end of a work session. If several different stacks will
open & close during a work session, and if you still want to prevent multiple
copies of each stck to run at the same time, then you'll have to set the value

of each global back to empty when closing each stack. This can be achieved
with a "closestack" handler in which the global is set to empty.
To prevent additional copies to set the global back to empty when closing,
then you'll have to inhibit the closestack message for other copies of the
same
stack. This is easily done by putting a "set lockmessages to true" after the
error
message.

on openstack
global stackA
if stackA is not empty then
--prompt error message
set lockmessages to true
closestack
end if
...

on closestack
global stackA
put "" into stackA
...



Hope that helps.

JB




Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.




Re: MC on Windows and the same stack opened several times

2001-01-28 Thread Kevin Miller

On 28/1/01 9:25 pm, Ernst Michael Reicher <[EMAIL PROTECTED]> wrote:

> how to prevent that the same stack is opened several times on a Windows
> machine?
> 
> As I remember that was not possible on a Mac but it is on Windows...
> 
> ...how can I get the "running programs" - there was something in HC

One way you could do it (any platform) is to create a "lock file" that
prevents multiple copies being run.  The idea is simple: on loading, create
a text file in a specific place (e.g. the same directory as the stack).  On
closing, delete the file.  On startUp, if the file exists, put up an error
message that the program is already running, and exit.

Regards,

Kevin

Kevin Miller <[EMAIL PROTECTED]> 
Runtime Revolution Limited (formerly Cross Worlds Computing).
Tel: +44 (0)131 672 2909.  Fax: +44 (0)1639 830 707.


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.