Only Log If...?

I’m writing a program that uses the Console to log A LOT of information. As such, I have placed a checkbox that I want to “mute” the program when checked.

I found the “on log” command, but I can’t find a way to get it to work properly.

on log something
if VerboseMode = true then log something
end log

The problem is that this makes the program go through an infinite loop, and I get a stack overflow error.

Is there a work-around? Am I missing something?

-SuperScripter

Hi,

of course you get an infinite loop because the on log handler is called on and on, if VerboseMode is true.
A way to log conditionally is this handler


on logVerbose(msg)
	if VerboseMode then log msg
end logVerbose

Yeah, that’s what I figured. It’s just a little extra work to type each time. :stuck_out_tongue: [Super-lazy much?]

Thanks again.

-SuperScripter

Off topic:

If you are using AppleScript Editor at least under Snow Leopard you can just hit esc, and get a list with completions for what you recently typed.

It would be very nice if each of you guys who use Script Debugger to send a mail to support@latenightsw.com and ask them
to please fix the scripts for using BBAutoComplete with ScriptDebugger 4.5 :smiley:

Regards

McUsr