01-17-2011 03:54 PM
Hi,
I am trying to open an existing .xls file from the same location as the test sequence file. Can TestStand search in the test sequence file location for the input file and then select it if present? Also, can the output file be stored in the same location without specifying the path in the code?
Example:
Input.xls -> Input file to the test sequence that is to be read.
Output.xls -> Output file created by the test sequence.
Test.seq -> Test sequence that reads Input.xls and creates Output.xls.
If Test.seq and Input.xls are present in D:\Test\ location, can the code Test.seq be modified to pick up Input.xls automatically without specifying the path? Also, can Output.xls be created at D:\Test\ without specifying the path?
Thanks,
Sayali
Solved! Go to Solution.
01-18-2011 08:32 AM
Hi Sayali,
Yes this can be done. You can get the path to the current sequence file using RunState.SequenceFile.Path. Then search for and strip off the last '\' using the String functions to get just the path. You can then use this directory path to manage your Input.xls and Output.xls files.
-Jack
01-18-2011 06:38 PM
Hi Sayali,
Thanks for your suggestion Jack. Another thing you could do would be to use the FindFile function. So if I was trying to pass the file 'Test.dat' which is saved in the same directory as my sequence and I had a local variable called FilePath I could run this expression:
Locals.filefound = FindFile("Test.dat", True,Locals.FilePath)
and the full path of Test.dat would be stored in Locals.FilePath.
Hope this helps!
01-19-2011 07:52 AM
Thanks a lot for the suggestion! I will try this one too..
Thanks,
Sayali
02-09-2011 10:47 AM
Hi Sayali,
I'm using the "Property Loader" in the "PreUUTLoop" to load test limits according the model selected. Just before the Property Loader step I have a Message Popup asking for the model to test and in the Post-Expression:
Locals.LimitFileToLoad = Left( RunState.SequenceFile.Path, Find( RunState.SequenceFile.Path, "\\", 0, False, True ) ) + ((Step.Result.ButtonHit == 1) ? "\\Limits\\Limits_50k.xls" : " \\Limits\\Limits_100k.xls")
The Property Loader use: Locals.LimitFileToLoad in the file name expression.
02-09-2011 12:33 PM
Hi,
Thanks a lot for the suggestion. However, I will not be trying this method as we avoid having pop-up messages in our tests.
Appreciate your help though!
Thanks,
Sayali