Returns the list of Solid Edge files that contain given text.
Visual Basic |
---|
Public Sub FindSEDocumentsContainingText( _ ByVal text_to_search As String, _ ByRef psaScope() As Variant, _ ByVal file_types As String, _ ByVal bIncludeSubFolders As Boolean, _ ByRef FilesFoundInSearch() As String _ ) |
Imports System.Runtime.InteropServices Imports System.IO Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim objApp As SolidEdgeFramework.Application = Nothing Dim Scope(0 To 1) As Object Dim FileNames(0 To 1) As Object Try If objApp Is Nothing Then Try objApp = GetObject(, "SolidEdge.Application") Catch ex As Exception End Try If objApp Is Nothing Then objApp = CreateObject("SolidEdge.Application") End If End If 'Make sure that the folder is indexed. Scope(0) = "C:\Program Files\Solid Edge ST10\Training" objApp.Visible = True objApp.FindSEDocumentsContainingText("TestText", Scope, ".dft", True, FileNames) Catch ex As Exception MsgBox("Exception occurred " & ex.Message) End Try End Sub End Class
using System; using System.Windows.Forms; using System.Runtime.InteropServices; using System.IO; public class Form1 { private void Button1_Click(object sender, EventArgs e) { SolidEdgeFramework.Application objApp = null; object[] Scope = new object[2]; object[] FileNames = new object[2]; try { if (objApp == null) { try { objApp = Microsoft.VisualBasic.Interaction.GetObject(null, "SolidEdge.Application"); } catch (Exception ex) { } if (objApp == null) { objApp = System.Activator.CreateInstance(System.Type.GetTypeFromProgID("SolidEdge.Application")); } } //Make sure that the folder is indexed. Scope[0] = "C:\\Program Files\\Solid Edge ST10\\Training"; objApp.Visible = true; objApp.FindSEDocumentsContainingText("TestText", Scope, ".dft", true, FileNames); } catch (Exception ex) { MessageBox.Show("Exception occurred " + ex.Message); } } public Form1() { SubscribeToEvents(); } // private bool EventsSubscribed = false; private void SubscribeToEvents() { if (EventsSubscribed) return; else EventsSubscribed = true; Button1.Click += Button1_Click; Button1.Click += Button1_Click; Button1.Click += Button1_Click; } }