Choosing among script elements in a script

If a script command has modifiers, is there a way to choose among them from within the script using the command? Example: the FastScripts UI Suite includes this class and command:

Class message window: A self dismissing window suitable for unobtrusively displaying a message on the screen.
Plural form:
	message windows
Properties:
	<Inheritance>  window  [r/o]  -- All of the properties of the superclass.
	autodismiss time  real  -- time in seconds before the window will auto-dismiss
	screen position  top center/top left/center/bottom right/bottom left/bottom center/top right  -- the location on the screen at which the message should appear

Command:
display message: Display a self-dismissing message at a specificed location on the screen.
	display message  Unicode text  -- the message text to display
		[at screen position  top center/top left/center/bottom right/bottom left/bottom center/top right]  -- the location on the main screen at which the message will appear, defaults to center
		[dismissing after delay  real]  -- time in seconds to display before auto-dismissing, if zero then never auto-dismiss, defaults to 1 second
	Result:   message window  -- the reply for the command

The problem is that notifications at the same position stack, so if more than one is to appear, I’d like the second to be at another position. How can I accomplish a selection from among the options when these one or two word descriptors are key words, not text? In essence, how can I compute an AppleScript command (self-modifying code, I guess) inside a script? (I realize I could just repeat the entire command with each of the possibilities and set up a “case” statement, but I’m interested in the “generic” answer.)

Let me make this more fundamental; one of the many gurus on this forum will know:

Is it possible to construct an instruction in AppleScript and then execute it or will that automatically fail at compile time?

At code-composing-time, there are lots of variables and dependencies. For example, in the mentioned dictionary, I think there is something buggy, as you can’t modify the property “screen position” of message windows (“set screen position of blah to blah” will fail here).

Some times, you can compile odd things which won’t make sense at run-time, or a scripting addition will fool your terminology, or…

Anyway, this is a bug in FastScripts (at least here, 2.2.3). You can find similar bugs in other apps, and you can find things working OK in others.

So, the answer should be YES: you should be able to get/set read-write properties dependent on enumerations (constants). Ie, “owner privileges” in a Finder item.

The workaround for this task would be something as (appart from submit feedback to the FastScripts developer):

tell application "FastScripts"
	set w1 to display message "asdf"
	set w2 to display message "QQQQQ"
	set w3 to display message "furufuru"
	
	set {x1, y1, x2, y2} to w1's bounds
	set {a1, b1, a2, b2} to w2's bounds
	set {p1, q1, p2, q2} to w2's bounds
	
	set w2's bounds to {a1, y2, a2, y2 + (b2 - b1)}
	set w3's bounds to {p1, y2 + (b2 - b1), p2, y2 + (b2 - b1) + (q2 - q1)}
end tell

Agreed, jj, tried and understood.

But consider this: at screen position in FastScripts Dictionary can be followed by these legal key words: top center | top left | center | bottom right | bottom left | bottom center | top right. None of those are in quotes, so there is no way I can see to choose one on the basis of an if sequence.

if condition 1 then set myPos to center
display message myMsg at screen position myPos

It doesn’t work, because I can’t set myPos to a dictionary word and execute it later.

Yes, but we have here two different keywords “at screen position” (command parameter) and “screen position” (property of “message window”). So, this will work:

tell application "FastScripts"
	set x to top left
	set w to display message "foo" at screen position x
end tell

But this won’t (this is the bug):

tell application "FastScripts"
	set w to display message "foo" at screen position top left
	if w's screen position is top left then set w's screen position to center
end tell

The same construction will work in the proposed Finder’s example:

set x to alias "path:to:sample file.txt"

tell application "Finder"
	if owner privileges of x is read only then set owner privileges of x to read write
end tell

OK. This works too:

tell application "FastScripts"
	set x to {top center, top left, center, bottom right, bottom left, bottom center, top right}
	repeat with aPos in x
		set w to display message "foo" at screen position (contents of aPos)
		delay 2
	end repeat
end tell

Thanks NovaScotia & JJ for working out the details of this issue. Since Nova posted a followup to the issue in the new FastScripts forum on my site, I’m going to follow up on it over there:

http://www.red-sweater.com/forums/viewtopic.php?id=4

Daniel