macro command "SaveAs" and [FILE_NAME] in template

Help with writing and playing macros

macro command "SaveAs" and [FILE_NAME] in template

Postby frankpool » Fri Aug 20, 2004 2:50 am

Hi,

I use a named template. Within that template I use the special variable [FILE_NAME]. This varibale is useless when I'm edititing a new file that isn't saved yet.
Next I decided to try the macro call "Save". ( I expexted to get a "Save As" dialog. This would be equal to the behaviour when pressing the "Save" menu item). But nothing happens if you call "Save" for an unnamed file.
"SaveAs" without using a filename leads to an error.

So what can I do to save a "unnamed file" before someone inserts my named template.

Thanks in advance,
frank
User avatar
frankpool
Newbie
 
Posts: 1
Joined: Thu Aug 19, 2004 11:00 pm

Re: macro command "SaveAs" and [FILE_NAME] in temp

Postby Mofi » Sun Aug 22, 2004 8:04 am

Try this macro. It checks if the file has no name and if so, the user is asked to enter the file name for the new file. This file name is then used to save the file. Not perfect, but a workaround for your problem.

InsertMode
ColumnModeOff
HexOff
UnixReOff
IfNameIs ""
Top
GetString "Enter file name for new file:"
SelectToTop
Cut
SaveAs "^c"
EndIf
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros