oversize source: how to break into scripts

I’ve just upgraded to XCode 2.5. I don’t know why but my (very long) script will no longer compile. It seems to be about 1 or 2 lines too long right now – removing a few lines always succeeds. As a matter of fact, even while the syntax coloring part fails, the build still succeeds even when “too long”.

If anyone can help me with that part I’d sure appreciate it. (I’ve tried relaunching XCode and restarting the computer runnung 10.4.10)

In the meantime, I thought I’d get around this by breaking the long script into separate applescripts. Those “syntax color” just fine. But almost everything depends on properties and variables from everything else, so how is one supposed to pass those back and forth between (among) scripts? Failing that, how does one convert a call like “my dothis()” to another script in the same project?

Thanks.

Hi,

you can use script (objects).
E.g. save this on desktop as a normal compiled script with name “myLib.scpt”

on dothis(a)
	return (text returned of (display dialog a default answer ""))
end dothis

on dothat(b)
	say b
end dothat

In your main script, use this routine

set myLib to load script file ((path to desktop as Unicode text) & "myLib.scpt")
tell myLib
	set t to dothis("Enter something")
	dothat(t)
end tell

this syntax can also be used

set myLib to load script file ((path to desktop as Unicode text) & "myLib.scpt")
set t to myLib's dothis("Enter something")
myLib's dothat(t)

Check out the run script and load script commands in Standard Additions.