# Changing filepath for result listener outside of test automation ui

**URL:** <https://forum.opentap.io/t/changing-filepath-for-result-listener-outside-of-test-automation-ui/362>\
**Category:** Technical\
**Tags:** plugin\
**Created:** [June 24, 2021, 11:44pm UTC](https://forum.opentap.io/t/changing-filepath-for-result-listener-outside-of-test-automation-ui/362 "2021-06-24T23:44:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric.harrison](https://avatars.discourse-cdn.com/v4/letter/e/bc79bd/32.png) [@eric.harrison](https://forum.opentap.io/u/eric.harrison)\
**Post date:** [June 24, 2021, 11:44pm UTC](https://forum.opentap.io/t/changing-filepath-for-result-listener-outside-of-test-automation-ui/362/1 "2021-06-24T23:44:33Z")

</div>

For the result listeners, the file path for the result file is configured through the test automation ui. This is done when you add a new listener. Is there a way to modify this file path programatically? I have a plugin where I want to publish results, and set the file path through the plug in.

---

<div class="post-metadata">

**Author:** ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)\
**Post date:** [June 24, 2021, 11:52pm UTC](https://forum.opentap.io/t/changing-filepath-for-result-listener-outside-of-test-automation-ui/362/2 "2021-06-24T23:52:45Z")

</div>

There are a couple of ways to do this depending on what you are trying to set the path to:

1. There are a few built in macros:

2. You can use existing Windows Environment Variables:

3. Use your plugin to create/set an environment variable:

```csharp
     Environment.SetEnvironmentVariable("Test1", "Value1");

```

---

<div class="post-metadata">

**Author:** ![eric.harrison](https://avatars.discourse-cdn.com/v4/letter/e/bc79bd/32.png) [@eric.harrison](https://forum.opentap.io/u/eric.harrison)\
**Post date:** [June 24, 2021, 11:57pm UTC](https://forum.opentap.io/t/changing-filepath-for-result-listener-outside-of-test-automation-ui/362/3 "2021-06-24T23:57:49Z")

</div>

From the UI, the user enters a file path in the red line, and the result listener is configured. I want to create a custom ui where I take the filepath as input, and then set that for the result listener. Even though the UI already does this, I want to see/modify this path.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opentap/original/1X/cbab8dfa5f3213f51fb583d129519cc01ac68b11.png)

---

<div class="post-metadata">

**Author:** ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)\
**Post date:** [June 25, 2021, 12:15am UTC](https://forum.opentap.io/t/changing-filepath-for-result-listener-outside-of-test-automation-ui/362/4 "2021-06-25T00:15:57Z")

</div>

Hmm, I’m not sure I completely follow, but in that UI, could you set the FilePath to %CustomResultPath% and then set that Environment Variable from without your plugin?

Unless you are going for a full custom UI, then you can access the ResultsSettings object to get to to all the connected Result Listeners. From there you can do something like this (there are for sure better ways to select the specific Result Listener, but just as an idea):

```csharp
var resultListener = ResultSettings.Current.First(rl => rl.GetType().Equals(typeof(LogResultListener)));
(resultListener as LogResultListener).FilePath = new OpenTap.MacroString() { Text = @"C:\New File Path" };

```
