xcode 3 won't restyle source after compile

I’m relatively new to applescript studio, although not to scripting or programming.

I love the applescript source style change after a compile, i.e., bold blue commands, green variables, etc. But I’ve found a strange occurrence. If I enter the following code

	set CRLF to (ascii character 13)&(ascii character 10)

and compile, not only does that line not reformat (Stays in text entry style), but no other line added after that will reformat. Has anybody noticed this? Is there a better way of creating CRLFs? I know Return is a constant, but nothing for a line feed that I found. Unfortunately, I still have to write both win and unix formatted textfiles.

TIA,
bob

Welcome. :slight_smile:

AppleScript 2.0 (i.e., Leopard) has a linefeed constant.

In Leopard you can even write

set CRLF to character id {13, 10}

but scripts with this form require AppleScript 2 to work properly

Thanks to both of you. Both methods compile fine. I could have sworn I tried a linefeed constant, but I guess not.

And Stefan, that’s a great tip! I didn’t know anything about it.

I totally missed the docs for the 10.5 release notes. I’m updating the xcode docs as I type. Maybe this will help explain some of these huge gaps in my docs. :smiley:

Now my only issue is that I seem to have accidentally turned off some setting in xcode, because if I close and reopen the project the source code stays in black unstyled text both before and after the compile! Have absolutely no idea where that setting would be. Tried googling AND searching docs to no avail.

Any ideas?

Thanks,
bob

AppleScript Release Notes for Mac OS X version 10.5

Stefan,

Thanks for the link. Fortunately, I have a fast connection, so I have already updated my documentation and have been devouring all info I can!

I’ve also found my problem. It seems that even though CRLF is not a constant, therefore (one would presume) not technically a reserved word, it chokes up the formatting. Changing the var to myCRLF allowed compiled styling once again.

Yowza.

bob

I’m not sure why CRLF is treated differently in Xcode, but it seems to stop the script from compiling, which in turn means that the script cannot be styled.

Bruce,

That’s what I thought originally as well. But I took my working code, added

	set crlf to  "Am I here?"
	display dialog crlf

and lo and behold, the dialog pops up. If xcode stopped compiling, I would have never gotten the dialog.

How do I keep finding these goofy bugs no matter what language I program in? :mad:

bob