use shell script to run an Applescript uncompiled text?

I believe I need to be able to run a block of uncompiled code. I know this code will work. Reason being, there are 2 versions of InDesign on my computer. In order to use the same code block for CS4 and CS5, I must somehow not run one of them, but be able to execute the code depending on which one is running.

So, I need to be able to run this block without compiling it:


tell application "Adobe InDesign CS4"
	tell JPEG export preferences
		set resolution to someResolution
	end tell
end tell

I can pass in the variable someResolution. I’m looking at the man page for OSAscript but it doesn’t quite make sense. Can anyone put this into an example for me?

Indesign. has a method of ‘script versioning’ have you tried this? I have no idea how it works with AppleScript. I mostly use ESTK with Adobe Apps these days. But it may be what your looking to achieve here.

Can you just use “run script”? Try using ‘tell application id “com.adobe.InDesign”’ if you don’t want the version number in the string.

Yes, I got run script to work. It was one of those too-late-at-night-to-think-straight questions.


set aScript to "tell application \"Adobe InDesign CS4\"
		tell JPEG export preferences
			set resolution to 200
		end tell
	end tell"

run script aScript

@Mark: I think that might work too:


tell application "Adobe InDesign CS5"
	using terms from application "Adobe InDesign CS4"
		tell JPEG export preferences
			set resolution to 144
		end tell
	end using terms from
end tell