On 1/22/2004 1:25:12 PM, jay hightman wrote:
>I was wanting to write a
>function that each time it was
>called would save a file under
>a new name.
The following macro will "increment" the last character of extension & save file
This is for demo only - NO error checking
Text register 30 has the new pathname on exit.
#104=Buf_Num // Current Edit Buffer
Reg_Set(30,PATH_ONLY) // path of current file
Reg_Set(30,"\",APPEND)
Reg_Set(30,FILE_ONLY,APPEND) // Name of current file
Reg_Set(30,".",APPEND)
Reg_Set(31,EXT_ONLY) // Output File
Buf_Switch(Buf_Free(EXTRA))
Buf_Empty(OK)
Reg_Ins(31)
#105=cc(-1) // numeric value of last character
Del_Char(-1)
Ins_Char(#105+1)
Reg_Copy_Block(30,BOB_Pos,EOB_Pos,APPEND) // New extension
Buf_Quit(OK)
Buf_Switch(#104)
File_Save_As("|@(30)") // Open "output" file
|
|