priPrinter: Help making a script for number of copy - priPrinter

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help making a script for number of copy

#1 User is offline   zachroberts 

  • Member
  • PipPip
  • Group: Senior Members
  • Posts: 17
  • Joined: 19-January 16

Posted 19 January 2016 - 05:54 PM

Hi i am trying to write a script that will prompt a user the number of copies their are making and then will put a watermark on each copy with what copy number it is.

so the first copy that is printer will have page # 1

the 2nd copy will have page # 2 and so on.

I know how to get a input box but the rest is a little hard for me.

Thanks,
Zach
0

#2 User is offline   Aron 

  • priPrinter Support
  • Group: Administrators
  • Posts: 131
  • Joined: 28-February 10

Posted 20 January 2016 - 08:20 AM

Can we present your task in the following, pseudo code way?

for(copy=0;copy<numberOfCopies;copy++)
{
setWatermark("Copy "+ (copy+1));
PrintCurrentCopy();
}
0

#3 User is offline   zachroberts 

  • Member
  • PipPip
  • Group: Senior Members
  • Posts: 17
  • Joined: 19-January 16

Posted 20 January 2016 - 06:50 PM

View PostAron, on 20 January 2016 - 08:20 AM, said:

Can we present your task in the following, pseudo code way?

for(copy=0;copy<numberOfCopies;copy++)
{
setWatermark("Copy "+ (copy+1));
PrintCurrentCopy();
}



Hi i tried the following code but i get an error 'An Error has occurred [comparison between '0' and '2'] (the second # is the number of copies entered)

local copy=InputBox("Enter # of Copies:","");

local numberOfCopies = copy;

for(copy=0;copy<numberOfCopies;copy++)
{
setWatermark("Copy "+ (copy+1));
PrintCurrentCopy();
} 

0

#4 User is offline   Aron 

  • priPrinter Support
  • Group: Administrators
  • Posts: 131
  • Joined: 28-February 10

Posted 21 January 2016 - 08:28 AM

This was just a pseudo-code, not a real script.
Real code, may look in the following way:


local copies=3;

 local m = layout.GetMarkupById(103); 
 if(!m)
 {
     m = layout.CreateMarkup("string");
     m.pos=Point(0.5,0.5);
     m.alpha=0.5;
     m.angle=0;
     m.color=Color(255,0,0);
     local f=m.font;
     f.height=36;
     f.name="Verdana";
     m.font=f;
     m.outline=true;
 }

for(local i=0;i<copies;i++)
{
 m.text="Copy"+(i+1);
 layout.Print({dialog=false});
}

0

#5 User is offline   zachroberts 

  • Member
  • PipPip
  • Group: Senior Members
  • Posts: 17
  • Joined: 19-January 16

Posted 21 January 2016 - 04:25 PM

View PostAron, on 21 January 2016 - 08:28 AM, said:

This was just a pseudo-code, not a real script.
Real code, may look in the following way:


local copies=3;

 local m = layout.GetMarkupById(103); 
 if(!m)
 {
     m = layout.CreateMarkup("string");
     m.pos=Point(0.5,0.5);
     m.alpha=0.5;
     m.angle=0;
     m.color=Color(255,0,0);
     local f=m.font;
     f.height=36;
     f.name="Verdana";
     m.font=f;
     m.outline=true;
 }

for(local i=0;i<copies;i++)
{
 m.text="Copy"+(i+1);
 layout.Print({dialog=false});
}




Hi I tried the above code and my input is not being recognized as an int. How can i get that to be? My code is below. If i comment out the input local totalCopies var and add in

local = copy 3; then it will print 3 copies but they print out with the watermark 'Page2' i am trying to get them to print, 'page1', 'page2' ext. With also an input dialog because the users will not be printing the same number of copies each time.

local copy=InputBox("Enter # of Copies:","");

local totalCopies= copy;

