Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #530 > unrolled thread

Starting a program from a taskwindow

Started byThomas Milius <Thomas-Milius@t-online.de>
First post2011-07-08 20:03 +0200
Last post2011-07-16 06:38 +0200
Articles 15 — 7 participants

Back to article view | Back to comp.sys.acorn.programmer


Contents

  Starting a program from a taskwindow Thomas Milius <Thomas-Milius@t-online.de> - 2011-07-08 20:03 +0200
    Re: Starting a program from a taskwindow Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2011-07-08 19:44 +0100
      Re: Starting a program from a taskwindow druck <news@druck.org.uk> - 2011-07-09 09:42 +0100
    Re: Starting a program from a taskwindow druck <news@druck.org.uk> - 2011-07-09 09:40 +0100
      Re: Starting a program from a taskwindow James Lampard <dontreplytothis@mailinator.com> - 2011-07-09 01:55 -0700
        Re: Starting a program from a taskwindow druck <news@druck.org.uk> - 2011-07-09 14:21 +0100
          Re: Starting a program from a taskwindow Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-07-13 06:07 +0200
    Re: Starting a program from a taskwindow James Lampard <dontreplytothis@mailinator.com> - 2011-07-09 01:41 -0700
      Re: Starting a program from a taskwindow Thomas Milius <Thomas-Milius@t-online.de> - 2011-07-10 11:07 +0200
    Re: Starting a program from a taskwindow Vince M Hudd <vinceh@softrock.co.uk> - 2011-07-10 11:56 +0100
    Re: Starting a program from a taskwindow "Ste (news)" <steve@revi11.plus.com> - 2011-07-11 11:34 +0100
      Re: Starting a program from a taskwindow Thomas Milius <Thomas-Milius@t-online.de> - 2011-07-11 22:26 +0200
      Re: Starting a program from a taskwindow Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-07-13 06:16 +0200
        Re: Starting a program from a taskwindow "Ste (news)" <steve@revi11.plus.com> - 2011-07-14 15:56 +0100
          Re: Starting a program from a taskwindow Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-07-16 06:38 +0200

#530 — Starting a program from a taskwindow

FromThomas Milius <Thomas-Milius@t-online.de>
Date2011-07-08 20:03 +0200
SubjectStarting a program from a taskwindow
Message-ID<1bf8b0ef51.Thomas@thomas-milius.t-online.de>
What is the best way to start program with WIMP interaction with parameters
from another program running as task window?

The task window should pause until the child program terminates.

Wimp_StartTask doesn't seem to work if used within a taskwindow.

Filer_Run would be an alternative but doesn't allow passing parameters and
the "parent" task would run all the time in background except I would do an
OS_Upcall 6 to it and the child task would fill the poll word at its end. I
also would have to allocate RMA space by the parent task (which in my case
could be a BASIC program).

Many thanks for ideas in advance.

Best Regards

Thomas Milius

[toc] | [next] | [standalone]


#531

FromJeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk>
Date2011-07-08 19:44 +0100
Message-ID<mpro.lo12qq00dq3wg006s@wingsandbeaks.org.uk.invalid>
In reply to#530
Thomas Milius <Thomas-Milius@t-online.de> wrote:

> What is the best way to start program with WIMP interaction with
> parameters from another program running as task window?

What's wrong with *Run <childprogram> parm1 parm2 ....

> The task window should pause until the child program terminates.

Perhaps the program that issued the *Run needs to wait for some condition
that the run program will set when it ends?


> Filer_Run would be an alternative but doesn't allow passing parameters

The main program could conceivably create a tiny Obey file, perhaps in the
RAM disk, containing the specific code to start that instance of the
childprogram, then issue a Filer_Run for the temporary Obey file.



-- 
Jeremy C B Nicoll - my opinions are my own.

Email sent to my from-address will be deleted. Instead, please reply
to newsreplyaaa@wingsandbeaks.org.uk replacing "aaa" by "284".  

[toc] | [prev] | [next] | [standalone]


#535

Fromdruck <news@druck.org.uk>
Date2011-07-09 09:42 +0100
Message-ID<iv948t$sc8$2@dont-email.me>
In reply to#531
On 08/07/2011 19:44, Jeremy Nicoll - news posts wrote:
> Thomas Milius<Thomas-Milius@t-online.de>  wrote:
>
>> What is the best way to start program with WIMP interaction with
>> parameters from another program running as task window?
>
> What's wrong with *Run<childprogram>  parm1 parm2 ....

Not if it's a wimp task. Make sure you have saved all your work, get a 
task window up and try running an application like that. You may be able 
to get out of it, you may have to press reset.

