Error handeling SDK

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
SteenJakobsen
Pro Scripter
Posts: 110
Joined: Thu Apr 08, 2010 6:11 am
Location: Hørsholm, Denmark
Contact:

Error handeling SDK

Post by SteenJakobsen » Thu Nov 04, 2010 5:19 am

Hi again,,
one last question about errors.

The RunCode() and RunScript() functions do they return some value that indicate an error ?
Best Regards
Steen Jakobsen
DM Software A/S

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

Post by Marcus Tettmar » Thu Nov 04, 2010 6:17 am

They return the value of MACRO_RESULT so will return whatever you set it to:

Let>MACRO_RESULT=whateveryouwant

So you have control over what they return. If you have a detectable error you could set it to MACRO_RESULT and then, yes, it would return the error.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

SteenJakobsen
Pro Scripter
Posts: 110
Joined: Thu Apr 08, 2010 6:11 am
Location: Hørsholm, Denmark
Contact:

Post by SteenJakobsen » Thu Nov 04, 2010 8:39 am

Yes .. but then again since I'm unable to trap syntax errors or missing SRT's or wrong complex expressions
and the script just continues as if nothing is wrong then the errorhandeling
is not so secure.

I'm looking very much forward to the future version where the script can be
manged in terms of trapping syntax errors and so on.

The SDK work very well but this is a soft spot .. ;-)
Best Regards
Steen Jakobsen
DM Software A/S

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Wed Nov 10, 2010 6:41 pm

One trick is to set MACRO_RESULT=FAIL as the very first line of your macro.

When you get to a successful conclusion, set MACRO_RESULT to whatever value that should be.

Then test MACRO_RESULT=FAIL after calling the macro. If true, exit or show Message, whatever is appropriate.
Thanks,
Jerry

[email protected]

SteenJakobsen
Pro Scripter
Posts: 110
Joined: Thu Apr 08, 2010 6:11 am
Location: Hørsholm, Denmark
Contact:

Post by SteenJakobsen » Mon Nov 22, 2010 6:06 am

Hi Jerry,

Thanks for your reply.. But it does not help since the error can not be trapped
and IGNOREERROR will just make the script continue as if nothing was wrong!

Thanks anyway.
Best Regards
Steen Jakobsen
DM Software A/S

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