topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 12:56 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: convert time  (Read 6471 times)

lullabylin

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
IDEA: convert time
« on: April 18, 2007, 09:36 AM »
Hi, I would LOVE to have a little widget that would enable conversion between TIME tracked in increments of sixty and increments of 100.
I have to keep track of media time (hours, minutes, seconds as shown in a standard media player) and time as a quantity in a spread sheet.

The spread sheet recognizes seconds as increments of a hundredth instead of increments of 1/60th.
A widget to convert back and forth from 100th's to 60th's would be SO SUPER!!!!!
LullabyLin

PS Here is a link to a page that has a conversion function like I'd like in a freestanding tool:  http://www.springfro...ter/decimal-time.htm
« Last Edit: April 18, 2007, 10:07 AM by lullabylin »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: convert time
« Reply #1 on: April 18, 2007, 08:08 PM »
Here's a possible solution:

;ConverTime
;By jgpaiva
;date: June 2006
;Function:

MsgBox,4,Hours/Minutes to Decimal?,Convert Hours`,Minutes and seconds to Decimal?`n  (select No to do the reverse operation)
IfMsgBox Yes
{
  InputBox,Time,Input Time,Please input time in the following format: Hours:Minutes:Seconds
  StringSplit,something,Time,`:,`:
  if something0 <> 3
  {
    msgbox,wrong parameters
    exitapp
  }
  result := something1 + something2 /60 + something3 / (60*60)
  msgbox,% result
}
IfMsgBox No
{
  InputBox,Time,Input Time,Please input time in the decimal format
  hours := time // 1
  minutes := ((time - hours) * 60) //1
  seconds := ((time - hours - (minutes/60)) * 60 * 60) //1
  msgbox,Hours: %hours%`nMinutes: %minutes%`nSeconds: %seconds%
}
Just paste that in notepad, save it as ConvertTime.ahk, download and install autohotkey and double-click ConvertTime.ahk ;)

lullabylin

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: IDEA: convert time
« Reply #2 on: April 18, 2007, 09:54 PM »
Thanks, JG.  I already use AHK and love it as a sort of typing expander. 
So your widget is really neat but I am still scratching my head because I don't really want to convert the minutes and seconds to decimal as in a time clock decimal system of time.
I track time played of media files as a quantity in a spreadsheet that is then multiplied by an hourly rate.  If I multiply the total minutes and seconds by a number, I don't get the right thing because the quantity of seconds should be converted since it's based on a sixtieth and should be based on tens to be accurate.  Maybe I need to go back to 5th grade!!!! 
Thank you very much for sharing your script.  I'm going to sleep on it and maybe insight will come ...  :tellme:

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: convert time
« Reply #3 on: April 21, 2007, 06:35 AM »
Sorry but i don't quite get what you mean.
Notice that the script i made does exactly what the webpage you mentioned does.
To select the way the time is converted, you have to press yes or no at the beggining.
From what you described, i think that you pressed 'yes'. Try pressing 'no' at the beggining, and see if that's what you want ;)