This tip demonstrates how to search for data by previous number of days; how to search by content type; how to use the ArcIMS Metadata Service search engine to search published documents; and how to run a search without showing the Search dialog box.
You could use a macro like this to define and execute a search that you run periodically. To end the search before it has finished, click the Search button on the Standard toolbar and then click Stop.
How to use
- Paste this macro into VBA.
- Change the path.
- Change the location where the search should begin.
- Run the macro.
Sub ArcIMSPreviousContentType()
'create a new query object and set name for saved search
Dim pQ As IQuery
Set pQ = New FileSystemQuery
pQ.NameOfQuery = "published last week"
'search by previous number of days, e.g., data published in the last week. Publication date
'refers to when the data was published, as defined in the metadata. FGDC and ISO
'metadata elements in Citation section are examined.
pQ.DateType = esriFindDateTypePublication
pQ.DateOperator = esriFindDateOperatorPrevious
pQ.Date1 = "7"
'search by content type. Only appropriate when searching an ArcIMS Metadata Service.
Dim pIMS As IArcIMSQuery
Set pIMS = pQ
pIMS.ContentType = esriContentTypeLiveData
'get the Search dialog box object, then get the available search engines
Dim i As Integer
Dim pFD As IFindDialog
Dim pSE As ISearchEngine
Dim pSEP As ISearchEngineProperties
Set pFD = New FindDialog
For i = 0 To (pFD.GetNumSearchEngines - 1)
Set pSE = pFD.getSearchEngine(i)
Select Case pSE.Name
Case "ArcIMS Metadata Service"
'enable ArcIMS Metadata Service search engine. This engine sends an ArcXML
'search request to an ArcIMS Metadata Service. The Metadata Service evaluates
'the search criteria against metadata documents published to that service and then
'sends an ArcXML response to ArcCatalog.
pSE.Enabled = True
'search a folder in the ArcIMS Metadata Service. The Catalog tree must contain a
'connection to the ArcIMS server, though it may be disconnected. Login information
'must be provided when the connection is created.
Set pSEP = pSE
pSEP.LocationString = "GIS Servers\Geography Network Services hosted by ESRI\Browse_Metadata\ESRI"
Case Else
'disable other search engines
pSE.Enabled = False
End Select
Next
'initialize search components, then execute the search
pFD.Show False
pFD.DoSearch pQ
End Sub