Announcement: Upgrade to macOS Mojave

With features like Dark Mode, Stacks, and four new built-in apps, macOS Mojave helps you get more out of every click. 
Find out how to upgrade to macOS Mojave > https://support.apple.com/macos/mojave

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Question:

Question: How to get result to remember multiple text results

Im trying to make an application that will alternate between different messages depending on the user in put on how many different messages and the text in the message. I keep coming across the problem that the text returned is the last message entered, anyway to get every message entered displayed?

Thanks for your help!


This is the code I have for it.


tell application "System Events"

set textToSay to "Sample Text"

set ETM to "Enter The Message(s) You Wish to Send."


display dialog "Welcome
"

set question to "How Many Messages Would You Like to Display?"

set numberofmessagess to text returned of (display dialogquestiondefault answer "1")

repeat numberofmessages times

set textToSay to the text returned of (display dialogETMdefault answer "Click to type")

end repeat


display dialog "Interval " default answer ".05"

set int to the text returned of the result

set numoftimes to text returned of (display dialog "How many messages?" default answer "400")


display dialog "Click to launch in 3 Seconds"


delay 3

repeat numoftimes times


delayint


keystroketextToSay


keystrokereturn

end repeat

end tell

MacBook Pro, macOS Sierra (10.12.6)

Posted on

Reply

Dec 15, 2017 4:54 AM in response to Ben1098 In response to Ben1098

You are replacing textToSay each time through the loop. Each time through the loop, you set textToSay to something different.

Use a list to store the individual messages. see here: http://www.satimage.fr/software/en/smile/computing/as_types/list_create.html

Dec 15, 2017 4:54 AM

Reply Helpful
User profile for user: Ben1098

Question: How to get result to remember multiple text results