<p style="text-align: left;">Welcome to the first script of the month, As Halloween is approaching I have decided to take the Selectec tradition of picking on Ross online. This month we will be creating a simple print script which will cancel or double the cost of his print jobs depending on what second his job was sent, Grab a cup of coffee and we can start when you are ready.</p>
<p style="text-align: left;">So the first thing we are going to do is create 2 variables one for the user we are going to target and another to hold the seconds from the time the job was sent. Creating a variable is nice and easy in Javascript we just come up with a name that we can remember or easily recognize later and assign it a value.</p>

<pre>var username = "Ross";</pre>
<p style="text-align: left;">Our second variable is going to be making use of the inputs.job.date method and getting the seconds from the time the job was submitted.</p>

<pre>var seconds = inputs.job.date.getSeconds();</pre>
<p style="text-align: left;">Now we have the variables we need lets build out our if block, To make sure Ross has a hard time we are going to only run this if the job was submitted using his username using the inputs.job.username method. This could also be changed to a group of users by using inputs.user.isInGroup(group_name_variable).</p>

<pre>if ( inputs.job.username == username ) {
	// The rest of our code will go here
}</pre>
<p style="text-align: left;">Now inside that if block we are going to add another if block to compare the seconds value against 2 numbers so if seconds is 11 or seconds is 22 we are going to cancel the job and send a message back to him to tell him it has been cancelled</p>

<pre>if ( seconds == 11 || seconds == 22 ) {
	actions.job.cancel();
	actions.client.sendMessage( "Sorry the job has been cancelled" );
}</pre>
<p style="text-align: left;">It wouldn't be fun if we just left it like that so let's add another if using else if to check if seconds is 33 or 44 and if it is we are going to double the cost of his job and leave a comment in the job log so we know what happened.</p>

<pre>else if ( seconds == 33 || seconds == 44 ) {
 	actions.job.setCost( inputs.job.cost * 2 );
 	actions.job.addComment( "Cost doubled for Halloweeen trick" )
}</pre>
<p style="text-align: left;">Now we can end this with an else to catch anything else and leave it blank in an attempt to make him think it is just random, We could of course use actions.job.convertToGrayscale() to convert the other jobs to Grayscale if we wanted to but that might give away the game.</p>

<pre>else {
	// Don't do anything
}</pre>
<p style="text-align: left;">That is it you have made it to the end of the first monthly script and hopefully you have some ideas of what you could do in your environment for a little bit of fun, The full script is below and if you have any ideas for a future script get in touch and let us know.

If you have your own requirements for a print script and you don't have the time or in house experience to make it you can find out how we can help you by sending an email to our sales team at <a href="mailto:sales@selectec.co.uk">sales@selectec.co.uk</a></p>