• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Speech Queue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Speech Queue


  • Subject: Re: Speech Queue
  • From: Graff <email@hidden>
  • Date: Fri, 28 Nov 2003 05:10:40 -0500

Here's a script that does all that for you, since Applescript can do all that you are asking on its own. It asks you for the number to start at and the time interval to use and then it sits and calls out the pages at the appropriate times. Take the script, save it as a stay-open application and then run it. It will look just like a normal application, quit it to stop it from counting.

You can change the message it says before the number by changing the text between the quotes on the first line of the code.

- Ken

code:
----------
property theMessage : "You should be on page number"

global nextTime
global timeInterval
global currentNumber
global tryAgain

on idle
try
if nextTime is less than or equal to (current date) then
say theMessage & " " & (currentNumber as text) & "."
set currentNumber to currentNumber + 1
set nextTime to (nextTime + timeInterval * minutes)
end if
on error
display dialog "An error occured in the idle handler"
end try
return 1
end idle

on run
set tryAgain to true
try
repeat while tryAgain is true
set tryAgain to false
display dialog "Enter the number to start counting at.",
default answer "1" buttons {"Quit", "Set Number"} default button 2
copy the result as list to {text_returned, button_pressed}
if button_pressed is "Set Number" then
try
set currentNumber to text_returned as number
on error
numberError()
end try
display dialog "Enter the number of minutes between counts.",
default answer "1" buttons {"Quit", "Set Time Interval"} default button 2
copy the result as list to {text_returned, button_pressed}
if button_pressed is "Set Time Interval" then
try
set timeInterval to text_returned as number
on error
numberError()
end try
end if
else
quit
end if
end repeat
display dialog "We will begin timing when you are ready.",
buttons {"Quit", "Begin Timing"} default button 2
if the button returned of the result is "Begin Timing" then
set nextTime to ((current date) + timeInterval * minutes)
idle
else
quit
end if
on error
display dialog "An error occured in the run handler"
quit
end try
end run

on numberError()
display dialog "There was a problem with the number you entered.",
buttons {"Try Again", "Quit"}
copy the result to button_pressed
if button_pressed is "Try Again" then
set tryAgain to true
else
quit
end if
end numberError
----------

On Nov 28, 2003, at 3:31 AM, Greg Reyna wrote:

I'm trying to write a fairly simple script for the program "Speech Queue".

The idea is that I'd like to have a "pacer" to run at times while I work. This Applescript, run with this little freeware program would make the computer speak a number every so-many minutes. That's all there is to it.

When starting up the program I need to be able to input two values, (1) the starting number, and (2) the time increment for this little wake-up call.

In my work it's easy to get caught up in the thing and lose track of time. The work is measured in pages. At times, I'd like to give myself a metronome to work to, so for example every ten minutes the computer would say, "page 10", "page 11", page 12", and so on. If I can keep up the pace, or maybe get off by a bit then catch up I might even have time for a life outside of this job. But realistically, there will be times when it will be "No way, Jose!", I'll fall too far behind and the program will have to be reset with a new starting page number.
...

I'm using "Speech Queue" because it's freeware, but right off the bat, the example scripts that are pretty much the only documentation that comes with the program, throw me for a loop by creating a new document with this line:

"make new document at before document 1"

Huh?

I've been struggling along with Applescript for a number of years, never really finding the time to learn it very well. Years ago I was pretty decent at writing "ARexx" ---the Amiga computer form of the Basic-like language called "Rexx", which I found an elegant and logical language. Applescript, on the other hand has simply never "clicked" with me. One factor that gives me trouble---the main one probably, is it's OOP-like structure, and the other problem I have with it is this thing of trying to be more like English. I thought the other way of designing a language

like:

if open('sf', 'sys:San_Fransisco','r') then do
line=readln('sf')

made more sense, but I'm stuck with Applescript so I keep trying to learn whenever I can.

Is anyone familiar with "Speech Queue", or know of a better alternative? Or another way to go about this? Obviously, I'll need to tap into the system clock as well.

I'm running OS 10.2 8, and have "Script Debugger 3" to help me out.

Thanks for any ideas,

Greg Reyna
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Speech Queue (From: Greg Reyna <email@hidden>)

  • Prev by Date: Re: Speech Queue
  • Next by Date: Modal Window!
  • Previous by thread: Re: Speech Queue
  • Next by thread: Modal Window!
  • Index(es):
    • Date
    • Thread