---druck

[toc] | [prev] | [next] | [standalone]


#533

Fromdruck <news@druck.org.uk>
Date2011-07-09 09:40 +0100
Message-ID<iv945f$sc8$1@dont-email.me>
In reply to#530
On 08/07/2011 19:03, Thomas Milius wrote:
> What is the best way to start program with WIMP interaction with parameters
> from another program running as task window?

You can't run any wimp program from within a task window. The wimp will 
get very confused and it may crash the desktop.

> The task window should pause until the child program terminates.

Task Window tasks cant suspend them selves, thats under the control of 
the task window manager (Edit, Zap, GraphTask, etc)

> Wimp_StartTask doesn't seem to work if used within a taskwindow.
>
> Filer_Run would be an alternative but doesn't allow passing parameters and
> the "parent" task would run all the time in background except I would do an
> OS_Upcall 6 to it and the child task would fill the poll word at its end. I
> also would have to allocate RMA space by the parent task (which in my case
> could be a BASIC program).

I doubt that would work.

The easiest and best option is to not to use a taskwindow, recode the 
program as wimp task working on null events from a wimp_poll idle. It is 
then free to start wimpt tasks and wait for them.

The only alternative would be to write a background monitoring wimp task 
which waited for a message from the task window task, and then launched 
a wimp application. Task window tasks can send messages, but they can't 
receive them, so to notice the child terminating you would have to use 
another mechanism such as a system variable, but this has concurrency 
issues.

---druck

[toc] | [prev] | [next] | [standalone]


#536

FromJames Lampard <dontreplytothis@mailinator.com>
Date2011-07-09 01:55 -0700
Message-ID<632bba47-6042-4d80-aef5-fa402a88b43c@e21g2000vbz.googlegroups.com>
In reply to#533
On Jul 9, 9:40 am, druck <n...@druck.org.uk> wrote:
> On 08/07/2011 19:03, Thomas Milius wrote:
>
> > What is the best way to start program with WIMP interaction with parameters
> > from another program running as task window?
>
> You can't run any wimp program from within a task window. The wimp will
> get very confused and it may crash the desktop.
>

Yes you can, just press CTRL+F12 then type:

Basic
SYS "Wimp_StartTask","<Paint$Dir>"

and Paint will start up - from a taskwindow.

--
James.
To reply use james underline lampard at talk 21 dot com

[toc] | [prev] | [next] | [standalone]


#537

Fromdruck <news@druck.org.uk>
Date2011-07-09 14:21 +0100
Message-ID<iv9kk5$k2u$1@dont-email.me>
In reply to#536
On 09/07/2011 09:55, James Lampard wrote:
> On Jul 9, 9:40 am, druck<n...@druck.org.uk>  wrote:
>> On 08/07/2011 19:03, Thomas Milius wrote:
>>
>>> What is the best way to start program with WIMP interaction with parameters
>>> from another program running as task window?
>>
>> You can't run any wimp program from within a task window. The wimp will
>> get very confused and it may crash the desktop.
>>
>
> Yes you can, just press CTRL+F12 then type:
>
> Basic
> SYS "Wimp_StartTask","<Paint$Dir>"
>
> and Paint will start up - from a taskwindow.

That's Wimp_StartTask which starts a program asychronously, the point I 
am making is about *Run as the OP wanted a synchronus (blocking) run of 
a wimp app.

---druck

[toc] | [prev] | [next] | [standalone]


#553

FromRick Murray <heyrickmail-usenet@yahoo.co.uk>
Date2011-07-13 06:07 +0200
Message-ID<4e1d19f7$0$18802$ba4acef3@reader.news.orange.fr>
In reply to#537
On 09/07/2011 15:21, druck wrote:

> That's Wimp_StartTask which starts a program asychronously, the point I
> am making is about *Run as the OP wanted a synchronus (blocking) run of
> a wimp app.

Exactly. The "parent" application would want to suspend its activity 
until the child application finishes. The most sane way to handle this 
would be:

Recode the parent as a wimp task. Even as a big chunk of code, you can 
get going by Wimp_Initialise at the start, and Wimp_Poll frequently...

For the OP's wishes:

   Wimp_StartTask to fire off the child task. Keep a note of the
   handle passed in R0. If the child makes it to Wimp_Poll, then your
   R0 will be the task handle. Otherwise zero.

   Sit in Wimp_PollIdle awaiting the Wimp message Message_TaskCloseDown,
   so you know when your child application terminates - the Wimp bodges
   things so +4 is the handle of the exiting task (i.e. your child task
   appears to have sent this message itself).

   Carry on...


