How to make AppleScript comments line up on the right side of window


Is it possible to create AppleScript code so that you can have comments that are on the right line up vertically so they stand out as a block? Something like the following is what I’m looking for:

	    repeat with y from 1 to tabcount
			set tfiller1 to filler1      (* would like these comments to line up vertically *)
		        if y < 100 then          (*   adlkfac cajapsdfjasd adofjasod at the start *)
			   set tfiller1 to filler2   (*   odsfasdfad f each line *)
			end if

But the variable number of spaces inserted before the (* of each line keeps getting collapsed to only one space as soon as I compile. Have also tried “–” style comments and same thing happens.

Any suggestions??



ps – can’t even make them line up correctly here in this forum post - so pretend that each of the (* in the three comments actually do line up ;-( Well I cheated a bit and removed some spaces to force things to line up here but the actual text if copied/pasted into a program would NOT line up. Maybe I should do screen shots instead so that you can see what Script Debugger does, but hopefully you can see what I mean.

Unfortunately this is something the AppleScript compiler does. AppleScript reformats source text applying its own rules for indentation and collapses white space, which is what you are experiencing.

Script Debugger does not have any influence over this aspect of the AppleScript compiler.

That’s what I was afraid of – bummer there isn’t a way to comment like what I would prefer. But I just learn to live with it I guess. Thanks for trying…


I use tabulations after two hyphens, like this:

tell application id "asDB"
	tell document 1
		set theName to name -- 				comment one
		set thePath to file spec --			second comment
		set isModified to modified --		comment the third
	end tell
end tell


Yippeeeeeeee!!! Perfect – thanks so much!!!

Marked your answer as a solution. Way to go!!!