Script not starting

Post Reply
Qpdv
Member
Posts: 20
Joined: Thu Dec 03, 2015 2:59 pm

Script not starting

Post by Qpdv »

I'm testing with a very easy script, but its not starting, the job stays in the folder before the script.

Code: Select all

function jobArrived( s : Switch, job : Job )
{
	job.setPrivateData('testcontainer', 'testvalue');
}
How can i Start a script?

Thanks in advance,

Peter
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Script not starting

Post by gabrielp »

Hey man, add this line at the end of the jobArrived function:

Code: Select all

job.sendToSingle( job.getPath() );
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Qpdv
Member
Posts: 20
Joined: Thu Dec 03, 2015 2:59 pm

Re: Script not starting

Post by Qpdv »

Hi, Thanks!

That worked, but does it do? Why doesn't a simple return do the trick?

Peter
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Script not starting

Post by gabrielp »

Qpdv wrote:Hi, Thanks!

That worked, but does it do? Why doesn't a simple return do the trick?

Peter
It moves the job to the next connector. There's a few ways to process jobs through Switch scripts so you need to tell Switch what to do. The traffic light version is a little different. You can also do job.fail() and stuff too...
Processing a job in a script usually consists of the following steps:
Decide on how to process the job based on file type etc.
Get the path to the incoming job.
Get a temporary path for one or more output files or folders.
Create the output(s) in the temporary location.
Call one of the sendTo functions for each output.
...
A job remains in the input folder until one of the Job.sendTo() or Job.fail() functions has been called for the job. The jobArrived entry point will be invoked only once for each job, so if the entry point does not call a sendTo() or fail() function for the job, the script should do so at a later time (in a timerFired entry point or in a subsequent invocation of the jobArrived entry point for a different job).
See here: http://www.enfocus.com/manuals/Develope ... class.html
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Qpdv
Member
Posts: 20
Joined: Thu Dec 03, 2015 2:59 pm

Re: Script not starting

Post by Qpdv »

Ah... I found the job.fail() method but wasn't aware of the extra required functions, although very understandable actually :).

Thanks again!
Post Reply