Hello, I hope experienced scripters can point out my likely newbie error. I have scans of a book and want to generate separate jpgs for left and right-hand pages. I recorded a simple script consisting only of dragging the crop rectangle to upper-left corner then executing the crop. The resulting script works when run on a single image. But as a batch process it chokes after the first file, complaining (un-helpfully):
Executing script "C:\...\Scripts-Trusted\crop left.PspScript" against file "C:\Home-Car\Receipts, scanned\IMG_20160312_0008.jpg".
Script "C:\...\Scripts-Trusted\crop left.PspScript" failed! Against file "C:\Home-Car\Receipts, scanned\IMG_20160312_0008.jpg".
Error processing file "C:\Home-Car\Receipts, scanned\IMG_20160312_0008.jpg"
If I edit the script to make crop rectangle smaller, same problem.
If OTOH I record a script to Resize the image, in batch mode all the files are processed.
I am saving the edited images in a subfolder below the original images.
Any help much appreciated! Below is the entire script.
+++++++++++++++++++++++++++++++
from PSPApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'14.00 Alpha 00000000.0000000000.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((14,0,0),1)
}
})
# Crop
App.Do( Environment, 'Crop', {
'CropRect': ((0,0), 882, 1585),
'Mode': App.Constants.CropMode.Custom,
'Units': App.Constants.CropUnits.Inches,
'SelectedArea': False,
'PrintWidth': -1,
'PrintHeight': -1,
'CropAsNewImage': False,
'RotationAngle': -0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((14,0,0),1)
}
})
+++++++++++++++++++++++
Batch: Cropping script fails after first file
Moderator: Kathy_9
-
LeviFiction
- Advisor
- Posts: 6831
- Joined: Thu Oct 02, 2008 1:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Alienware M17xR4
- processor: Intel Core i7-3630QM CPU - 2_40GH
- ram: 6 GB
- Video Card: NVIDIA GeForce GTX 660M
- sound_card: Sound Blaster Recon3Di
- Hard_Drive_Capacity: 500GB
- Corel programs: PSP: 8-2023
- Location: USA
Re: Batch: Cropping script fails after first file
How large are these images? Are they all the same size? Do you have any other version than X4 you can test this? I tested your script in X8 with no issues. Even recreated the folder and file names demonstrated in your error.
https://levifiction.wordpress.com/
Re: Batch: Cropping script fails after first file
Thanks for responding. The images are not identical in size, but all are approximately 1660x1570. I have only X4; have resisted paying for the upgrade as I use PSP rarely, and not many of its features.
It would be helpful if there were a way to turn on more verbose batch mode / script logging, or a way to single-step to troubleshoot, but after quite a bit of searching I found neither. Frustrating to have a script that works on a single file, and then batch mode is opaque in its behavior.
It would be helpful if there were a way to turn on more verbose batch mode / script logging, or a way to single-step to troubleshoot, but after quite a bit of searching I found neither. Frustrating to have a script that works on a single file, and then batch mode is opaque in its behavior.
