Trick to stop truncated decimal numbers via runret() of mediainfo

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
arazi89
Posts: 26
Joined: 08 Jul 2023 16:03

Trick to stop truncated decimal numbers via runret() of mediainfo

Post by arazi89 »

Hello,

Using simple scripting for a Custom Column (derived from a highend post from a while ago):

$mediaInfo = "C:\Program Files\MediaInfo_CLI\MediaInfo.exe";
$info = regexreplace(runret("$mediaInfo --Inform=Video;%DisplayAspectRatio% ""<cc_item>"""), "\.\d*\r?\n");
return $info;


The above simple script being used multiple times, altered for multiple different data fields returned to multiple different Custom Columns. For video files, most fields are returning just fine via the script for their Custom Column. But two of the fields are not: Video;%DisplayAspectRatio% and General;%FrameRate% . Both of these are decimal numbers that return just fine running mediainfo from the Windows cmd prompt. But via the Custom Column scripting %DisplayAspectRatio% is truncated from 1.777 to 1 And General;%FrameRate% is truncated from 23.976 to 23

Ideally, in the script, I need the full 1.777 Display aspect ratio (decimal number) to use in a calculation with the Video;%Height% value in order to calculate a custom DISPLAY WIDTH column. That is the ultimate goal.

QUESTION: What is the latest trick/workaround to get decimal numbers -- returned from anywhere, but in this specific case from mediainfo --- into a xyplorer script variable so it can be used as a decimal number in a calculation?

Thank you!
XYplorer 27.10.0800 LLP
Windows 11 Home 24H2 26100.6584

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Trick to stop truncated decimal numbers via runret() of mediainfo

Post by highend »

Then remove the \.\d* part?
One of my scripts helped you out? Please donate via Paypal

arazi89
Posts: 26
Joined: 08 Jul 2023 16:03

Re: Trick to stop truncated decimal numbers via runret() of mediainfo

Post by arazi89 »

highend wrote: 12 Sep 2025 06:58 Then remove the \.\d* part?
Thank you so very much.

I had tried it entirely without the regexreplace() and that didn't change the output. So, I had moved off that trail too early.

Thank you!
XYplorer 27.10.0800 LLP
Windows 11 Home 24H2 26100.6584

admin
Site Admin
Posts: 64848
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Trick to stop truncated decimal numbers via runret() of mediainfo

Post by admin »

"XYplorer 27.10.0800 LLP" ... LLP? Live Long & Prosper? :biggrin:

arazi89
Posts: 26
Joined: 08 Jul 2023 16:03

Re: Trick to stop truncated decimal numbers via runret() of mediainfo

Post by arazi89 »

admin wrote: 13 Sep 2025 09:50 "XYplorer 27.10.0800 LLP" ... LLP? Live Long & Prosper? :biggrin:
That's a nice thought, at least! I'm an active 'modest' level Thoroughbred trainer. So with any luck I may stay healthy enough to get half of that.
XYplorer 27.10.0800 LLP
Windows 11 Home 24H2 26100.6584

Post Reply