I have an app that uses applescript to convert a time value in seconds of 3753.706791 in to hours, minutes, seconds, and frames (30fps) giving me
01:02:33;21
I now need to convert back to seconds but I am having problems with the frames
I can get the times back in to seconds via
set theText to "01:02:33;21"
set AppleScript's text item delimiters to [";"]
set stringToUse to theText as string
set time_5 to last text item of stringToUse
set frames to (time_5 as number) / 30
this returns a value of 0.7
Now I’m not going to lie to you my maths is terrible but are there terms to use to get back the value i need which is
0.706791
Any mathematical/applescript geniuses out there that can help?
What Yvan means is that you will loose precision, when you round to an integer value: it is no returning back.
If we have a look at what you do loose, it is 0.2 frames. 0.2 frames is nothing you can show, and should really be rounded away, but if you want to be sure, that you have enough footage, then I think the easiest thing would be to add 1 frame for good measure. (I believe you can never loose more than one frame anyway).
Edit
You can of course also use the round command to be sure that you have enough frames to cover the time-span in question.
set roundedFrames to round (0.706791 * 30) rounding up
log "" & roundedFrames
--> 22