equivalent of "revStopSpeech" by shell or Applescript ?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

equivalent of "revStopSpeech" by shell or Applescript ?

Post by jmburnod » Wed Mar 28, 2012 9:20 am

Hi All,

Does Someone know an equivalent of "revStopSpeech" by shell
or Applescript ?

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by bn » Wed Mar 28, 2012 2:05 pm

Hi Jean-Marc,

in applescript you can pass a parameter to the say command "without waiting until completion" this will fire off the say command and the applescript is not waiting until the say command has finished.
example: 2 buttons
first button

Code: Select all

on mouseUp
   put "say " & quote & "hallo world hallo world hallo world hallo world hallo world hallo world" & quote & "without waiting until completion" into tSay
   do tSay as applescript
   if the result is not "" then answer the result
end mouseUp
the script of the second button

Code: Select all

on mouseUp
   put "say " & quote & "" & quote & " with stopping current speech" into tSay -- just empty
   do tSay as applescript
   if the result is not "" then answer the result
end mouseUp
if you want the first button to interrupt any possible speech you could say:

Code: Select all

on mouseUp
   put "say " & quote & "hallo world hallo world hallo world hallo world hallo world hallo world" & quote & "with stopping current speech without waiting until completion" into tSay
   do tSay as applescript
   if the result is not "" then answer the result
end mouseUp
the 3 scripts tested on MacOSX 10.6.8, Livecode 5.5

Kind regards

Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by jmburnod » Wed Mar 28, 2012 2:20 pm

Hi Bernd,

Thank a lot
They work fine.
The 3 scripts tested on MacOSX 10.7.2, Livecode 5.0

Best from Geneva

Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by jmburnod » Wed Mar 28, 2012 6:56 pm

Hi Bernd,

I am confused.It work fine under Lion but the text is not spoken under SnowLeopard OSX 10.6.8, LiveCode 5.0

Code: Select all

on mouseUp
    put "say " & quote & "hallo world hallo world hallo world hallo world hallo world hallo world" & quote & "without waiting until completion" into tSay
   do tSay as applescript
   if the result is not "" then answer the result
end mouseUp
Kind regards

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by bn » Wed Mar 28, 2012 7:54 pm

Hi Jean-Marc,

I tried the script on MacOSX 10.6.8 and LiveCode 5.0: no problem.

strange things come to mind:

Is the volume turned up?

If you test with TextEdit can TextEdit read a text for you on that machine? Menue -> Édition -> Parole -> Commencer la lecture

maybe choose another voice in System Preferences/ Speech

otherwise I have no idea

Kind regards
Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by jmburnod » Wed Mar 28, 2012 9:46 pm

Hi Bernd,

Yes the volume is turned up and textedit speak the text
I think it don't work because i have a french voice installed (cepstral Jean-Pierre).
I test tomorrow with an other machine.

Kind regards

Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by jmburnod » Fri Mar 30, 2012 2:05 pm

Hi Bernd,

I test the three scripts under an other machine OSX 10.6.8

1."without waiting until completion" work fine

2."with stopping current speech" don't work

3. "with stopping current speech without waiting until completion" work fine

I don't know why the second don't work

Best regards

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by bn » Fri Mar 30, 2012 3:00 pm

Hi Jean-Marc,
2."with stopping current speech" don't work
do you mean

Code: Select all

on mouseUp
   put "say " & quote & "" & quote & " with stopping current speech" into tSay -- just empty
   do tSay as applescript
   if the result is not "" then answer the result
end mouseUp
is not working?

If so then this script is just stopping any speech currently running, it does not say anything in itself. It is supposed to let you stop what is being spoken.

If that is not the problem please post the script that is not working.

Kind regards

Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by jmburnod » Fri Mar 30, 2012 3:21 pm

Hi Bernd,
is just stopping any speech currently running
Yes, i expect it does stop a current speech but it doesn't stop it (the text spoken by the first btn)
Curiously, the script 3 does stop current speech fine and speech its text fine

Kind regards

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by bn » Fri Mar 30, 2012 5:13 pm

Hi Jean-Marc,

I have no explanation for this: I tested and retested the scripts I posted and script 2 works fine for me as it stops the current speech. I tested on MacOSX 10.6.8 and LiveCode 5.0 and 5.5. I copied them from the forum.

There must be something else going on. Did you copy the scripts here from the forum? Unchanged?

Please try again with a new stack and just button 1 and button 2 from the scripts above.

Kind regards

Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: equivalent of "revStopSpeech" by shell or Applescript ?

Post by jmburnod » Fri Mar 30, 2012 6:42 pm

Hi Bernd,
Did you copy the scripts here from the forum Unchanged?
Yes. I used a copy of your script

I tested with an other machine OSX 10.6.8 LC 5.0 and all scripts work

I haven't explanation.

Kind regards

Jean-Marc
https://alternatic.ch

Post Reply