Hi Gordon I didn't find any more way to do my script with your function. I think i should tell you some details about my script because may be I don't understand your functions clearly. 1. I create an input box for students to fiel out their name, their class and the amount of time (minute) to perform a test 2. Students should be given a hotkey to start their test. The script will perform a schedule function according to their amount of time. When they're out of time, the keyboard lock automatically 3. whenever students finished their test, they use a hotkey to lock their keyboard. And i would like to calculate the time from their start time to that point. I did very well two steps, and now, if you have free time, please show me how to do the lat step. I think your function can do it but don't know how to use Thanks so much. ________________ Dang Manh Cuong HCMC University of Pedagogy: The Psychology and education Mobile: +84 902-572-300 E-mail: dangmanhcuong@xxxxxxxxx Yahoo ID: manhcuong0312 Skype name: dangmanhcuong facebook: Manh Cuong Dang Blog: http://vi.netlog.com/Cuong_littlecat Website: http://ngoisaodanduong.com http://www.saomaicenter.org Projec-Website: http://code.google.com/p/dangmanhcuong ----- Original Message ----- From: Gordon Luke To: jawsscripts@xxxxxxxxxxxxx Sent: Monday, January 16, 2012 7:27 PM Subject: [jawsscripts] Re: Calculate time Hi Here's a few functions I use to calculate how long until a particular time is reached from the current time. Hope it's what you're looking for and I'm sure you can amend it for your own needs. int function SecondsSinceMidnight(string sText) ; Determine how many seconds have elapsed since midnight var int h let sText = stringStripAllBlanks (sText) ; Get the hours and multiply them by 3600 ( 60 x 60) let h = StringtoInt(StringSegment (sText, ":", 1)) * 3600 ; Now add on the minutes let h = h + StringtoInt(StringSegment (sText, ":", 2)) * 60 ; and finally the seconds let h = h + StringtoInt(StringSegment (sText, ":", 3)) return h endfunction int function SecondsToTarget(string sText) ; How long is it now until the target in seconds var int h ; Turn the current time into a time since midnight and remove that from the input time let h = SecondsSinceMidnight(sText) - SecondsSinceMidnight(SysGetTime ("HH:mm:ss")) if (h < 0) let h = 24 * 3600 + h endif return h endfunction string function GetTimeWords(int h,string sUnits) ; Show a time in words pluralising where appropriate. var string s if (h == 0) return "" endif let s = IntToString(h) + " " + sUnits if (h > 1) let s = s + "s" endif return s + " " endfunction string function TimeToTarget(string sTarget) ; How long to go until the target time is reached ; sTarget is in the form hh:mm:ss Var int h, int m, int s, string sMsg ; Break the time down to hours, minutes and seconds let h = SecondsToTarget(sTarget) ; Get the seconds off let s = h % 60 ; Now throw away the seconds let h = h / 60 ; Get the minutes let m = h % 60 ; Now throw away the minutes and leave the hours let h = h / 60 ; Now put this into words let sMsg = StringTrimTrailingBlanks (GetTimeWords(h,"hour") + GetTimeWords(m,"minute")) if (sMsg != "") && (s > 0) let sMsg = sMsg + " and " endif let sMsg = StringTrimTrailingBlanks(sMsg + GetTimeWords(s,"second")) return sMsg endfunction Any questions please give me a shout. Thanks Gordon Luke Senior Systems Analyst Systems Integration (L&P Applications & Testing) Tel: 01732 429 044 Email: gordon.luke@xxxxxxxxxxxx Part of the Capita group www.capita.co.uk Think of the environment...please don't print this e-mail unless you really need to. "Dang Manh Cuong" <dangmanhcuong@gm ail.com> To Sent by: <jawsscripts@xxxxxxxxxxxxx> jawsscripts-bounc cc e@xxxxxxxxxxxxx Subject [jawsscripts] Calculate time 16/01/2012 11:02 Please respond to jawsscripts@freel ists.org Hi listers Anybody who know the way to calculate the time between two points? Pleae help me. I want to do it whith Jaws script. I used the sysGetTime function, but my result always =0 ________________ Dang Manh Cuong HCMC University of Pedagogy: The Psychology and education Mobile: +84 902-572-300 E-mail: dangmanhcuong@xxxxxxxxx Yahoo ID: manhcuong0312 Skype name: dangmanhcuong facebook: Manh Cuong Dang Blog: http://vi.netlog.com/Cuong_littlecat Website: http://ngoisaodanduong.com http://www.saomaicenter.org Projec-Website: http://code.google.com/p/dangmanhcuong __________� View the list's information and change your settings at //www.freelists.org/list/jawsscripts This email is confidential and should not be used by anyone who is not the original intended recipient. Prudential cannot accept liability for statements made which are clearly the sender's own and not made on behalf of the Prudential. In addition, no statement should be construed as giving investment advice within or outside the United Kingdom Prudential plc, incorporated and registered in England and Wales. Registered Office at Laurence Pountney Hill, London, EC4R 0HH. Registered number 1397169. Prudential plc is a holding company, subsidiaries of which are authorised and regulated by the Financial Services Authority (FSA) 'Prudential' is a trading name of The Prudential Assurance Company Limited, which is incorporated and registered in England and Wales. Registered Office at Laurence Pountney Hill, London, EC4R 0HH. Registered number 15454. Authorised and regulated by the Financial Services Authority. 'Prudential' is also used by other companies within the Prudential Group, which between them provide a range of financial products including life assurance, pensions, savings and investment products 'Prudential' is also a trading name of Prudential Distribution Limited, which is incorporated and registered in Scotland. Registered Office at Craigforth, Stirling, FK9 4UE. Registered number SC212640. Authorised and regulated by the Financial Services Authority. A list of other Prudential companies together with their registered statutory details can be found in 'About Prudential' on http://www.prudential.co.uk/prudential-plc/aboutpru An email reply to this address may be subject to interception or monitoring for operational reasons or for lawful business practices. __________� View the list's information and change your settings at //www.freelists.org/list/jawsscripts __________� View the list's information and change your settings at //www.freelists.org/list/jawsscripts