Debbuging Breakpoints etc

Hi there,

was wondering if anyone has an insight on debugging. For example I’ve got an object that’s badly referenced and get the typical error NSReceiverEvaluationScriptError: 4 (1). Now until now I’ve been adding some Display dialogs in my code until I would find the bugged line. Is there (and I’m sure there must be) a better way to debug? I’ve tried the debugger but nothing comes. I’ve tried adding breakpoints but my app won’t stop to these to let me run line by line. Is it so much to ask that xCode would let me know at which line the script hangs or am I just not smart enough to find the feature?

HHHHHHelp me gain precious time!


Xcode’s debugger (and breakpoints, etc.) is not for AppleScript (but Obj-C, et al.).

I prefer using log commands instead of dialogs.

log "The text field is about to be set."
set content of text field "something" of window "whatevr" to "Hello!"
-- Oops! I misspelled "whatever"; An error dialog should be displayed, and the next line won't run/appear in the Run Log until I dismiss the dialog.
log "The text field was set!"


I agree with Michaf and hope Apple would help us noobie programmers more by least indicating in Xcode where the offending line might be. Sometimes, I have seen a red line on the scroll bar to show where the error might lie but even that is not very helpful. Would it be difficult to implement an error reporting scheme that gives programmers the exact line where the error is?

I have used both log and “display dialog” test codes to check where the error might be. They are helpful in a way but Apple, for all its reputation for simplicity, would do better to simplify this error stuff in AS Studio.

Michaf, FWIW, I have also tried to comment out an entire block (or even the whole handler) just to see where the mistake might lie. It’s rough but at least it maps out some directions for you.

Good luck and let’s hope Apple does something about this. :slight_smile: If not, may be some savvy programmers in this forum or elsewhere might consider taking this as a special project huh? Or is there already a special program out there that would answer this bell when it tolls?


I agree completely that the error messages need some improvement. Would it be too much to ask for the error to say something along the lines of “Can’t find (text field “foo” of window “main”)”? Then you just need to run a find to fix the problem. It’s a pain when you’ve written 500 lines of code and get one NSReceiver, because you misstyped something somewhere. I’ll stop now before this becomes a major rant…:slight_smile:

I’m afraid I’m lost here. It works for me fine. Breakpoints get noticed, I can step through the code line-by-line, variables show up in a list, etc.

And I’m pretty sure this has all worked since project builder.

Hi All,

Maybe someone could write a small “how to” document in macscripter? Lately I have seen quite a few AppleScript and AS Studio tutorials at macscripter. Am sure that document will help a lot of us who are literally lost in using the Xcode Debugger.

Either that or could someone in this forum point to already written documents on this matter that might help? Without being chagrined about it, I admit that I cannot make much headway using it. I don’t know others but I am reasonably sure that I am not alone on this.


archseed :slight_smile:

Hi (Again),

Just for the heck of it, I googled “Xcode Debugger” and ran across one item that linked me up to:

Going thru Part VI (Debugging) of the Xcode User Guide, I concluded that it is not for the faint of heart. I still think it’d be a good project for someone familiar with it to write a brief tutorial on how to use Xcode debugger with AppleScript Studio. That would really really be very helpful for AS Studio enthusiasts.

Thanks and cheers!

archseed :slight_smile:

I heartedly agree with you.