#38132 - 12/28/11 10:05 PM
Splitting jobs controlled by database
|
OL Toddler
Registered: 12/28/11
Posts: 46
Loc: Denmark
|
We've started using a distribution-company that have a strict way of needing the printed jobs being split up, when they recieve them for further packaging.
I know there's a way to print seperate slipsheets from another tray (not doable when having more than one page on the layout), or as i did it this time, to print a seperate layout, when specific conditions are met (i used "Changed()" and printed black borders, so it could be seen from the side, after it was "punched out" in the shape of a new years bomb).
This time we had the distribution-company manually split up the final splits, so we only had 3x76 splits in 150000 variable prints. It was doable, but was a bit timeconsuming for our packaging-department. The next time we have to do all the splits, so im looking for a way to make the handling a bit easier.
Is there a way to automatically split the jobs, when sent to the printer - controlled by the database? or can i use my VBscript knowledge to do so? i know it's possible to write extensions to Printshop Mail in VBscript or Javascript, but can't seem to find a document descriping how to make there communicate with Printshop Mail, or descriping the limits.
The database we recieve is well-structured with 3-4 rows of numbers showing when a job has to be split (ie. one big split controlled by the first number, and inner splits in this larger split, controlled by the second number, and so on ...)
|
Top
|
|
|
|
#38136 - 12/29/11 10:07 AM
Re: Splitting jobs controlled by database
[Re: Kennet]
|
OL Expert
Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
|
Kennet, Well, it's mostly javascript knowledge, but I did create a "starter" macro as a base to start.
// ****************************************************************************
// Function: TEMPLATE
//
// Standard template for PSM JavaScript macros.
//
// Language: JScript
// Written by: Raphaël Lalonde Lefebvre - Objectif Lune
// *** This macro is provided as is, it will not be supported, and no rights can be claimed ***
// *** Use at your own risk ***
//
// INSTRUCTIONS:
//
// To install, place this .js file in "Macro" folder of the PrintShop Mail's directory. If you do not see it, create it. Once done, restart PrintShop Mail,
// and the "TEMPLATE" function will appear.
//
// ****************************************************************************
// Function descriptor.
function psmGetFunctionDescriptor(index)
{
// Descriptor syntax explanation:
// The first "STRING" is the function's category under which it will appear in the Expression Editor's list of functions.
// It does not have any impact on what the function returns, it's only used to place it in the right category. Ideally, it will
// be the same as the function's return type.
// The second "STRING" is the function's return type.
// Some supported types are:
// STRING: A string.
// NUMBER: A number.
// LOGICAL: True/False value.
// "index" seems to be a PSM system variable, and should be left alone.
// For the usage examples, precede the double quotes by a '\' character.
if (index == 0) return "STRING STRING TEMPLATE(STRING{string1;First string.},STRING{string2;Second string.})\tEnter function's description here. It is followed by usage examples. \t TEMPLATE(\"Hello\", \"World\") => Hello World";
return "";
}
// Main function.
// This is the macro's main code. It should always have "psm" as the prefix.
// If you want a TEMPLATE macro, you need to call the main function "psmTEMPLATE".
// This template's sample code takes 2 strings as parameters, and displays them
// with a CRLF between them.
function psmTEMPLATE(string1, string2)
{
// Variables definitions.
var mystring = "";
// Write your code here.
mystring = string1 + String.fromCharCode(13) + String.fromCharCode(10) + string2
// Return final string.
return mystring;
}
// Below are some system functions. They should not be altered unless you know what you're doing.
var Warning="";
function psmGetWarning()
{
var result = Warning;
Warning = "";
return result;
}
var causeParameterNo = -1;
function psmGetWarningCauseParameter()
{
var result = causeParameterNo;
causeParameterNo = -1;
return result;
}
var LanguageSet = "";
function psmSetLanguage(lan)
{
LanguageSet = lan;
}
This function is simply called "TEMPLATE". You will need to copy it, and save it as a .js file. Then, you need to create a folder called "Macro" in your PrintShop Mail Suite 7 folder, and put the .js file in there. You'll have to restart PrintShop Mail if it was open. Once you do that, you can go in the expression editor, and you'll see a new command called TEMPLATE. You can then use it as you would use any other commands. If you want to change it, you can rename the instances of TEMPLATE, as well as the psmTEMPLATE function, to use a different name(don't remove the "psm" part though). You'll have to edit the function's declaration as well to remove or add paramaters, and change their type if needed. I've added some comments to help. Your function's main body is the psmTEMPLATE function, and this is where you enter your code. Do not edit or remove the other functions. From that point, it's standard javascript, so you're pretty much on your own. Unfortunately, there is no debuggers present in PrintShop Mail, and if you make mistakes, your function simply won't appear in the list. It can take some time to properly debug a function because of this. Also note that we do not provide any official support for this feature, so if a function doesn't work, we will not provide assistance for it, nor are we responsible for any errors or problems in a project that use custom macros(in other words, use it at your own risks). We also don't have any documentation on JavaScript, nor do we plan to have any. For more information on JavaScript, your best bet is Google. Regards, Raphaël Lalonde Lefebvre
|
Top
|
|
|
|
|
|