Now, let's get back to the main workflow, Main.xaml, and continue from where we left off:
- Add an Invoke Workflow File activity, right after the log message that we had added within the main sequence's Try block. Within the Invoke activity, set the workflow filename to ReadConfig.xaml.
- To read in the arguments, we'll need to add a couple of variables. Create a new variable called Config of the Dictionary type (Dictionary<String, Object>) and set the scope to a Try-Catch block.
- Add three more variables to store the config file values: strInputFolder, strOutputFolder, and strGoogleAuthName. All these variables are of the String type and the Sequence scope.
- Click on Import Arguments within the activity and map the newly created variable to the output argument values, as shown in the following screenshot:
- Next, let's use three Assign activities to store the outputs from the config file into the three String variables that we created previously. The Assign activities should have the following code:
- strInputFolder = Config("InputFolder").ToString
- strOutputFolder = Config("OutputFolder").ToString
- strGoogleAuthName = Config("GoogleAutheticationName").ToString
- To test these, let's use a Message Box to display the values and test the automation so far. Add the following message to check whether the values have been populated: strInputFolder +" "+strOutputFolder+" "+strGoogleAuthName.
- Staying within the main workflow, go ahead and run the project using the Run option in the UiPath Studio ribbon. Choose Debug File and then Run, just as we did in previous projects. Your output should look as follows:
Please remove the message box after performing this test. Alternatively, you can use the Write Line activity to test and leave it in the workflow, even after testing.
- Finally, let's add a Log Message of the Log Level set to Info and a Message stating "Config File content extracted successfully". This will help us with the debugging process, if required.
Now, we can invoke the configuration workflow and get the values we wish to use within the automation process.
Now, we can use these parameters to call the Google SafeSearch API. Before that, however, let's build an Excel list that we will pass to the API.