dkey Posted November 15, 2017 Posted November 15, 2017 In my DB I have a text file which tells me the size of audio and video clips as such 927 KB or 1020 KB and 27.5 MB or 15.26 MB and 2.01 GB or 11,3 GB I used the following suggestion from this forum: Mediasize::MediaSize * If ( PatternCount ( Convert Mediasize::MediaSize ; "GB" ) ; 1024 ; 1 ) but while it works fine with GB it doesnt work with MB or KB Instead of doing a script a did a calculation as such Case ( PatternCount ( Convert Mediasize::MediaSize ; "GB" ) ; Convert Mediasize::MediaSize* 1024; PatternCount ( Convert Mediasize::MediaSize ; "KB" ) ; Left ( Convert Mediasize::MediaSize ; Length ( Convert Mediasize::MediaSize ) - 3) /1024^2 ; PatternCount ( Convert Mediasize::MediaSize ; "MB" ) ; "0,00" & Substitute ( Left ( Convert Mediasize::MediaSize ; Length ( Convert Mediasize::MediaSize ) - 3) ; "." ; "" ) ) I used the Substitute function as in my country we use commas for decimals however while the calculation works I get really large numbers for KB files and MB files Is there a different way to calculate the text files to get regular number with perhaps a maximum of 3 decimals? I could use it as a script or as a calculation defining the field Thanks a lot and regards
dkey Posted November 15, 2017 Author Posted November 15, 2017 Thanks for your interes and time. But .... How do I add it as a custom function to my FMPADV 13? If I use it as a calculation or script FMP tells me it cannot find various fields and I am totally lost Thanks again
dkey Posted November 16, 2017 Author Posted November 16, 2017 (edited) Thanks for your interest however even following step by step I am unable to create the external function After I paste in New external function the code FMPADV 13 tells me I need to enter the function for: Floor ( Ln ( bytes ) / Ln ( _ratio ) ) It selects the word bytes and I am unable to continue as I am not skilled enough to do it Even if some kind person will help to find the "bytes" I am afraid I will run into some similar or different tasks which I won't know how to solve. Thanks however Dan Edited November 16, 2017 by dkey
jbante Posted November 16, 2017 Posted November 16, 2017 While you're editing the custom function, you need to set what the parameters are before the calculation will recognize the "bytes" and "precision" tokens, which would be undefined otherwise.
Recommended Posts
This topic is 2952 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now