On 1/9/2008 1:59:09 AM, Steve Rawling wrote:
>I have written the attached macro "SR-macro" intending it
>to primarily executed in its own instance of vedit using a
>command line prompt
> [...]
>However if I have some other file is buffer 1 and have
>"SR-data.asc" loaded into buffer 2 , then run the macro,
>the reformatted data is successfully written to disk
>but when VEDIT tries to close it asks me "Do I want to save
>"SR-data.asc" but I have already saved the buffer to a
>new name and followed that command with BQ(OK) which
>should prevent this prompt from occuring.
> [...]
>Can anyone explain to me what
>I am doing wrong
Steve:
First I wouldn't rely on Buf_Previous() for switching buffers. Better take care by yourself!
I rewrote some lines of your macro a bit to show:
// INPUT FILE'S EXTENSION IS CHANGED TO RDE AND "filename.rde' SAVED IN T REG 99
#103=Buf_Num // remember current buffer number
Out_Reg(103) // use one of the temporary registers
Name_Write(EXTRA+NOCR+NOMSG)
Out_Reg(CLEAR)
Buf_Switch(Buf_Free(EXTRA)) // use one of the extra buffers
Reg_Ins(103)
Search(".",REVERSE+ADVANCE) // advance past the found "."
Del_Line(1)
Ins_Text("rde")
Begin_Of_File
Reg_Copy_Block(103, Cur_Pos, EOL_Pos)
Buf_Quit(OK)
Buf_Switch(#103) // don't rely on Buf_Previous but take control by yourself
// THE FINISHED CONVERTED DATA IS COPIED TO THE CLIPBOARD AND THEN SAVED AS "filename.rde"
Clip_Copy_Block(0, File_Size)
File_Save_As(@103, OK+NOMSG)
Buf_Quit(OK)
goto end
But I didn't test it.
Christian