Navigation: Scripting Reference Manual > Functions & Subroutines > KeywordDelete

 

KeywordDelete

 

Contact Us: fredsupport@photonengr.com

 

Description

This function deletes the keyword node given as input and returns the count of keywords following the deletion operation.  If the keyword node given as input is invalid (i.e no keyword exists at the given node number), then the script will halt with an error.

 

 

Syntax

kwCount = KeywordDelete( kwNode )

 

 

Parameters

kwCount (Long)

Returned number of keywords that exist in the document after the deletion operation is complete.

 

kwNode As Long

Input keyword node number of the keyword being deleted.

 

 

Example

The example below demonstrates how to loop over the keywords in a document and delete any keywords whose description matches a search string.

 

Sub Main

 

    ClearOutputWindow()

 

    'This is the description we want to search for

    Dim searchDesc As String

    searchDesc = "Created by script"

 

    'Retrieve the number of keywords in the document, then loop

    'over them, retrieve the description and delete any keywords

    'with a description matching our search string.

    'Loop in reverse order to make sure we delete from the end of

    'the node list, otherwise the deletion operation can result in

    'an array bounds error.

    Dim kwNum As Long, curKw As Long

    Dim kwDesc As String

    kwNum = KeywordCount()

    For curKw = kwNum-1 To 0 Step -1

        kwDesc = KeywordGetDescription( curKw )

        If kwDesc = searchDesc Then

            KeywordDelete( curKw )

        End If

    Next

 

End Sub

 

See Also

Keyword Scripting Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC