Vincent,
While PlanetPress itself cannot keep a count in memory permanently, it is doable through the use of a vbscript and the exexscriptfile command. Create a global variable of type integer, and for this example, let's call it "MyNumber". Then, in the PressTalk Before of the page where you need to get a new number, add this line:
&MyNumber := execscriptfile('C:\\getcounter.vbs', '', 0)
This will load a getcounter.vbs vbscript file, which will return a new number, and keep track of the counter in a text file. Here's an example of what the code could look like for that vbs:
dim FSO
dim SavedNumber
dim i
dim newnumber
set FSO = CreateObject("Scripting.FileSystemObject")
set SavedNumber = FSO.OpenTextFile("C:\number.txt", 1)
i = SavedNumber.ReadLine()
SavedNumber.Close
newnumber = CInt(i) + 1
set SavedNumber = FSO.OpenTextFile("C:\number.txt", 2)
SavedNumber.WriteLine(CStr(newnumber))
SavedNumber.Close
Script.ReturnValue = newnumber
This assumes that you've created a "number.txt" file, and that you've typed 0 on it's first line(or whatever number you want to initialize it at). Everytime the page is executed, this will return an integer number that keeps increasing, so you can use that to create the invoice number that you want.
The drawback to this method is that during design time, the script will be executed several times everytimes you click on the page, causing the counter to keep increasing. So, before putting this into production, make sure you reset the counter to the value that you need.
Hope that helps!
Regards,
Raphaël Lalonde Lefebvre