return "error" code from standalone compile

Douglas A. Ruisaard dougr at telus.net
Thu Dec 10 12:51:32 EST 2020


I use AUTOHOTKEY... as a fast, dirty way to "get stuff done" when I'm either too lazy or too rushed to do a "quality" job with Livecode.  It has a command called "Run" & "Runwait" ... which returns the calling program's (Livecode executable, in this case) return code into a predefined variable called "ErrorLevel" (how original!).  So a line in a AUTOHOTKEY script for this would look like:

		cmd = c:\livecode\SomeLiveCode.exe
		RunWait, %cmd%,,UseErrorLevel
		exitcode := ErrorLevel
		if (exitcode > 1)

Autohotkey takes some getting used to but I think it's a handy addition to development projects.. since AHK scripts can be compiled into executables, themselves.

My 4.5 cents

Douglas Ruisaard
           
    Trilogy Software
      (250) 573-3935


-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of John Balgenorth via use-livecode
Sent: Thursday, December 10, 2020 4:03 AM
To: How to use LiveCode
Cc: John Balgenorth
Subject: Re: return "error" code from standalone compile

Since Livecode is written in C++ here is some
info about using return  in  C.

Every C program has a function named main.   At the
end of the function the programmer usually writes a
return 0;

That tells  the c  program the code has  completed
and is exiting with  a  0 value which confirms it  has
successfully executed the code and is quitting.

At any point above that line the programmer can  write
a return call  but they will usually use a 1  on another
value.  The program will exit the code at that point  and
it does not matter what value is entered after the  return
but 1 usually means the code failed and any other value
but 0 means anything you want it to mean.

JB


> On Dec 9, 2020, at 8:52 PM, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I don't know much about this but it looks interesting. Is there a list of exit codes somewhere? When the OS receives the exit code, what happens? I.e., how would I use it?
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>> On December 9, 2020 7:48:10 PM Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>>> On 12/9/20 5:32 PM, Douglas A. Ruisaard via use-livecode wrote:
>>> On the completion of a stack, can the compiled executable return an error
>>> code like the old DOS ErrorLevel value(s)?  If so, how do you specify the
>>> error code?  in the on closeStack call?
>> 
>> See the quit command in the dictionary.
>> 
>> quit 42
>> 
>> --
>> Mark Wieder
>> ahsoftware at gmail.com
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list