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