Special Bates numbering needed

Dear fellow DTP3 Users,

I hope to find help in this forum to get the following task done right, using only DTP3 and, if possible, no external tools.

Usually there are 2 ways in wich my documents find their way into DTP3:

  1. I scan paper documents with my 2 desktop scanners which reach them to DTP3 automagically.
  2. I get documents via Mail or whatever and “save” them to DTP3.

In both cases these documents are imported and are automatically 'ocr’ed and put into DTP3s Global Inbox.

What I now would like to do is, that these 'ocr’ed Dokuments get imprinted with an ‘intelligent’ Bates-Number and get this number as their document name and are put into a special folder in my database, from where they are manually tagged, get their name completed, etc and are sorted into the correct folder in my folder-structure.

The first 2 digits of the Bates-Number should be the last two digits of the year in which the document enters DTP3. The following 4 digits are counted up with each document. The last digit should be the number of the Workstation on which the Document ist imported. My iMac (“1”) or my MacBook (“2”).

Document scanned in 2019 on my desktop: 1900151.
Document scanned in 2020 on my laptop: 2000342.

Background is, that documents are imported in both places which are synchronised using DTP3s sync options and I fear that the bates number can’t be synchonized too. 2nd background is, that paper documents are “saved” in physical “offline” Folders marked with the year, to be able to get found again if necessary.

To get the task more complicated, I’d like to get copies of electronic documents before they are imprinted with the Bates-number, as they are often cryptographically signed and the signature would get broken while imprinted.

I searched this forum and found fragments here and there, but they are usually referring to earlier versions of DTP and I do need a seamless automatic workflow to use DTP3 at its full capacity.

Is there anyone willing to help me, as I think that I am not the only one who struggles with paper and electronic documents that both need to be Bates-numbered without printing digitally signed documents to archive them.

Any help is appreciated!



A smart rule executing this embedded script could do this:

property pMachine : "1"

on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with theRecord in theRecords
			set theDate to addition date of theRecord
			set theYear to year of theDate
			set theNum to (bates number of theRecord) as string
			repeat while (length of theNum) < 4
				set theNum to "0" & theNum
			end repeat
			set theName to ((theYear - 2000) as string) & theNum & pMachine
			set name of theRecord to theName
		end repeat
	end tell
end performSmartRule

The property pMachine has to be changed on each machine.

1 Like

Wow! Thanks, cgrunenberg!

Now, how do I have to implement this in particular?

And is there a possibility to reset the bates-number each new year? Or in other words, what happens if the bates-number gets over 9999?

We are getting closer! :slight_smile:

Thanks again,

The rule should look like this, then click on “Edit Script…” and paste the code.

Afterwards you should probably add more conditions and choose the trigger which should perform the renaming. Or you can test this rule by dropping items onto it.

The script uses at least 4 digits but more if necessary.

1 Like

Very nice, cgrunenberg! Thank you very much!

I will try this out in a few hours.

Please allow one (or two) more question(s): Where in your script is the imprinting of the document done? And is there a possibility to notice if a document is digitally signed? (In this case I need an ADDITIONAL copy of the original document named something like “1900051-o”, which is NOT imprinted.)

Thanks again for your help!

The script doesn’t imprint documents, it only renames them currently (easier for testing). But a modified version could imprint documents.

Ok, I will try it in any case! Thanks again!

One very last question please on how bates numbers are implemented in DTP3: Does every document have its bates-number in any form automagically? Or is the bates number only given to a document explicitly (eg through your script)? Or am I totally wrong in my idea of bates numbers in DTP3? :-/


As soon as the bates number is requested for an item (e.g. via scripting or placeholders), the item stores the assigned bates number in the database so that using the script/placeholder multiple times on the same items always has the same results.

1 Like

Is there a possibility to get the original bates number given to a document by DTP3 shown anywhere?

It’s not visible in the user interface, it’s only accessible via AppleScript and placeholders.

Hey ho!

Thanks again! I played around with your script a little bit and I am now very close to the wanted solution. As I use a “dirty” workaround (via the documents name) at the moment to assign the “special bates” to my (in the preferences) selfcreated value MyBates I’d like to know how to assign this value in my script. When all is done I’ll share my script here.

This leads me to the question if there ist any scripting documentation available. I couldn’t find anything on the (german) homepage.

Thanks in advance for your script which put me on the right way!


You can inspect the AppleScript support of any app by dragging & dropping the app onto the Script Editor.app in the Dock/Finder.