Idd text substitution / "select:" template

Update: sorry I got the lingo wrong. I did not mean “selected item” (as in the item is actually selected for immediate user input). I meant “an item that the user can tab into”. Apologies.

The syntax is:

if button returned of (display dialog “[[template:message]]” buttons {[[template:“Cancel”, “OK”]]} default button [[linked-template:“OK”]] is [[linked-template:“OK”]] then
[[select:-- your code goes here…]]
end if

but it only returns:

if button returned of (display dialog “#~message~#” buttons {#~“Cancel”, “OK”~#} default button #=~“OK”~# is #=~“OK”~# then
– your code goes here…
end if

and the “you code goes here…” is not turned into a selected item.

I tried to use select: in a different context, for ex:

tell application "[[template:application]]”
[[select:-- your code goes here]]
end

And here too it did not produce anything.

So, is there something wrong with the “select:” template, or am I missing something ( <- just added this bit :slight_smile:) ?

What you’re seeing is that, when there is one or more template: tags, the first one is selected. This de-selects text otherwise selected via the select: tag. If you use select: by itself, you will see it works.

This should probably be changed to honor the first select: tag.

I’m not sure I understand what you’re saying. Here is a screenshot of what I get.

And a screenshot of what I roughly expected:

which is “— your code goes here…” is actually a placeholder that I can tab to, just like the other templates.

Then use a template tag:

if button returned of (display dialog “[[template:message]]” buttons {[[template:“Cancel”, “OK”]]} default button [[linked-template:“OK”]] is [[linked-template:“OK”]] then
[[template:-- your code goes here…]]
end if

Of course, I can change the text expansion contents myself. I know that.

I’m just wondering what the expected behaviour is since it is offered with SD out of the box and in all the other text expansions and clippings offered, the “— your code goes here…” part is actually converted into a placeholder the user can tab into.

So I’m asking why doesn’t this one conform to that pattern since I don’t see any use for having “— your code goes here…” as it is now.

Okay, I see what you are saying now. I’ve implemented a fi for this in the next Script Debugger 7 beta build.

1 Like

Sorry I was not clear… :frowning:

If I wanted a “proper” behavior there in SD6, what would be the syntax btw ?

Use the revised version of the template I provide above:

1 Like