trying to make a type of clock

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

trying to make a type of clock

Post by idiot » Mon Apr 21, 2008 3:58 am

code stops part way thru not sure why

Code: Select all

let>s=0
let>m=0
let>h=0
label>start
Repeat>s
send>The time is %h% %m% %s%
let>s=s+1
press enter
until>s=60
if>s=60
let>s=s-60
let>m=m+1
goto>c
else>
endif
label>c
if>m=60
let>m=m-60
let>h=h+1
goto>d
else>
endif
label>d
if>h=13
let>h=h-13
goto>start
else>goto>start

if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Apr 21, 2008 7:12 am

It probably stops because your If/Else/Endif syntax is wrong. You also have some Gotos and Labels which aren't needed.

Try this:

Code: Select all

let>s=0
let>m=0
let>h=0
label>start

Repeat>s
  send>The time is %h% %m% %s%
  let>s=s+1
  press enter
until>s=60

let>s=0
let>m=m+1

if>m=60
  let>m=0
  let>h=h+1
endif

if>h=13
  let>h=0
endif

Goto>start
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Mon Apr 21, 2008 9:36 am

I see that Marcus has examined your code and replicated the counting there but just in case you want a 24 hour count it should be:

Code: Select all

if>h=24
  let>h=0
endif
Phil Pendlebury - Linktree

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts