Hello all !
I found the "Submit and track jobs with SwitchClient"-Flow here, which also contains the "Set user name" script. This script gets the value of the username property and sets it as the username in the job ticket. Is it possible to edit this script, to read the username directly from the "author" field (dublin core) of incoming pdf files?
Unfortunately I don't understand this script in details, but it seems that it's necessary to place this script as often in the flow as different usernames exists!? To avoid this, I wan't to get the username from the "dublin core" author field within each pdf file.
Can anyone help me to realize this, pls.?
Here's the origin scriptcode:
//==================================================================================================
// This is an example script that shows set a username for files submitted through a folder.
// This information can then be used in SwitchClient.
//
// ----------------------------------------------------------------
// Author: David van Driessche, Enfocus
// Last changed: May 17, 2008
// Copyright: (c) 2008 Enfocus, an EskoArtwork company
// ==================================================================================================
// Is invoked each time a new job arrives in one of the input folders for the flow element.
// The newly arrived job is passed as the second parameter.
function jobArrived( s : Switch, job : Job )
{
// Get the value of the username property
var theUserName = s.getPropertyValue( "username" );
// And set that as username in the job ticket
job.setUserName( theUserName );
// End by moving the job to the next step
job.sendToSingle( job.getPath() );
}
Set Username of job ticket to author of pdf file with script?
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Set Username of job ticket to author of pdf file with script?
Try this:
function jobArrived( s : Switch, job : Job )
{
var theXmp = job.getDataset("Xmp");
if (theXmp != null) {
var theUserName = theXmp.getString( "dc:creator/*[1]" , null );
// And set that as username in the job ticket
job.setUserName( theUserName );
// End by moving the job to the next step
job.sendToSingle( job.getPath() );
}
}
Dwight Kelly
Apago, Inc.
dkelly@apago.com
function jobArrived( s : Switch, job : Job )
{
var theXmp = job.getDataset("Xmp");
if (theXmp != null) {
var theUserName = theXmp.getString( "dc:creator/*[1]" , null );
// And set that as username in the job ticket
job.setUserName( theUserName );
// End by moving the job to the next step
job.sendToSingle( job.getPath() );
}
}
Dwight Kelly
Apago, Inc.
dkelly@apago.com
Set Username of job ticket to author of pdf file with script?
Hello Dwight.
I tried your code, but nothing happens: no error message.
Trying to recan, after a while PowerSwitch (10 update 1) crashes.
I also tried a lot of several variations - without success.
I'm not sure, how to define the flow element properties: I don't changed the tag "username", athough it isn't mentioned in your script anymore. Changing or removing it also failed.
Am I right, that it has to be still defined?
Thanks in advance!
Thomas
I tried your code, but nothing happens: no error message.
Trying to recan, after a while PowerSwitch (10 update 1) crashes.
I also tried a lot of several variations - without success.
I'm not sure, how to define the flow element properties: I don't changed the tag "username", athough it isn't mentioned in your script anymore. Changing or removing it also failed.
Am I right, that it has to be still defined?
Thanks in advance!
Thomas
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Set Username of job ticket to author of pdf file with script?
This version adds some messages that may help determine what is happening in your flow.
function jobArrived( s : Switch, job : Job )
{
var theXmp = job.getDataset("Xmp");
if (theXmp != null) {
var theUserName = theXmp.getString( "dc:creator/*[1]" , null );
// And set that as username in the job ticket
job.log(1, "setting username = " + theUserName);
job.setUserName( theUserName );
} else {
job.log(1, "No XMP found!");
}
job.sendToSingle( job.getPath() );
}
Make sure your flow has an XML Pickup (embedded) element.
function jobArrived( s : Switch, job : Job )
{
var theXmp = job.getDataset("Xmp");
if (theXmp != null) {
var theUserName = theXmp.getString( "dc:creator/*[1]" , null );
// And set that as username in the job ticket
job.log(1, "setting username = " + theUserName);
job.setUserName( theUserName );
} else {
job.log(1, "No XMP found!");
}
job.sendToSingle( job.getPath() );
}
Make sure your flow has an XML Pickup (embedded) element.
Set Username of job ticket to author of pdf file with script?
Thank you again. I'll try this on monday and report here.
Have a nice weekend!
Thomas
Have a nice weekend!
Thomas
Set Username of job ticket to author of pdf file with script?
Hello Dwight,
I don't know, what the problem was before, but now it works fine. Thanks you!
Unfortunately I made a mistake in my flow, because in some cases, there's no pdf file (to read the author from), e.g. because it's a XSLT report only.
For example: one incoming highres pdf file, should be duplicated and the copy should be downsampled to a lowres pdf. Additionally a xslt preflight report of th highres pdf should be created. This results in three files in the output folder (2x .pdf and 1 .htm).
Is there any way the the set the author(metadata) of the resulting html-report file to the author of the incoming pdf file at the same time the .htm report will be created?
Thanks in advance,
Thomas
I don't know, what the problem was before, but now it works fine. Thanks you!
Unfortunately I made a mistake in my flow, because in some cases, there's no pdf file (to read the author from), e.g. because it's a XSLT report only.
For example: one incoming highres pdf file, should be duplicated and the copy should be downsampled to a lowres pdf. Additionally a xslt preflight report of th highres pdf should be created. This results in three files in the output folder (2x .pdf and 1 .htm).
Is there any way the the set the author(metadata) of the resulting html-report file to the author of the incoming pdf file at the same time the .htm report will be created?
Thanks in advance,
Thomas
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Set Username of job ticket to author of pdf file with script?
Anything is possible depending on how your flow is constructed. Could you send me a copy of your flow to look at?
Set Username of job ticket to author of pdf file with script?
Hello,
unfortunately I can't send you a copy of my flow(s), because there are up to 40 seperate flows (with absolute pathes), were pdf files walk through. Normally one pdf file and one xml file were starting in flow no. 1. In the flows 2-40 this pdf file should be preflighted with two kinds of report files (pdf with comments and xslt/html) and duplicated several times (HighRes, MedRes, Lowres, split to single pages and so on). Each of the resulting pdf files will be edited and in different ways. How to preflight and edit is defined in the incoming xml file.
What I would like to to is to get the author ("dc:creator/*[1]") of the first incoming pdf file and put it to all additional resulting files. For pdf files it's is a standard feature of powerswitch. But I also need to write the author to every report file, independently what kind it is (in my case .htm).
So I 'm looking for a method to get the author from the incoming pdf file in my first flow and save this string to the metadata of the main job. After this, it should be able to get it from there at any time in one of my following flows. So every resulting file, which depends on the incoming pdf file should be tagged with the author of the origiinal pdf, even html-report files.
To simplify my problem, I'll try to describe the important part:
One edited highres version, which depends on the incoming original pdf file will be preflighted with a pdf toolbox 5 profile. This preflight generates a html-report file, which has no author defined and there is no relation anymore to the original pdf file (neighter the original file name nor identical job prefix). But I need to put the author (from the prflighted pdf file) into this new html file.
Additionally I prepared a simplified flow, which only should visualize the problem. Pls. use the following link:
ftp://iftp_44546:Rz599pt6@ftp.das-studi ... thor.sflow
(active until 2011-11-22)
Thanks in advance!
Thomas
unfortunately I can't send you a copy of my flow(s), because there are up to 40 seperate flows (with absolute pathes), were pdf files walk through. Normally one pdf file and one xml file were starting in flow no. 1. In the flows 2-40 this pdf file should be preflighted with two kinds of report files (pdf with comments and xslt/html) and duplicated several times (HighRes, MedRes, Lowres, split to single pages and so on). Each of the resulting pdf files will be edited and in different ways. How to preflight and edit is defined in the incoming xml file.
What I would like to to is to get the author ("dc:creator/*[1]") of the first incoming pdf file and put it to all additional resulting files. For pdf files it's is a standard feature of powerswitch. But I also need to write the author to every report file, independently what kind it is (in my case .htm).
So I 'm looking for a method to get the author from the incoming pdf file in my first flow and save this string to the metadata of the main job. After this, it should be able to get it from there at any time in one of my following flows. So every resulting file, which depends on the incoming pdf file should be tagged with the author of the origiinal pdf, even html-report files.
To simplify my problem, I'll try to describe the important part:
One edited highres version, which depends on the incoming original pdf file will be preflighted with a pdf toolbox 5 profile. This preflight generates a html-report file, which has no author defined and there is no relation anymore to the original pdf file (neighter the original file name nor identical job prefix). But I need to put the author (from the prflighted pdf file) into this new html file.
Additionally I prepared a simplified flow, which only should visualize the problem. Pls. use the following link:
ftp://iftp_44546:Rz599pt6@ftp.das-studi ... thor.sflow
(active until 2011-11-22)
Thanks in advance!
Thomas
Set Username of job ticket to author of pdf file with script?
Hello Mr. Kittel,
all child jobs created inside a Switch flow automatically inherit the job ticket inherited from its master job. So e.g. a preflight report file generated by Enfocus PitStop Server or callas pdfToolbox Server inherits the job ticket from the preflighted PDF file.
This means as long as you add the relevant information to the job ticket of your master job early enough all resulting child jobs produced within your flow(s) (as long as the job ticket doesn't get lost will handing a job from one flow to the next) will share that information with the master job.
The API function to set the user name within the job ticket is setUserName( username: String ) of the Job class as Dwight already showed to you.
A totally different thing is to achieve to get the username into the file format itself. In case of all data formats which support XMP and which are also supported by Enfocus Switch this is also quite trivial. You can either use the brand new "XMP inject" tool of PowerSwitch 10 or a bit of scripting which updates the existing XMP information via the setxxx() functions of the XMP data model (part of Metadata module).
The supported file formats are:
- PDF
- Illustrator
- InDesign
- Photoshop
- TIFF
- JPEG
- PNG
Regards,
Robert
all child jobs created inside a Switch flow automatically inherit the job ticket inherited from its master job. So e.g. a preflight report file generated by Enfocus PitStop Server or callas pdfToolbox Server inherits the job ticket from the preflighted PDF file.
This means as long as you add the relevant information to the job ticket of your master job early enough all resulting child jobs produced within your flow(s) (as long as the job ticket doesn't get lost will handing a job from one flow to the next) will share that information with the master job.
The API function to set the user name within the job ticket is setUserName( username: String ) of the Job class as Dwight already showed to you.
A totally different thing is to achieve to get the username into the file format itself. In case of all data formats which support XMP and which are also supported by Enfocus Switch this is also quite trivial. You can either use the brand new "XMP inject" tool of PowerSwitch 10 or a bit of scripting which updates the existing XMP information via the setxxx() functions of the XMP data model (part of Metadata module).
The supported file formats are:
- Illustrator
- InDesign
- Photoshop
- TIFF
- JPEG
- PNG
Regards,
Robert
Set Username of job ticket to author of pdf file with script?
Hallo all,
now my problem is solved. It was a silly combination of two different mistakes:
1) I didn't use the XMP pickup before, because I expected, that it can't be used additional to my existing XML pickup element. Now I added both in my first flow, so the script could find the XMP contents
2) I changed the final target folder and added another one before the last flow this morning. While handover the job to this new flow, I forgot to switch off the resolving of the unique job name. So it went away – and all attached metadatas, too ;o)
Thank you very much for your detailled answers!!!
Have a nice day,
Thomas
now my problem is solved. It was a silly combination of two different mistakes:
1) I didn't use the XMP pickup before, because I expected, that it can't be used additional to my existing XML pickup element. Now I added both in my first flow, so the script could find the XMP contents
2) I changed the final target folder and added another one before the last flow this morning. While handover the job to this new flow, I forgot to switch off the resolving of the unique job name. So it went away – and all attached metadatas, too ;o)
Thank you very much for your detailled answers!!!
Have a nice day,
Thomas