cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a static keyword to a document in a scan queue?

Zachary_Burke1
Star Contributor
Star Contributor

Hello Community,

We are trying to statically add a keyword to every document processed within a specific scan queue. The best way we have come up with to do this is by using a script with the pre-index script hook, as per Steve Reed's recommendation in previous posts. To test our script we are sweeping documents into the scan queue, will this work or do documents need to be scanned into the scan queue? We have been so far unsuccessful and do not understand why the script is not working properly. Can someone please take a took at this and provide us some feedback. 

Code Removed by Community Admin.

2 ACCEPTED ANSWERS

Steve_Reed
Employee
Employee

If you're setting this up as a pre-index script, then it would work the same for both scanned or swept documents, with the caveat that all of these batches are being routed to manual indexing (that is, they aren't skipping indexing because they were scanned/swept in full-index mode).  As a user starts to index a batch, the hooked pre-index script is fired once for each document right at the beginning of the index operation for that document.  So the script as you have it above is getting the keyword panel object and asking it to set the keyword value into the panel (not directly onto the document, just the keyword panel as the user sees it during indexing - the keyword value would be applied to the document when the user hits the index button).  But - your script isn't setting a document type into the panel, so unless the documents coming into the index process already have a document type *and* that document type includes the "Project #/Cost Center" keyword type, you wouldn't see any result (because the script is trying to set a keyword value that isn't currently in the keyword panel).  If this is the case (i.e. either the documents to be indexed don't have a document type, or they do but that document type doesn't include that keyword type) then you may need to modify this script to also set a document type into the panel before adding the keyword value.

View answer in original post

Steve_Reed
Employee
Employee

I wanted to include a screen shot of the two script hook contexts I'm referring to in my comment above, but can't include a screen shot in a comment, so had to respond in a new thread:

View answer in original post

5 REPLIES 5

Steve_Reed
Employee
Employee

If you're setting this up as a pre-index script, then it would work the same for both scanned or swept documents, with the caveat that all of these batches are being routed to manual indexing (that is, they aren't skipping indexing because they were scanned/swept in full-index mode).  As a user starts to index a batch, the hooked pre-index script is fired once for each document right at the beginning of the index operation for that document.  So the script as you have it above is getting the keyword panel object and asking it to set the keyword value into the panel (not directly onto the document, just the keyword panel as the user sees it during indexing - the keyword value would be applied to the document when the user hits the index button).  But - your script isn't setting a document type into the panel, so unless the documents coming into the index process already have a document type *and* that document type includes the "Project #/Cost Center" keyword type, you wouldn't see any result (because the script is trying to set a keyword value that isn't currently in the keyword panel).  If this is the case (i.e. either the documents to be indexed don't have a document type, or they do but that document type doesn't include that keyword type) then you may need to modify this script to also set a document type into the panel before adding the keyword value.

The default document type is being set within the scan queue settings. That document type does have the corresponding keyword associated with it. When we go to index the swept document, the projectnum is blank.

Are you saying that it should be filled in by the script at this point? or does the projectnum get added after we click "index"?



Really what we are trying to do is add this static keyword to the document as it comes in and then launch a workflow process without any further indexing. Maybe we are going about this the wrong way since it seems like this current method does require subsequent manual indexing. What are some other options that we can use?

<duplicate>

You could instead create a VB script to run on both 'post-scan' and 'sweep document' (it can be the same script) that is coded as below (I modified your original script to act on the document instead of the panel, because in both the 'post-scan' and the 'sweep document' contexts, the script fires on each document that was just scanned or swept instead of acting on the keyword panel like a pre-index script does). Also note that this script is still assuming the document type is already set on each document (i.e. you scanned or swept in pre- or full-index modes and set the appropriate document type):

dim obapp

set obapp = CreateObject ("onbase.application")

dim curdoc

set curdoc = obapp.CurrentDocument

dim projectnum

projectnum = 435310

dim dockeys

set dockeys = curdoc.Keywords

dockeys.AddKeyword "Project # / Cost Center", projectnum

curdoc.StoreKeywords

set dockeys = Nothing

set curdoc = Nothing

set obapp = Nothing