03-25-2013 05:01 PM
I am trying to use searchfiles API in teststand by calling Engine.SearchFiles. I am trying to search a string called "OUT". When i execute the steps, i dont see any results that is matched. But i am sure every other file has the word "OUT" in it.
I always get the NumMatches output as 0. Unable to figure out what the actual problem is.
COuld anybody please help ? I am actually using this method to get the results and store it in a file. I cannot use Find/Replace dialog for the same,
Solved! Go to Solution.
03-25-2013 05:15 PM
Did you use the IsComplete method? From the TS Help:
Purpose
Begin a new find in files search.
Remarks
Returns a SearchResults object that is a handle to the asynchronous search already in progress. To wait for the search to complete, call the SearchResults.IsComplete method.
I couldn't see your sequence file because it is newer than my version.
03-25-2013 05:23 PM
Hi Jiggawax,
I used the IsComplete method. But still i couldnt get the result. The IsCOmpleteMethod always returns True and the NumMatches always 0
I have attached the snapshots for your reference since you are unable to open my sequence..
03-26-2013 01:58 PM
I threw together an example. It works nicely for me. I found that it doesn't search the file names for the string. Odd??? Maybe NI can explain that one.
Regards,
03-26-2013 02:41 PM
Hi jigg,
The search function at edit time searches only the sequence file data (Runstate.SequenceFile.Data property) of the sequence file when searching, which does not contain the sequence file path or name. You will notice the same behavior when using the search pane in sequence editor.
03-26-2013 04:00 PM
Hi Jigg,
Thanks for the reply. The solution you gave me works. But could you please enlighten me why the ActiveX calls i used in my sequence doesnt work. Is there any reason for it ? Does the Sequential Process model doesnt support it ?
Thanks
Kris
03-26-2013 04:39 PM
They are both valid ways to call into the TestStand API. The ActiveX steps should not be affected by the process model or any other code in your sequence file. They are direct calls to the engine. However, you had it creating an object in your first step. Not sure what that will do? To eliminate that aspect of it I just use the expression calls.
Maybe it's using a different engine object???... i'm really not sure. Sorry I don't have more information on that. If I had your code I could've figured it out but i'm lame and haven't upgraded just yet. I didn't care to recreate it using the ActiveX steps.
Do you need ot use the ActiveX steps?
Regards,
03-26-2013 04:43 PM
Hi Jigg,
I will do a one to one comparison and figure it out. Will post immediately after I find the reason. I dnt really need to use ActiveX calls, but pretty curious to know the reason. But thanks for the update, I will keep you posted.
Thanks
Kris
03-26-2013 07:33 PM
Hi Jigg,
I figured out the error in my sequence file.
When i call the "SearchFiles" Method, the parameter "directoriesAndFilePaths" was given a variable which had a path like "C:\\Test\\Example\\Search.seq". But when i replaced the "\\" with Single Slash ("\"), the sequence started working.
I am not sure why. I had always assumed TestStand recognizes "\\", when specifying a path instead of "\".
Are you aware of such situations when "\\" should be used or "\" should be used when specifying the path of a directory?
Thanks
Kris
03-27-2013 08:48 AM
Yeah I noticed that too when I created the example. Honestly I haven't nailed that down yet. In this case I think it's because the method wants the paths without the escape characters. Usually it's just trial and error for me...
Regards,