I am using a mult-dialog script to get a list of information, but I am having trouble getting each line of the result to put into a text box in InDesign. I’ve included my event log info, which tells me I am, in fact getting the first line of the dialog’s user input, “1” but it’s not plugging it into the “TextLabel” text box in my InDesign file. (I am using “1”, “2”, “3”, “4”, “5” in my test, but the real answers will be words, not numbers, but it won’t grab the words either, so numbers are quicker to insert for testing)
At the bottom of my code I have a test dialog box surrounded with “(*” and" *)" which, when activated works, so I know the TextLabel text box is found, so there is something wrong with how I am naming the info returned from the multi-dialog box.
[code]set ASTID to AppleScript’s text item delimiters
on multi_dialog for q given listing:l
tell q as list
set {a, b, c} to {{}, beginning, count}
set v to b’s class is integer
if v then set {c, v, q} to {b, b is 0, rest}
end tell
if v then set c to 30
repeat c times
set a’s end to “”
end repeat
set {d, text item delimiters} to {text item delimiters, return}
set {q, a, text item delimiters} to {q as string, a as string, d}
set r to (display dialog q default answer a)'s text returned
if (count r) is not 0 then
if not v then tell r & a
if l then return paragraphs 1 thru c
return text 1 thru paragraph c
end tell
tell r to repeat with i from (count paragraphs) to 1 by -1
if (count paragraph i) is not 0 then
if l then return paragraphs 1 thru i
return text 1 thru paragraph i
end if
end repeat
end if
if l then return {}
“”
end multi_dialog
set inset_answer to (multi_dialog for {5, “Teaser items, list either 4 or 5:”} with listing)
set l to inset_answer
set b to {} as list
repeat with a in l
if class of a is not integer then
set b’s end to a as list
end if
end repeat
log (class of b)
set AppleScript’s text item delimiters to ASTID
tell application “Finder”
activate
open document file “Leave-Behind template.indd” of folder “*Listings” of folder “Cheryls Folder” of folder “File Storage” of startup disk
end tell
tell application “InDesign CS”
if exists document 1 then
tell document 1
set userInputA to b
set teaseA to userInputA
set theTeaseA to teaseA
set tease1 to first text item of theTeaseA
search “TeaserLabel” for “abcd” replacing with tease1
(*set userInput4 to display dialog "City" default answer "Type Here"
set ansrD to text returned of userInput4
set theAnsr4 to ansrD
set ansr4 to first text item of theAnsr4
search "TeaserLabel" for "abcd" replacing with ansr4*)
end tell
end if
end tell[/code]
This is what my event log tells me
tell current application
display dialog "Teaser items, list either 4 or 5:" default answer "
"
{text returned:"1
2
3
4
5", button returned:"OK"}
(*list*)
end tell
tell application "Finder"
activate
open document file "Leave-Behind template.indd" of folder "*Listings" of folder "Cheryls Folder" of folder "File Storage" of startup disk
end tell
tell application "InDesign CS"
exists document 1
true
search "TeaserLabel" for "abcd" replacing with {"1"}
"InDesign CS got an error: \"TeaserLabel\" doesn't understand the search message."