I didn’t know how to do a clean install, so installed over straight from the apple store download. There are a few quirks. For now thing I can’t get Finder windows to open in new window by double clicking. I guess Apple will fix it on a update.
Trying to figure out how to call Shane’s cocoa handlers.
Edited: btw, your Tree app still works! That’s good because ‘completely expanded’ is still not available.
But I can’t get it to run the handler in the calling script:
use theLib : script "SpeechTest"
use scripting additions
theLib's startSaying:"Hello world, welcome to AppleScriptObjC" sender:me
set r to result
stringSpoken:1
on stringSpoken:theFlag
if theFlag = 1 then
log "The string was spoken"
else
log "Trouble at mill"
end if
end stringSpoken:
use theLib : script "SpeechTest"
use scripting additions
theLib's startSaying:"Hello world, welcome to AppleScriptObjC" sender:me
my stringSpoken:1
on stringSpoken:theFlag
if theFlag = 1 then
log "The string was spoken"
else
log "Trouble at mill"
end if
end stringSpoken:
It needed ‘my’. I guess the log called from the Library script won’t show in the ASE when called from the Library script:
on speechSynthesizer:anNSSpeechSynthesizer didFinishSpeaking:theFlag
theSender's stringSpoken:(theFlag as integer)
end speechSynthesizer:didFinishSpeaking:
use theLib : script "SpeechTest"
use scripting additions
theLib's startSaying:"Hello world, welcome to AppleScriptObjC" sender:me
on stringSpoken:theFlag
if theFlag = 1 then
beep 3
log "The string was spoken"
else
log "Trouble at mill"
end if
end stringSpoken:
I’ve been getting bellow 0.02 secs. with your technique. Even with the feedback! I think that’s happening on a different thread or something.
Here’s the timing if anyone is interested:
use theLib : script "SpeechTest"
use scripting additions
run script (do shell script "python -c 'import time; print time.time()'") --dummy
set t1 to run script (do shell script "python -c 'import time; print time.time()'")
set t2 to run script (do shell script "python -c 'import time; print time.time()'")
set time_calib to t2 - t1
set t1 to run script (do shell script "python -c 'import time; print time.time()'")
--
theLib's startSaying:"Hello world, welcome to AppleScriptObjC" sender:me
--
set t2 to run script (do shell script "python -c 'import time; print time.time()'")
set time_diff to t2 - t1 - time_calib
on stringSpoken:theFlag
if theFlag = 1 then
beep 1
log "The string was spoken"
else
--beep 2
log "Trouble at mill"
end if
end stringSpoken:
REMEMBER: you need to save Shanes other script posted above as instructed.