How to convert a path string to Local IResource StuidoX

Hi, there’s no multi line script support that I can find.
So how do I use a path string to populate DownloadFileFromURL’s DownloadFile value?
Thanks

@Serwei

Use path exists activity…the output of it will have the ilocalresource as output variable that cna be used

cheers

If there’s no multi-line script support, you can typically provide the path string directly in the activity’s properties

1.Locate the “DownloadFileFromURL” activity in your workflow.
2.Set the “DownloadFile” Property:

  • In the properties pane for the “DownloadFileFromURL” activity, you should find a property called “DownloadFile” or something similar.

3.Populate the “DownloadFile” Property:

  • In the “DownloadFile” property, you can provide the path string directly. If the “DownloadFile” property is expecting a file path, you can either type the path directly or use a variable to store the path and then assign that variable to the “DownloadFile”

For example, if you want to download a file to the path “C:\MyDownloads\downloadedfile.txt,” you can enter that path directly in the “DownloadFile” property:

C:\MyDownloads\downloadedfile.txt

@Serwei

If you have the path stored in a variable, you can assign it like this

DownloadFile = "C:\MyDownloads\downloadedfile.txt"

Hi,

I think DonwloadedFile property is out type. So we cannot pass any data to the property.
If you want to direct downloaded filename, can you try to use SaveFileAs property?

Regards,

When your files aren’t stored as an IResource type variable, there’s an option to perform a conversion. Use LocalResource.FromPath(<reference_to_the_file>) in the Input property field for this.

Consider a scenario where you are iterating through a list of files using a For Each activity. Suppose currentItem is your iterating variable. To convert currentItem into IResource, paste LocalResource.FromPath(currentItem) into the Input field.

@Selcuk_Kirtas

Welcome to the community

try this…this will give you ilresource list

Directory.GetFiles("Path").Select(function(x) LocalResource.FromPath(x)).ToArray

cheers

1 Like