Breakpoints in Xcode

I have just started using Xcode 4 to write applescripts but I don’t seem to be able to get breakpoints to work in the applescripts. If I set a breakpoint in the applescript code, Xcode does not halt at that point but just runs the script as normal. Does this functionality not work in applescript code or do I need to change a setting somewhere within Xcode.

Many thanks

Do it even work for ASOC code? Been wondering this myself for a while, although I haven’t tried it yet…

Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)

Breakpoints work in the Obj C parts, if you have any.
log is useful in debugging the Applescript parts. However, it doesn’t work in some callback type routines.
A total stop can be had by inserting a: ‘Display Dialog variableOfInterest as text’ in your Applescript, where needed.

That is correct. As others have said, you have to use log and dialog commands.

Maybe because ASOC are just plain texts, in the Xcode world, and Obj-C and others are seen as real code?

Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)

It’s really a matter of not being implemented – and implementing it would be fairly complex because of the way AppleScriptObjC works, coupled with the fact that AppleScript itself has no debugging facilities.

Excuse the shameless plug, but AppleScriptObjC Explorer can be a big help in some cases, because it logs each statement. You can’t run it in place, so it’s more useful for debugging handlers.

The other thing I’m working on is a way to automate the tedious business of adding (and then removing) lots of logging statements when using AppleScriptObjC Explorer as an external editor. I should have a beta available in a day or two, for anyone interested.

Yes, very shamefull, Shane. :stuck_out_tongue:

I’ll have a look, but I kinda need Xcode because of all of my apps have a UI, and as I understand it your app is more of a AppleScript Editor on steroid, am I correct?

Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)

Not quite. It’s really very AppleScriptObjC-specific. And as of version 2.1, it’s also designed to function as an external editor for Xcode 4. So you open your project in Xcode, then in the Navigation area you control-click on the file and choose Open with External Editor (having set AppleScriptObjC Explorer to be the default editor for .applescript files in the Finder).

You then use it as an editor only – no running – but you get all the syntax-formatting, shortcuts, code-completion, compiling, Lion versioning, split-screen editing, and so on. When you save and go back to Xcode, all the changes you made are automatically recognised.

I’m biased, naturally, because I designed it around what I wanted in an editor. But I’d hate to go back to editing AS code directly in Xcode 4.

Anyway, you can download it and try for yourself.

Hmmm… interesting. I’ll definitely have a look!

FYI, you can now download and try this out. It’s pretty basic: one command adds a series of indexed log statements (in try blocks) after all the lines in your selection that might return a result, and when you’ve finished, another command removes them all.