Trick to stop truncated decimal numbers via runret() of mediainfo
Posted: 12 Sep 2025 00:51
Hello,
Using simple scripting for a Custom Column (derived from a highend post from a while ago):
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!
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!