Page 1 of 1

"Say" stops working when run as file

PostPosted: Fri Nov 06, 2015 11:11 am
by DrLove
Hi!

I'm working on an Applescript to use Facetime as an intercom for my front door.

I have it working in Applescript editor and as an embedded script in Indigo. But if I run it as a file (allot of waiting in the script, I don't want to hog Indigo w/ that) the speech is not working. Everything else is but all I hear is the first "say"-statement and then no more. Same if I save the script as a program and run it.

This is my code (used w/ Swedish OSx/Facetime).

Code: Select all
do shell script "open facetime://+46xxxxxxxxx"

my notify("Var vänlig vänta, uppringning sker")

set calling to false
set con to false
set no_answ to false

tell application "System Events"
   
   set i to 1
   repeat while not calling
      if button "FaceTime" of window 1 of application process "FaceTime" exists then
         click button "FaceTime" of window 1 of application process "FaceTime"
         set calling to true
         exit repeat
      end if
      set i to (i + 1)
      if i ≥ 7 then
         my notify("Tekniskt fel, knacka i stället")
         return
      end if
      delay 1
   end repeat
   
   set i to 1
   repeat while not con and not no_answ
      if name of window 1 of application process "FaceTime" contains "med" then
         set con to true
         exit repeat
      end if
      set i to (i + 1)
      if i ≥ 20 then
         set no_answ to true
         if button "Lägg på" of window 1 of application process "FaceTime" exists then click button "Lägg på" of window 1 of application process "FaceTime"
         my notify("Inget svar")
         exit repeat
      end if
      if button "Ring tillbaka" of window 1 of application process "FaceTime" exists then
         set no_answ to true
         click button "Avbryt" of window 1 of application process "FaceTime"
         my notify("Inget svar, mottagaren är upptagen")
         exit repeat
      end if
      delay 1
   end repeat
   --delay 2
   --activate application "FaceTime"
   --keystroke "r" using command down
end tell

on notify(message)
   say message without waiting until completion
end notify


EDIT: if I add an extra say in my notify function it works, strange....

Code: Select all
on notify(message)
   say message without waiting until completion
   say ""
end notify


Please help!

Best regards, L

Re: "Say" stops working when run as file

PostPosted: Fri Nov 06, 2015 3:41 pm
by jay (support)
Just for giggles, what happens if you remove the "without waiting until completion"?