Page 1 of 1

Unable to read the command: ScriptedFlowElement::jobArrived

Posted: Wed Feb 26, 2014 8:12 pm
by PaulHough
I am not sure why i am getting this error can anyone help?

I am running a really simple script so i dont see what the issue could be.



Script:



function jobArrived( s : Switch, job : Job )

{

var var1 = job.getNameProper.lenght()

if (var1 != 21){

if (var1 != 20){

Job.NameProper = "0000000_Form0000FB__T";



}

}



}

Unable to read the command: ScriptedFlowElement::jobArrived

Posted: Thu Feb 27, 2014 3:25 pm
by freddyp
There are several things wrong with the script:



- lenght is not correct, it has to be length

- Job is not correct, the variable is job

- it seems like you are trying to do something that belongs in a script expression of one of the actions of the "Rename job" element, but you are handling it like a script element.

- I do not know what you are trying to achieve, but I think you will need some else statements as well or you are going to end up with an empty string.



Because of the first two problems the function is not available which is why you get that error message.



Freddy

Unable to read the command: ScriptedFlowElement::jobArrived

Posted: Thu Feb 27, 2014 3:55 pm
by dkelly
maybe something like:



function jobArrived( s : Switch, job : Job )

{

var name = job.getNameProper();

var var1 = name.length;

if (var1 < 20 || var1 > 21){

name = "0000000_Form0000FB__T";

}

job.sendToSingle(name);

}

Unable to read the command: ScriptedFlowElement::jobArrived

Posted: Thu Feb 27, 2014 5:43 pm
by freddyp
It would have to be:



job.sendToSingle(job.getPath(),name);



the first parameter being the path of the file that is passed on and the second its optional new name.



As a script expression on a rename action it would be:



var name = job.getNameProper();

var var1 = name.length;

if (var1 21){

"0000000_Form0000FB__T";

}

else {

name;

}

Unable to read the command: ScriptedFlowElement::jobArrived

Posted: Thu Feb 27, 2014 6:56 pm
by dkelly
oops, Freddy is right.

Re: Unable to read the command: ScriptedFlowElement::jobArrived

Posted: Fri May 27, 2016 8:39 pm
by gabrielp
Just in case anyone else stumbles upon this in the future. The "Unable to read the command: ScriptedFlowElement::jobArrived" error message means the script instance has crashed. You can reproduce this my making a script in scripter which crashes, then trying to run it in Switch. Lots of things cause scripts to crash, but a common one is declaring variables inside of the scope of another function.