Page 1 of 3 1 2 3 >
Topic Options
#31424 - 07/22/09 09:33 AM Wrong Page Count
carlos kochhann Offline
Junior Member

Registered: 07/21/09
Posts: 15
I'm trying to get the total page count of my documents by using Create Metadata, but it's getting a whole different value from the real number of pages.

My .ptk file has a Metadata Field in Document Level named PageCount with the value:
Code:
= inttostr(&current.datapage)
Also, a PressTalk with:
Code:
define(&page,integer, 0)
&page:=ExecScriptFile('C:\\PageCounter\\writefile.vbs',getmeta('PageCount'), 0)
This writefile.vbs script contains:
Code:
dim pgcnt
dim FSO
dim NewFile

pgcnt = Script.ParamString
set FSO = CreateObject("Scripting.FileSystemObject")
set NewFile = FSO.CreateTextFile("C:\\PageCounter\\pgcnt.txt")

NewFile.WriteLine(pgcnt)
NewFile.Close
And, finally, a RunScript on Watch with this code among the rest of the script:
Code:
set FSO = CreateObject("Scripting.FileSystemObject")
set OpenFile = FSO.OpenTextFile("C:\\PageCounter\\pgcnt.txt", 1)
pgcnt = OpenFile.ReadLine
Watch.SetJobInfo 9, pgcnt
OpenFile.Close
Does anyone knows the reason why the page count returned, for example, 515 for a 6 pages document? Where's my mistake?

Thanks

Top
#31425 - 07/22/09 10:15 AM Re: Wrong Page Count
Benoit Potvin Offline
OL Expert

Registered: 01/02/08
Posts: 490
Loc: Montréal, Canada
Hi,

While I cannot help you with your script, here is how to access the total page count in your PlanetPress Design document without any script:

The metadata already have a Page count attribute. Try the following in order to display the total page count on a Page of your PlanetPress Design document:

1. Generate metadata for your PlanetPress Design document. It's a button in the ribbon's Tools submenu.

2. Create a text object. Inside of it, right click and choose 'Select data'. The data selector window opens.

3. Choose the 'Metadata' tab, then select the 'SelectedPageCount' attribute. This metadata attribute should contain the total number of pages that would compose the job once processed by the PlanetPress Design document.

Considering the relative complexity of your post, I am not sure if what I propose is actually what you are searching for, but as far as you only want the total number of physical pages produced by a PlanetPress Design document on a given datafile, then the easiest way is to use the SelectedPageCount metadata attribute.

If you are using a User-Defined Emulation, then it might not work however.

Hope this helps!

Benoit
_________________________
Knowledge is capital
http://twitter.com/benoitpotvin

Top
#31426 - 07/22/09 10:18 AM Re: Wrong Page Count
Benoit Potvin Offline
OL Expert

Registered: 01/02/08
Posts: 490
Loc: Montréal, Canada
Hi again,

Quote:
Does anyone knows the reason why the page count returned, for example, 515 for a 6 pages document? Where's my mistake?
hum...

Could it be a data type conversion related problem? I.e. '5'+'1'= '51' VS 5+1=6

ben
_________________________
Knowledge is capital
http://twitter.com/benoitpotvin

Top
#31427 - 07/22/09 11:01 AM Re: Wrong Page Count
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1931
Loc: Objectif Lune, Montreal, Qc
Carlos,

After looking at your code, it looks like all you're trying to do is to store in PPWorkflow's Jobinfo 9 the number of pages in that job.

This requires only 2 simple steps:
1. Create Metadata
2. Set JobInfo and Variables, select %9 and then use Benoit's method described above to retrieve the value for the SelectedPageCount from the metadata.

As for why your script returns the wrong value, there could be a number of reasons. The most obvious one is that you store the number of Data Pages in your variable, instead of the number of Physical pages. Also, since you don't specify at which point you actually set the value for the metadata field, we don't know how many times it gets set.

But debugging all of this could be time-consuming, so I definitely recommend you use the metadata's native ways of accessing the page count.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#31428 - 07/22/09 01:28 PM Re: Wrong Page Count
carlos kochhann Offline
Junior Member

Registered: 07/21/09
Posts: 15
Thanks a lot for the help, but I found a problem trying to do it:

I generated the Metadata, created the Text object, and inside of it, on the Select Data/Metadata tab, there is no SelectedPageCount to select.
Any clues?
I'm still sniffing around on Design to find it, but any help would be valuable time! =]
Thanks a lot

Top
#31429 - 07/22/09 01:57 PM Re: Wrong Page Count
carlos kochhann Offline
Junior Member

Registered: 07/21/09
Posts: 15
Just to make the intention clear:
What we are looking for here is to get the number of pages in everything that is printed, in order to make... 'page separators'? I don't know what would be the correct term, please correct me if I'm wrong (would also help me on research).

Its that page in front of each printed job, with the user name, department, date/hour and the user data so it can be delivered for him in his desk.
(cover page? front page? page separator?
Its all perfect, already working with the Active Directory but we can't seem to get the number of pages printed on that job.

Top
#31430 - 07/23/09 12:54 PM Re: Wrong Page Count
carlos kochhann Offline
Junior Member

Registered: 07/21/09
Posts: 15
Is there any other way to do it?
Like get the number of pages out of the .SHD file in the spool folder?
If so, how do I get it? I couldnt find any documentation regarding this issue, and I'm looking for it for like a week, and no luck at all.

Thanks in advance!

Top
#31431 - 07/23/09 01:07 PM Re: Wrong Page Count
Benoit Potvin Offline
OL Expert

Registered: 01/02/08
Posts: 490
Loc: Montréal, Canada
Carlos,

On your second post you say:
Quote:
I generated the Metadata, created the Text object, and inside of it, on the Select Data/Metadata tab, there is no SelectedPageCount to select.
I do not understand... The SelectedPageCount attribute is part of the metadata.

May I ask what metadata attributes you see when you use the data selector inside the text object? There should be dozens of attributes available to select, including:

- Count
- Creator
- DataEncoding
- Datafile
- DatapageCount
- Date
- Dimensions
- DocumentCount
- Duplex
...
- SelectedCount
- SelectedDatapageCount
- SelectedDocumentCount
...
- SelectedIndexInJob
- SelectedPageCount
- Side
...

Benoit
_________________________
Knowledge is capital
http://twitter.com/benoitpotvin

Top
#31432 - 07/23/09 01:10 PM Re: Wrong Page Count
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4953
Loc: Objectif Lune Montreal
Quote:
Originally posted by carlos kochhann:
Is there any other way to do it?
Like get the number of pages out of the .SHD file in the spool folder?
If so, how do I get it? I couldnt find any documentation regarding this issue, and I'm looking for it for like a week, and no luck at all.

Thanks in advance!
Carlos,

I may have something I could show you that I think is pretty much what you want. It will be simpler, however, if you open a support issue, as it will be easier to explain the process on the phone.

Go to our web page, then Services->Support->Report an Issue, and give your contact information so that we can call you back. I recommend you provide a link to this thread, in case the tech assigned to the case isn't me.

Regards,
Rapha

Top
#31433 - 07/23/09 01:40 PM Re: Wrong Page Count
carlos kochhann Offline
Junior Member

Registered: 07/21/09
Posts: 15
Benoit,
Thanks a lot!
Is this the screen you meant?
I can't find any other that would suit the description.
If its this, then is something there missing?

Sorry for the trouble, I'm kinda new to this.

edit: lacking the image.


Raphael, I'll see here in the company about this service. They asked if its a free call or how it works. As I'm not in charge of anything here, I can't decide this.

Top
Page 1 of 3 1 2 3 >