How to get time long of audio by uipath

Hi anyone, i find the way to get timing of audio file but cant get information of [detail] tab in [Properties] file. Can you help me?

you can use fileinfo syntax for get details

Hey!

Could you please explain a bit more?

With the snaps where we’re not getting the properties?

Regards,
NaNi

there activity called get fileinfo you can use that activity to get file information
create out put variable the output data type will be file info , for get creation time use
str_creationtime = outputvar.creationtime

It only get some infor as name file, date,last date But in tab Detail its cant get info, i wwant to get infor like image
image

I want to get time length, and some information in Detail tab of file.

thats not possible you get directly , you can only do with foreground automation

like navigate to the particular folder path and right click on file then you can choose properties

after you have to take screenshot

Thanks you, it can have a solution to get infor detail diectly, and im seeking.

Hey!

For length you can try like this

Assign StrLength = new System.IO.FileInfo("FilePath").Length.ToString

Regards,
NaNi

Thanks you, let me try.

can you look on this link?

Hey!

Have a view on this thread as well

Regards,
NaNi

Hi,

The following approach might help you.

[System.Runtime.InteropServices.DllImport("winmm.dll")]
static extern Int32 mciSendString(string command, System.Text.StringBuilder buffer, int bufferSize, IntPtr hwndCallback);
string cmd;
var buffer = new System.Text.StringBuilder(new string((char)0,255));

cmd ="set time format milliseconds";
mciSendString(cmd,null,0,IntPtr.Zero);

cmd ="status \""+fileName +"\" length";
mciSendString(cmd,buffer,buffer.Length,IntPtr.Zero);

ret = buffer.ToString();	

Sequence.xaml (6.4 KB)

Regards,

it doesnt work,thanks.

Thanks, its seem good idea, but not work on my machine, can be something wrong in your.

It’s amazing how many people don’t carefully read questions. He doesn’t want the size of the file, people, he wants the LENGTH IN TIME of the audio file.

Anyway @Bin_Bin there doesn’t appear to be a simple way to do this programmatically.

Have you tried opening it in Windows Media Player and getting the time from there?

yes, it is one of solutions, i see the @Yoichi solution can be feasibility, but i dont know about programing language to write code. Anyone could help me the way how to add class library into uipath? i find C# solution, but i dont know how to add MP3Header Class library into uipath.
this is website of solution : .net - How to get the length of a MP3 in C# - Stack Overflow
image

Well, have you tried it? It would be the simplest way to get the audio length.

By the way, I’m not sure why you’re having trouble getting it from the file Properties. Works fine for me:

yes thanks, its good i dea, and i want one more idea can work in console mode.