For some reason the below applescript works well all by itself in AppleScript Editor, yet when I try to run it in Automator an error comes up which says the following:
It highlights theTitle in the below applescript.
on run
set {dChange, chAnge, Csum, oName, oPost, sName, sPost} to (inputItems for {"¢ Date of Change", "¢ Summary", "¢ Change", "¢ Who created the change (name)", "¢ Who created the change (post)", "¢ Person Logging (name)", "¢ Person Logging (post)"} with title given prompt:"Enter the following items separated by a carriage return:")
end run
to inputItems for someItems given title:theTitle, prompt:thePrompt
if thePrompt is in {true, false} then -- "with" or "without" prompt
if thePrompt then
set thePrompt to "Input the following items:" & return & return & return & return & return & return & return -- default
else
set thePrompt to ""
end if
else -- fix up the prompt a bit
set thePrompt to thePrompt & return & return & return & return & return & return & return
end if
if theTitle is in {true, false} then if theTitle then -- "with" or "without" title
set theTitle to "Changes Log Input" -- default
else
set theTitle to ""
end if
if class of someItems is integer then -- no item list
set {theCount, someItems} to {someItems, ""}
if thePrompt is not "" then set thePrompt to text 1 thru -2 of thePrompt
else
set theCount to (count someItems)
end if
if theCount is less than 1 then error "Input Changes Error: Empty input list."
set {theItems, theInput} to {{}, {}}
repeat theCount times -- set the number of lines in the input
set the end of theInput to ""
end repeat
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set {someItems, theInput} to {someItems as text, theInput as text}
set AppleScript's text item delimiters to ","
set theInput to paragraphs of text returned of (display dialog thePrompt & someItems with title theTitle default answer theInput)
repeat with anItem from 1 to theCount -- pad/truncate entered items
try
set the end of theItems to (item anItem of theInput)
on error
set the end of theItems to ","
end try
end repeat
return theItems as string
end inputItems
Can anyone figure out what I am doing wrong here?
Thanks.
Phil