Best wishes,

Rick.

[toc] | [prev] | [next] | [standalone]


#534

FromJames Lampard <dontreplytothis@mailinator.com>
Date2011-07-09 01:41 -0700
Message-ID<c91a6fb7-7fb6-4306-be23-e3ea258b8798@b2g2000vbo.googlegroups.com>
In reply to#530
On Jul 8, 7:03 pm, Thomas Milius <Thomas-Mil...@t-online.de> wrote:
> What is the best way to start program with WIMP interaction with parameters
> from another program running as task window?
>
> The task window should pause until the child program terminates.
>
> Wimp_StartTask doesn't seem to work if used within a taskwindow.
>

Wimp_StartTask works fine here from within a taskwindow and so does
its related star command *wimptask
Could you be more specific in the way that it doesn't seem to work?

On Jul 8, 7:44 pm, Jeremy Nicoll - news posts
<jn.nntp.scrap...@wingsandbeaks.org.uk> wrote:
> Thomas Milius <Thomas-Mil...@t-online.de> wrote:
> > What is the best way to start program with WIMP interaction with
> > parameters from another program running as task window?
>
> What's wrong with *Run <childprogram> parm1 parm2 ....
>

The newly run program would then replace the currently running task -
and no return to it would be possible

--
James.
To reply use james underline lampard at talk 21 dot com

[toc] | [prev] | [next] | [standalone]


#539

FromThomas Milius <Thomas-Milius@t-online.de>
Date2011-07-10 11:07 +0200
Message-ID<728287f051.Thomas@thomas-milius.t-online.de>
In reply to#534
In message <c91a6fb7-7fb6-4306-be23-e3ea258b8798@b2g2000vbo.googlegroups.com>
          James Lampard <dontreplytothis@mailinator.com> wrote:

> On Jul 8, 7:03 pm, Thomas Milius <Thomas-Mil...@t-online.de> wrote:
> > What is the best way to start program with WIMP interaction with
> > parameters from another program running as task window?
> > 
> > The task window should pause until the child program terminates.
> > 
> > Wimp_StartTask doesn't seem to work if used within a taskwindow.
> >
> 
> Wimp_StartTask works fine here from within a taskwindow and so does
> its related star command *wimptask
> Could you be more specific in the way that it doesn't seem to work?
> 

Ok. I shall give a short overview about what I am trying to do. I am writing
a couple of small programs allowing to interact with USB surf sticks and
classical modems (Making a PPP connection, managing the phone numbers stored
on the SIM card, unlocking the SIM card and so on). Of course I could have
done in C but I am the opinion it would easier for other people to expand and
modify the code later if I am using BASIC. I split the programs into two
groups. One group are simple BASIC programs which are obtaining parameters
and are directly interacting with the surf stick (Eg. Preparing an internet
connection, unlocking the SIM card). However on top of them there are more
comfortable programs written in AppBASIC which are calling the other small
progams as child tasks but using the Taskwindow command. In general this
works fine. However there is the situation that eg. you want to make an
internet connection and yes the internet connection preparing program in
task window running as child task detects that the SIM needs to be unlocked.
It would be nice now to open an AppBASIC program showing you a form to enter
your PIN. And at this point I am failing in the moment. Ok the longer I
thinking about I fear I made a "small" mistake inside my thoughts. I am
providing two ways of entering the PIN. One directly inside task window in
case that desktop is not present and one within the AppBASIC program if
desktop is present. I fear my fault is that I am checking not only for
desktop but also for being a task window and exactly this is the program if
running as child task using TaskWindow. However I am relatively sure that I
made also earlier an attempt to use Wimp_StartTask and this failed also.
AFAIR the task window showed "silly" effects and I am in doubt whether the
AppBASIC task started at all. Filer_Run worked ok at that point but it has
the limitations that no parameters can be passed in the moment.

So the chain in detail is:

AppBASIC -> TW Childtask in BASIC -> Swapped out by Steve Revills Routines
and replaced by another program in BASIC -> calling AppBASIC for PIN
entering.

Making an Upcall 6 should be allowed in general for PipeFS won't work else
with Taskwindows but it does work and Upcall 6 is designed exactly for this
purpose.

Best Regards

Thomas Milius

[toc] | [prev] | [next] | [standalone]


#540

FromVince M Hudd <vinceh@softrock.co.uk>
Date2011-07-10 11:56 +0100
Message-ID<mpro.lo46ev004g8ol03uw.vinceh@softrock.co.uk>
In reply to#530
Thomas Milius <Thomas-Milius@t-online.de> wrote:


