Script to save a file and use the auto incremented filename

  • Follow


I am writing a script to cut a area out of a photo then paste it as a
new image and then save it. My problem is that when I run in silent
mode PSP does not increment the name it just saves over the last one
with the name that was recorded in the script. I dont type in a
filename when I record the script I just hit enter to accept the auto
generated filename. How can I get the script to just use the auto
incremented file name?
I am in PSP 8.01 Win2k
Here is my script that just saves the current unsaved file. It just
saves over 44.jpg everytime.

Scott




from JascApp import *

def Do(Environment):
    # FileSave
    App.Do( Environment, 'FileSave', {
            'Encoding': {
                'JPG': {
                    'Variant': App.Constants.JpegFormat.Standard, 
                    'CompressionFactor': 15, 
                    'ChromaSubSampling':
App.Constants.ChromaSubSampling.YCC_2x2_1x1_1x1
                    }
                }, 
            'FileName': u'C:\\Documents and Settings\\saariddle\\My
Documents\\My Pictures\\Image'\
                u'44.jpg', 
            'FileFormat': App.Constants.FileFormat.JPG, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'DialogPlacement': {
                    'ShowMaximized': App.Constants.Boolean.true, 
                    'Rect': ((0,0),0)
                    }, 
                'AutoActionMode':
App.Constants.AutoActionMode.AllAlways
                }, 
            'DefaultProperties': []
            })
0
Reply sariddle 12/24/2003 8:34:42 PM

sariddle@lisco.com (Scott Riddle) wrote in 
news:3bfc2dd3.0312241234.6e075011@posting.google.com:
> How can I get the script to just use the auto
> incremented file name?

If you remove from the script the line that defines the filename
('FileName': u'C:\\Documents and Settings\\saariddle\\My
Documents\\My Pictures\\Image'\u'44.jpg', )
it should use the default - which is the auto-generated name it gets from 
the non-saved new image. But, PSP probably includes the image-part, so if 
you need to have greater control, some programming is required.

-- 
Matti Vuori, <http://sivut.koti.soon.fi/mvuori/index-e.htm>

0
Reply Matti 12/25/2003 3:58:02 PM


Here is what I eventually came up with.
'FileName': 'c:\\' + App.ActiveDocument.Title + '.jpg', 

It concatenates c:\ with the active documents title which gets auto
created when you paste the new image and the I added the .jpg.

It works like a charm.

Scott
0
Reply sariddle 12/25/2003 8:51:39 PM

2 Replies
439 Views

(page loaded in 0.13 seconds)

Similiar Articles:













7/25/2012 12:49:34 AM


Reply: