0

I am using tasker to send send a text when I speak. However, my .py file does not seem to be saving my speech to the clipboard as I though it would. You can see that I am first saving the clipboard as a variable to reset it later in case it is something important.

Here is what I have so far...

  1. Variable Set (Name:%SAVECLIP To:%CLIP) If (%CLIP Is Set)
  2. Set Clipboard (Text:Not important.)
  3. Run Script (Name:SpeechToClip.py)
  4. Wait Until (MS: Seconds:2 Minutes:0 Hours:0 Days:0)
  5. Send SMS (Number: a number Text:%CLIP)
  6. Set Clipboard (Text:%SAVECLIP Add:Off) If (%SAVECLIP Is Set)
  7. Variable Clear (Name:%SAVECLIP)

My .py file was created in Notepad and then copied into my sl4a/scripts folder. Here is what my .py file contains...

import android
droid = android.Android()
droid.setClipboard(droid.recognizeSpeech()[1])

I think this .py file is where the error is occurring because my clipboard is still "Not important." and the text message that is received also says "Not important." instead of what I speak.

Any help/advice would be greatly appreciated.

nkm
  • 5,844
  • 2
  • 24
  • 38
drewmey
  • 1
  • 1

1 Answers1

0

Found my own solution of a day of messing around. This .py code seemed to work better...

import android    
droid = android.Android()    
text= droid.recognizeSpeech()    
droid.setClipboard(text.result)
nkm
  • 5,844
  • 2
  • 24
  • 38
drewmey
  • 1
  • 1