Many thanks for the prompt reply.
I dug out my ancient AmigaDOS manuals this morning. (Found them in a cupboard neatly tied up for recycling! I must have had second thoughts a while back.)
After a bit of messing about, I finally solved it this way:
Created a script file as S:AMOS_to_Ced:
.k file/a
stack 10000
ced <file> -keepio
This takes a file name as a parameter, sets the stack and calls Cygnus Ed with the file name and the -keepio parameter. The -keepio parameter is what ensures that it won't return to the callers (in this case, the script file followed by the AMOS Exec call from the program) until the user has finished editing and saving or discarding the file.
Changed the source for Resource_Bank_Maker.AMOS in three places as follows (changes highlighted in orange):
1 - In the initialisation, sets the new command string for the Exec call:
' Default CLI ASCII editor for DBL programs
' ~~~~~~~~~~~~~~~~~~~~~
'EDNAME$="C:ED {f}"
' other example (CygnusED)
EDNAME$="Execute S:AMOS_to_Ced {f}"
2 - Uses the new command string (without checking it!):
Procedure MN_PREDIT
If Length(100+NPROG)>0
F$="RAM:DBLtemp.ASC"
Open Out 1,F$
Trap Ssave 1,Start(100+NPROG) To Start(100+NPROG)+Length(100+NPROG)
If Errtrap : Gosub ERR : Trap Kill F$ : Pop Proc : End If
Trap Close 1
' Original checks on EX$ removed as now hard-coded:
Dialog Freeze
Amos To Back
I=Instr(EDNAME$,"{f}")
EX$=Left$(EDNAME$-"{f}",I-1)+F$+Right$(EDNAME$,Len(EDNAME$)-I-2)
Exec EX$
Amos To Front
Dialog Unfreeze
Erase 100+NPROG
Open In 1,F$ : SZ=Lof(1)
If SZ
Reserve As Work 100+NPROG,SZ
Trap Sload 1 To Start(100+NPROG),SZ
Else
Reserve As Work 100+NPROG,1
Poke Start(100+NPROG),32
End If
PRG$(NPROG)=Left$(PRG$(NPROG),16)+Right$(" "+Str$(SZ),7)
If Errtrap : Gosub ERR : End If
Trap Close 1
Trap Kill F$
Inc BKCHANGE
Else
If NPROG>=0
D=Dialog Box(1,1,Resource$(104))
If D=2
Inc BKCHANGE
If NPROG_MAX<=N_PROG
NPROG_MAX=NPROG+1
End If
Reserve As Work 100+NPROG,1
Poke Start(100+NPROG),32
PRG$(NPROG)=Left$("empty"+Space$(16),16)
MN_PREDIT
End If
End If
End If
Dialog Update 1,12
Pop Proc
ERR:
D=Dialog Box(1,2,Err$(Errtrap))
Return
End Proc
3 - Makes the Change Editor option unavailable and is friendly about it:
Procedure MN_CHGEDITOR
' Option no longer allowed, so tell user
D=Dialog Box(1,2,"Editor is Cygnus Ed only in this version!")
End Proc
This is a bit nasty as it will only work on my system with my copy of Resource_Bank_Maker.AMOS. However it is a quick fix that works fine now.
It may be useful to others as a way of calling AmigaDOS from AMOS where multiple statements are inolved.
Thanks again.