WikiXtof

Apple Script For Speakable Items

Accueil :: SuperMenu :: Contact :: Connexion :: Vous êtes ft01.vitry.ouvaton.coop
config["menu_page"]; if (isset($menu_page) and ($menu_page!="")) { // Ajout Menu de Navigation echo ''; echo ''; echo '
'; } ?>

Examples of AppleScript tricks used as speakable items on my MacMiniMediaCenter


These scripts are saved in your_home/Library/Speech/Speackable Items so that they can be directly spoken and executed by Voiceover speech recognition.

Go to sleep now


Put my MacMini to sleep ! So useful !

tell application "Finder" to sleep

Open Front Row


A very simple symbolic link (Alias) toward Front Row app in the Application folder will do the job !
Just rename it with you speech command.

This just work with any program !

Play some music (via Front Row, randomly)


tell application "System Events"
  • - Command Esc. to start Front Rowkey code 53 using command down
  • - wait for Front Row to be ready for keyboard inputdelay 10
  • - up arrow to guarantee top of menukey code 126
    delay 1
    key code 126
    delay 1
    key code 126
    delay 1
    key code 126
    delay 1
    key code 126
    delay 1
    key code 126
    delay 1
  • - down arrow to get to Musickey code 125
    delay 1
    key code 125
    delay 1
  • - Press Return twice (Music -> Mix)key code 36
    delay 3
    key code 36
end tell


Go up/down/left/right


Behaves like the Apple Remote.
This is not an AppleScript and I can't remember how I found it out !

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-/ Apple/ DTD PLIST 1.0/ EN" "http:/ www.apple.com/DTDs/PropertyList?-1.0.dtd">
<plist version="1.0">
<dict>
<key>DefaultCommandName?</key>
<string>Go down</string>
<key>KeyPressArray?</key>
<array>
<dict>
<key>CommandKeyDown?</key>
<false/>
<key>ControlKeyDown?</key>
<false/>
<key>OptionKeyDown?</key>
<false/>
<key>ShiftKeyDown?</key>
<false/>
<key>VirtualKeyCode?</key>
<integer>125</integer>
</dict>
</array>
</dict>
</plist>


Clean This Screen : nettoyer tout l'écran en minimisant les fenêtres


tell application "Finder"
set frontmost of process "Finder" to false
end tell

tell application "System Events"
set currentProcesses to name of every application process whose visible = true
end tell

set tmpWindows to 0

repeat with tmpProcess in currentProcesses
tell application tmpProcess
activate
try
set tmpWindows to count windows
on error
set tmpWindows to 1 --> # of windows to try to force closed if it doesn't 'appear' to have any windows
end try
end tell

if tmpWindows > 0 then
tell application "System Events"
tell application tmpProcess
repeat tmpWindows times
try
keystroke "m" using command down
end try
end repeat
end tell
end tell
end if

set tmpWindows to 0
end repeat

tell application "Finder"
set frontmost of process "Finder" to true
end tell


Et en supplément, il faut une astuce pour faire disparaitre automatiquement le dock et la barre de menu pour chaque appli (ici, pour le finder qui est la dernière appli affichée).
Tout est là : http://www.macosxhints.com/article.php?story=20070118003804854
Et le Finder, on le trouve dans /Systeme/Bibliotheque/CoreServices?/

Skype Call To <skypename>


tell application "Skype"
send command "CALL <skypename>" script name "My Call"
end tell


Dans le MacMiniMediaCenter, je configure Skype pour envoyer automatiquement sa video aux contacts de mon carnet d'adresses.

Answer Skype Call


tell application "Skype"
set calls to send command "SEARCH ACTIVECALLS" script name "Call Control"
set callID to last word of calls
set status to send command "GET CALL " & callID & " STATUS" script name "Call Control"
if last word of status is "RINGING" then
send command "ALTER CALL " & callID & " ANSWER" script name "Call Control"
end if
end tell


Dans le MacMiniMediaCenter, je configure Skype pour envoyer automatiquement sa video aux contacts de mon carnet d'adresses.
Là, il faut compter sur l'autre pour raccorcher !
Je mets ce script dans les speakable items et dans Remote Buddy.
Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]