Navigation: Scripting Reference Manual > Functions & Subroutines > FindText

 

FindText

 

Contact Us: fredsupport@photonengr.com

 

Description

This function searches the description fields for any object in the Optical Sources, Geometry and Analysis Surface(s) folders for matches with an input string, returns the number of matches found and then populates an array with the entity node numbers where the match occurred.  The description field only needs to contain the search string for a match to be positive.

 

Syntax

nItems = FindText ( searchString, items() )

 

Parameters

nItems (Long)

Returned number of items whose description string matched searchString.  The input variable, searchString, only needs to be a substring of the description field for a match to occur.

 

searchString As String

Input string being compared against the description fields of the entities.

 

items( ) As Long

After the function is executed, this array is populated with the node numbers of the entities whose description fields contained searchString.

 

Example

The example below demonstrates how to use the FindText command to report a listing of entity full names of the objects in the model whose description string matched the search string.

 

Sub Main

 

    'String we want to search for

    Dim txtString As String

    txtString = "Delete Me"

 

    'Search the tree

    Dim nItems As Long, items() As Long

    nItems = FindText( txtString, items() )

 

    'How many items did we find?

    Print ""

    Print nItems & " items found with the description: " & txtString

 

    'Loop and print out the item full names

    Dim cItem As Long

    For Each cItem In items()

        Print Chr(9) & GetFullName( cItem )

    Next

 

End Sub

 

See Also

FindName

FindFullName

GetParent

GetType

 

 

 

 

 

Copyright © Photon Engineering, LLC