 
|
FileSave command does nothing
When writing scripts
for Corel PHOTO-PAINT you have probably noticed that sometimes FileSave
command doesn't seem to work at all. You want to save your image in a
bunch of different formats but what you have is only one image saved
first. The rest is missing...
The solution is very
simple. The reason for this is that as in UI you cannot save unmodified
image. You will notice that Save command becomes grayed out after saving
the image until you modify it somehow. Unfortunately script equivalent of
File>Save command suffers from the same disease...
The easiest way to
overcome this is to modify the image before saving it. Or at least make it
so that it appears modified to Photo-Paint. One of the efficient ways to do it
is to use ImagePapersize command. Set the paper size to the actual
document size and nothing happens to the document but the image will be
thought to be modified and Photo-Paint will save it successfully:
.FileOpen "C:\Images\Image1.cpt", 0, 0, 0, 0, 0, 1, 1
sx&=.GetDocumentWidth()
sy&=.GetDocumentHeight()
.ImagePapersize sx, sy, 0, 0, 5, 255, 255, 255, 0
.FileSave "C:\Images\Out\Image1.gif", 773, 0
|