Article 207 of comp.sys.acorn: Path: rusmv1!ira.uka.de!sol.ctr.columbia.edu!lll-winken!uunet!mcsun!ukc!acorn!RMokady From: RMokady@acorn.co.uk (Ran Mokady) Newsgroups: comp.sys.acorn Subject: Re: Creation of a Taskwindow Message-ID: <6846@acorn.co.uk> Date: 6 May 91 00:26:32 GMT References: <1744@nlcvx.convex.nl> Sender: rmokady@acorn.co.uk Distribution: comp Organization: Acorn Computers Ltd, Cambridge, England Lines: 60 In article <1744@nlcvx.convex.nl> boerhout@convex.nl (Jan Boerhout) writes: >I want to be able to start a program in a task window from an obey file >without having to create a task window manually using !Edit and without >having to start my program manually in this window. > >Has somebody figured out how to do this? I don't think there is a way of doing it properly, but you could try the following BASIC program: REM >Task SYS "OS_GetEnv" TO command$ D%=INSTR(command$,"$") IF D%=0 THEN ERROR EXT 0,"Missing TaskWindow command" DIM block% 256, task% 5 $task%="TASK" block%!0=36 block%!12=0 block%!16=&808c5 $(block%+20)="ShellCLI_Task"+CHR$0 SYS "Wimp_Initialise",200,!task%,"TaskWindow" SYS "Wimp_SendMessage",17,block%,0 SYS "OS_Byte",138,0,13 FOR I%=D%+1 TO LEN(command$) SYS "OS_Byte",138,0,ASC(MID$(command$,I%,1)) NEXT I% SYS "OS_Byte",138,0,13 REPEAT SYS "Wimp_Poll",0,block% TO R%:UNTIL R%=0 END Save it as "Task" in your library directory, and then in your obey file put: Task $ Where is the command you want executed in the task window. For this to work you have to have !Edit and the TaskWindow modules loaded. The BASIC program sends a message to !Edit telling it to open a TaskWindow, it then inserts the anything following the $ on the command used to start it into the keyboard buffer, so that it is picked up by !Edit as input for the task. The first OS_Byte 138,0,13 is to reduce the risk of something being typed in from the keyboard before it has a chance to insert the codes into the buffer, but it is still not perfect if you happen to be typing things in while it is running. The last line before the END is used to enable you to have two *Task commands one after the other, if it is missed out, two task windows will be opened, but both commands will be run in the same window. If anyone knows of a better way to do this, please let me know ! Ran.