Idd text substitution / "select:" template


(Jean Christophe Helary) #1

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:) ?


(Shane Stanley) #2

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.


(Jean Christophe Helary) #3

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.


(Mark Alldritt) #4

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

(Jean Christophe Helary) #5

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.


(Mark Alldritt) #6

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


(Jean Christophe Helary) #7

Sorry I was not clear… :frowning:


(Jean Christophe Helary) #8

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


(Mark Alldritt) #9

Use the revised version of the template I provide above: