cancel
Showing results for 
Search instead for 
Did you mean: 

Remove .pdf extension from keyword

Jill_Friedow
Champ in-the-making
Champ in-the-making

Hi,

I setup a sweep to bring in file name as keyword.  All works well, except it brought in the file extension as well (.pdf).  I would like to remove this from the keyword either at sweep or pre-index using a vb script hook.  I tried this script, and it is not working:

Dim obapp
 set obapp = CreateObject("Onbase.Application")

 Dim keypanel
 Set keypanel = obapp.IndexKeywordPanel
 
 Dim keywords
 Set keywords = keypanel.Keywords

   If (objKeyword.Name = "Portfolio Code") Then
   strPC = Trim(objKeyword.Value)
   strPC = trim(replace(strPC, ".pdf", ""))

 objKeyword.Value = strPC
 objDoc.StoreKeywords

end if

keypanel.UpdateKeywords

Set keywords = Nothing
Set keypanel = Nothing
Set obapp = Nothing

end sub

Thanks.

 

 

 

2 REPLIES 2

Stacey_Greenwoo
Champ on-the-rise
Champ on-the-rise

Jill,

Did you ever get resolution on this.  We want to do the same thing.

Seth_Yantiss
Star Collaborator
Star Collaborator

Jill,

It might just not have been included in the code snip, but I am not seeing where you are setting OBJKeyWord as an object.  Additionally, what is the name of the SUB?  Main or Main35?  I think you have to loop through all the keywords using a For Each or some other loop, like a Keyword count, while checking for the specific Keyword name.

I would put the UpdateKeywords method inside of the IF loop to keep the script from updating keywords if there's no change to them.

Here's a snip of the code I use to set the objKeyword Object:

Set MyApp = CreateObject("OnBase.Application")
Set objCurrentDocument = MyApp.CurrentDocument
Set objKeywords = objCurrentDocument.Keywords

Cheers,
Seth