Jump to content

Finchy911

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Finchy911

  1. Sorry for the delay in reply. This worked perfectly, thank you greatly sir! Warm regards Chris
  2. Hi Broomop, Okay I've taken some bits out leaving me with the following: 1 // 2 // Customize your print process with Print Scripting. You don't have to be a 3 // programmer to use Print Scripting. Use one of the many pre-written recipes 4 // already written for you, or write your own in JavaScript using snippets and 5 // reference documentation. 6 // 7 function printJobHook(inputs, actions) { 8 inputs.job.documentName - this gets the document name. Then do something like. 9 var n = inputs.job.documentName.indexOf("%20"); 10 if (n > 0) then 11 } ------------------------------------------------------ I put in line numbers this time to help you debug, having deleted some unnecessary blank lines I have the same error but this time on line 8. I really appreciate the effort you're putting into this mate, I hope I pick up some knowledge about java-script from all of this so I can pay it forward in future!
  3. Hi Broomop, Thanks for your advice my friend, this is what I have now: // // Customize your print process with Print Scripting. You don't have to be a // programmer to use Print Scripting. Use one of the many pre-written recipes // already written for you, or write your own in JavaScript using snippets and // reference documentation. // function printJobHook(inputs, actions) { // // Customize your print process with Print Scripting. You don't have to be a // programmer to use Print Scripting. Use one of the many pre-written recipes // already written for you, or write your own in JavaScript using snippets and // reference documentation. // function printJobHook(inputs, actions) { inputs.job.documentName - this gets the document name. Then do something like. var n = inputs.job.documentName.indexOf("%20"); if (n > 0) then { actions.job.cancel(); actions.log.debug('Job from user "' + inputs.user.username + '" was canceled.'); } } } ----------------------------------------------------------------------------------- The error I'm getting is "The Script failed to validate, check the script syntax: missing ; before statment (Printer-script#15" I wish I knew exactly what that meant other than presumably missing a semi colon somewhere, hopefully that makes a bit more sense to you.
  4. Hi Broomop, I had a very good go at trying to do it myself which ended up looking like this: -------------------------------------------------------------------- "// // Customize your print process with Print Scripting. You don't have to be a // programmer to use Print Scripting. Use one of the many pre-written recipes // already written for you, or write your own in JavaScript using snippets and // reference documentation. // function printJobHook(inputs, actions) { inputs.job.documentName - this gets the document name. Then do something like. var n = inputs.job.documentName.indexOf("%20"); if n > 0 then { actions.job.cancel(); actions.log.debug('Job from user "' + inputs.user.username + '" was canceled.'); } } --------------------------------------------------------------- Unfortunately as may be obvious I'm garbage at scripting/understanding javascript and it just says I have a syntax error. What I'm going for as you know is to analyse the job name and if it contains a certain string then to deny the job, then send a message back to the user that I can add my own text into to explain why their job was denied. It shames me to ask but could you please write something like this for me as I cant seem to get a grasp on how exactly this is done. If you could do this for me I'd be forever in your debt sir!
  5. Hi Broomop, This is great! So this code analyses the job name and it will give me either a 1 or 0 result based on that test if I understand that correctly? Assuming that is correct I'd put some code stolen from elsewhere to deny the job and do message boxes and what not to get it to do what I want? Kind Regards Chris
  6. Hi Matthew, Thanks, I did see this option but as far as I can see its not a name contains filter. It looks like that is for explicitly blocking a named file like "mydocument.doc" not like "anything that contains the word document and is a PDF gets blocked". That is unless there is a particular syntax in that box that I'm supposed to put in that I'm missing? Kind Regards Chris
  7. Hi Everyone, I have an issue that I really hope you can help with. I am looking for a way to deny print jobs that contain in them "%20". Essentially the issue I'm having is that we use Google chrome and for some reason its print preview option doesn't talk very well to our printers and wont print in B&W for example. I am unable to find a way to disable it for all users so I'm looking to go this route instead. I've noticed that files printed through the print preview are always named "document%20name%20.pdf" so I want to be able to deny those prints ideally with a message to display advising them to download the document instead and print normally or something of that nature. The only catch is this - I don't know java script at all. Does anyone have a script that would be similar to my needs and fairly simple for me to understand so I could edit it or would some kind soul consider writing something for me? Kind Regards Chris
×
×
  • Create New...