local m = layout.GetMarkupById(103);
if(!m)
{
	m = layout.CreateMarkup("String");
	m.pos=Point(0.5,0.99);
	m.alpha=(0.5);
	m.color=Color(255,0,0);
	local f=m.font;
	f.height=9;
	f.name="Arial";
	m.font=f;
	m.outline=true;
}

for(local i=0;i<copy;i++)
{
	m.text="Page"+(1+1);
	layout.Print({diaglog=false});
}


Thanks,
Zach
0

#6 User is offline   zachroberts 

  • Member
  • PipPip
  • Group: Senior Members
  • Posts: 17
  • Joined: 19-January 16

Posted 21 January 2016 - 06:20 PM

View Postzachroberts, on 21 January 2016 - 04:25 PM, said:

Hi I tried the above code and my input is not being recognized as an int. How can i get that to be? My code is below. If i comment out the input local totalCopies var and add in

local = copy 3; then it will print 3 copies but they print out with the watermark 'Page2' i am trying to get them to print, 'page1', 'page2' ext. With also an input dialog because the users will not be printing the same number of copies each time.

local copy=InputBox("Enter # of Copies:","");

local totalCopies= copy;

local m = layout.GetMarkupById(103);
if(!m)
{
	m = layout.CreateMarkup("String");
	m.pos=Point(0.5,0.99);
	m.alpha=(0.5);
	m.color=Color(255,0,0);
	local f=m.font;
	f.height=9;
	f.name="Arial";
	m.font=f;
	m.outline=true;
}

for(local i=0;i<copy;i++)
{
	m.text="Page"+(1+1);
	layout.Print({diaglog=false});
}


Thanks,
Zach



Noticed that I placed a 1 instead of an i, still need to get the input to input as an integer and not a string.
Thanks
Zach
0

#7 User is offline   Aron 

  • priPrinter Support
  • Group: Administrators
  • Posts: 131
  • Joined: 28-February 10

Posted 21 January 2016 - 06:36 PM

Use .tointeger(); method, or it will be

local copies=InputBox("Enter # of Copies:","3").tointeger();


or whole code:

local copies=InputBox("Enter # of Copies:","3").tointeger();
if(copies>0)
{

 local m = layout.GetMarkupById(103); 
 if(!m)
 {
     m = layout.CreateMarkup("string");
     m.pos=Point(0.5,0.5);
     m.alpha=0.5;
     m.angle=0;
     m.color=Color(255,0,0);
     local f=m.font;
     f.height=36;
     f.name="Verdana";
     m.font=f;
	 m.id=103;
     m.outline=true;
 }

for(local i=0;i<copies;i++)
{
 m.text="Copy"+(i+1);
 layout.Print({dialog=false});
}
}


Please note 103 - id of watermark. So next print, watermark will be updated.
0

#8 User is offline   zachroberts 

  • Member
  • PipPip
  • Group: Senior Members
  • Posts: 17
  • Joined: 19-January 16

Posted 21 January 2016 - 07:32 PM

View PostAron, on 21 January 2016 - 06:36 PM, said:

Use .tointeger(); method, or it will be

local copies=InputBox("Enter # of Copies:","3").tointeger();


or whole code:

local copies=InputBox("Enter # of Copies:","3").tointeger();
if(copies>0)
{

 local m = layout.GetMarkupById(103); 
 if(!m)
 {
     m = layout.CreateMarkup("string");
     m.pos=Point(0.5,0.5);
     m.alpha=0.5;
     m.angle=0;
     m.color=Color(255,0,0);
     local f=m.font;
     f.height=36;
     f.name="Verdana";
     m.font=f;
	 m.id=103;
     m.outline=true;
 }

for(local i=0;i<copies;i++)
{
 m.text="Copy"+(i+1);
 layout.Print({dialog=false});
}
}


Please note 103 - id of watermark. So next print, watermark will be updated.

That works great! Thanks you very much!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users