|
Continue Basic Program After Run |
|
polas (17:06 20/9/2006) monkeyson2 (17:09 20/9/2006) polas (17:16 20/9/2006) polas (17:21 20/9/2006) adrianl (17:31 20/9/2006) polas (18:01 20/9/2006) adrianl (20:14 20/9/2006) polas (21:13 20/9/2006)
|
|
Nick |
Message #80410, posted by polas at 17:06, 20/9/2006 |
Member
Posts: 27
|
Hi all, just a quick question - If I have a basic program, such as
10 *RUN !NetSurf.!Run 20 *ERROR Hello
Then netsurf will load properly, however, any lines after it, e.g. the error hello will not be executed. Is there a command that will execute another program, such as netsurf, and then return to the calling basic program to execute the rest of the lines of code? |
|
[ Log in to reply ] |
|
Phil Mellor |
Message #80411, posted by monkeyson2 at 17:09, 20/9/2006, in reply to message #80410 |
Please don't let them make me be a monkey butler
Posts: 12380
|
Yes, you can use *Filer_Run instead. This has the same effect as doubleclicking the icon in the filer (including opening the application directory or editing the file if you hold down shift).
There's also the Wimp_StartTask SWI, the syntax of which I've entirely forgotten. |
|
[ Log in to reply ] |
|
Nick |
Message #80412, posted by polas at 17:16, 20/9/2006, in reply to message #80411 |
Member
Posts: 27
|
Thats great thanks - exactly what I needed |
|
[ Log in to reply ] |
|
Nick |
Message #80413, posted by polas at 17:21, 20/9/2006, in reply to message #80412 |
Member
Posts: 27
|
Huum, on trying the filer_run will execute the program ok, but after the BASIC program has completed, is there a way to run another program from within BASIC, and then contine execution of the BASIC program after the other program has finished?
Thanks, Nick |
|
[ Log in to reply ] |
|
Adrian Lees |
Message #80414, posted by adrianl at 17:31, 20/9/2006, in reply to message #80411 |
Member
Posts: 1637
|
There's also the Wimp_StartTask SWI, the syntax of which I've entirely forgotten. And a *WimpTask command. |
|
[ Log in to reply ] |
|
Nick |
Message #80415, posted by polas at 18:01, 20/9/2006, in reply to message #80414 |
Member
Posts: 27
|
What about if the task were not a Wimp task, if it were a command line task, would another SWI be able to be used? |
|
[ Log in to reply ] |
|
Adrian Lees |
Message #80416, posted by adrianl at 20:14, 20/9/2006, in reply to message #80415 |
Member
Posts: 1637
|
What about if the task were not a Wimp task, if it were a command line task, would another SWI be able to be used? You can surely use it within a TaskWindow, which is a Wimp task, but you're exposing the single-tasking nature of the RISC OS kernel by trying to run a sub-task completely outside of the Wimp environment. It is possible, but it's very ugly - you have to copy all your data to the top of the application memory, install an exit handler, invoke the subtask, trust it not to trample all over your data and then restore things to where you expect them when the called task terminates.
IIRC there's a module called Twin that does this for you, but that too is ancient legacy.
Yet another consequence of putting the multitasking code in the wrong place; presumably because the people who designed/implemented the Wimp lacked the time/courage to implement the task switching and memory management in the kernel where they rightly belong.
Edit: *WimpTask can run tasks that are not Wimp tasks. The constraint is upon the caller, not the callee.
[Edited by adrianl at 21:16, 20/9/2006] |
|
[ Log in to reply ] |
|
Nick |
Message #80418, posted by polas at 21:13, 20/9/2006, in reply to message #80416 |
Member
Posts: 27
|
Cool, thanks for that - I have ended up using *wimptask, calling it from a wimp program, so it gives the desired effect - Thanks for your help |
|
[ Log in to reply ] |
|
|