IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#38132 - 12/28/11 10:05 PM Splitting jobs controlled by database
Kennet Offline
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
#38133 - 12/28/11 10:18 PM Re: Splitting jobs controlled by database [Re: Kennet]
Kennet Offline
OL Toddler

Registered: 12/28/11
Posts: 46
Loc: Denmark
oh, and by the way - the the order of the printed jobs, has to be in the order it is in the database (its adress-sorted in the individual routes, the messengers delivers them in to the consumers)

Top
#38134 - 12/29/11 09:19 AM Re: Splitting jobs controlled by database [Re: Kennet]
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
Kennet,

The JavaScript macros allows you to create your own commands for the expression editor, but won't allow you to control how the documents are printed.

With that said, splitting the job cannot natively be controlled in PrintShop Mail. You can split on X number of pages or records, but X is a value that you have to manually specify when you print, you cannot dynamically take a value from a database, and use it as a rule on when to split your document.

Regards,
Raphaël Lalonde Lefebvre

Top
#38135 - 12/29/11 09:33 AM Re: Splitting jobs controlled by database [Re: Raphael Lalonde Lefebvre]
Kennet Offline
OL Toddler

Registered: 12/28/11
Posts: 46
Loc: Denmark
Hi Raphael

Thanks for the response - i guess i have to look into third party tools, to combine with printshop mail for pre-/post-processing - or maybe create my own ...

I'll jump right into the thinking box.

Do you know where to learn the macro-part of Printshop Mail? i can surely use this for other purposes.

Top
#38136 - 12/29/11 10:07 AM Re: Splitting jobs controlled by database [Re: Kennet]
Raphael Lalonde Lefebvre Offline
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.

Code:
// ****************************************************************************
// 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
#38137 - 12/29/11 10:31 AM Re: Splitting jobs controlled by database [Re: Raphael Lalonde Lefebvre]
Kennet Offline
OL Toddler

Registered: 12/28/11
Posts: 46
Loc: Denmark
Hi Raphaël

Thanks for all your help - i really appreciate it.

I'll start fiddling around with it!

on another note, i read a bit about the Planetpress Suite - it sounds like it MIGHT be able to help with our initial problem. IF it can execute a Printshop Mail document and print automaticaly from whatever database i feed it, i can split the database beforehand via simple scripting. I'll contact our retailer after new years, for pricing and info.

Top