Hi all, I only have one or the other of these two applications open at any given time.
If the script could detect the process of the one that’s open, then I could eliminate the dialog box (i hope).
How can I do that?
Any and all help is very much appreciated.
Tom
set the clipboard to ""
display dialog "Speak text in Tex-Edit Plus or TexEdit..." buttons {"Cancel", "Tex-Edit Plus", "TextEdit"} default button 3 giving up after 60
if the button returned of the result is "TextEdit" then
-- Speak highlighted text in TextEdit
activate application "TextEdit"
tell application "System Events" to tell process "TextEdit" to keystroke "c" using {command down}
say (get the clipboard) as text
else
if the button returned of the result is "Tex-Edit Plus" then
-- Speak highlighted text in Tex-Edit Plus
activate application "Tex-Edit Plus"
tell application "System Events" to tell process "Tex-Edit Plus" to keystroke "c" using {command down}
say (get the clipboard) as text
end if
end if
tell application "System Events" to quit
Browser: Camino 1.6
Operating System: Mac OS X (10.4)
set the clipboard to ""
tell application "System Events" to set allProcesses to name of processes
set {TextEdit_runs, TexEditPlus_runs} to {"TextEdit" is in allProcesses, "Tex-Edit Plus" is in allProcesses}
if not TextEdit_runs and not TexEditPlus_runs then
display dialog "Speak text in Tex-Edit Plus or TexEdit..." buttons {"Cancel", "Tex-Edit Plus", "TextEdit"} default button 3 giving up after 60
sayText(button returned of the result)
else if TextEdit_runs then
sayText("TextEdit")
else
sayText("Tex-Edit Plus")
end if
on sayText(theApp)
activate application theApp
tell application "System Events" to tell process theApp to keystroke "c" using {command down}
say (get the clipboard) as text
end sayText