> What is the best way to start program with WIMP interaction withparameters
> from another program running as task window?

You should use Wimp_StartTask for this part.

> The task window should pause until the child program terminates.

And try WaitUntil for this - the next line after you start your child app
would be something like:

*WaitUntil -s !Running Name-of-child-app

The -s switch causes WaitUntil itself to single task, for when it's issued
from a TaskObey file. It should work from a task window as well.

!Running means not running, and Name-of-child-app would be the name your
child application registers with the WIMP.

WaitUntil just goes into a continual loop, ending only when the condition is
satisfied - in this case, waiting until the child app is no longer running.

http://www.softrock.co.uk/products/waituntil.html

-- 
Soft Rock Software:                   http://www.softrock.co.uk
Vince M Hudd:                         http://misc.vinceh.com/about-vinceh/

[toc] | [prev] | [next] | [standalone]


#544

From"Ste (news)" <steve@revi11.plus.com>
Date2011-07-11 11:34 +0100
Message-ID<51f1135033steve@revi11.plus.com>
In reply to#530
In article <1bf8b0ef51.Thomas@thomas-milius.t-online.de>,
   Thomas Milius <Thomas-Milius@t-online.de> wrote:
> What is the best way to start program with WIMP interaction with parameters
> from another program running as task window?

For completeness, nobody seems to have mentioned *StartDesktopTask, which is
another alternative.

Ta,

Steve

-- 
Steve Revill @ Home
Note: All opinions expressed herein are my own.

[toc] | [prev] | [next] | [standalone]


#545

FromThomas Milius <Thomas-Milius@t-online.de>
Date2011-07-11 22:26 +0200
Message-ID<848549f151.Thomas@thomas-milius.t-online.de>
In reply to#544
In message <51f1135033steve@revi11.plus.com>
          "Ste (news)" <steve@revi11.plus.com> wrote:

> In article <1bf8b0ef51.Thomas@thomas-milius.t-online.de>,
>    Thomas Milius <Thomas-Milius@t-online.de> wrote:
> > What is the best way to start program with WIMP interaction with
> > parameters from another program running as task window?
> 
> For completeness, nobody seems to have mentioned *StartDesktopTask, which
> is another alternative.
> 

Very useful hint. I wasn't aware of this command. Seems to be an alternative
to FilerHRun but inbuild inside OS. Many thanks Steve.

Best Regards

Thomas Milius

[toc] | [prev] | [next] | [standalone]


#554

FromRick Murray <heyrickmail-usenet@yahoo.co.uk>
Date2011-07-13 06:16 +0200
Message-ID<4e1d1c38$0$30766$ba4acef3@reader.news.orange.fr>
In reply to#544
On 11/07/2011 12:34, Ste (news) wrote:

> For completeness, nobody seems to have mentioned *StartDesktopTask, which is
> another alternative.

Only on more recent systems.

   *StartDesktopTask Meh
   File 'StartDesktopTask' not found
   *

RISC OS 3.70 (with and without the !Boot gubbins).


Best wishes,

Rick.

[toc] | [prev] | [next] | [standalone]


#565

From"Ste (news)" <steve@revi11.plus.com>
Date2011-07-14 15:56 +0100
Message-ID<51f2b6d8f4steve@revi11.plus.com>
In reply to#554
In article <4e1d1c38$0$30766$ba4acef3@reader.news.orange.fr>,
   Rick Murray <heyrickmail-usenet@yahoo.co.uk> wrote:
> Only on more recent systems.
>
>    *StartDesktopTask Meh
>    File 'StartDesktopTask' not found
>    *
>
> RISC OS 3.70 (with and without the !Boot gubbins).

On a completely (ahem) unrelated note, RISC OS 4 is now 12 years old... And
that's a "more recent" system.

:)

Steve

-- 
Steve Revill @ Home
Note: All opinions expressed herein are my own.

[toc] | [prev] | [next] | [standalone]


#568

FromRick Murray <heyrickmail-usenet@yahoo.co.uk>
Date2011-07-16 06:38 +0200
Message-ID<4e2115c1$0$18778$ba4acef3@reader.news.orange.fr>
In reply to#565
On 14/07/2011 16:56, Ste (news) wrote:

>> RISC OS 3.70 (with and without the !Boot gubbins).
> On a completely (ahem) unrelated note, RISC OS 4 is now 12 years old... And
> that's a "more recent" system.

I see no reason to upgrade what works just fine.

[yes, by that same token, I'm also using XP on the <cough><splutter>]


> :)

Indeed.


Best wishes,

Rick.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.acorn.programmer


csiph-web