Bundle TextMate vers Processing via AppleScript (osascript)

  • Créateur du sujet Créateur du sujet Denisws
  • Date de début Date de début

Denisws

Membre enregistré
14 Février 2004
6
0
60
Bonjour,
Il existe un Bundle de TextMate pour Processing. Le problème c'est qu'il ne fonctionne pas.
Je tente donc de bricoler le bazard.
j'en suis là
Bloc de code:
osascript <<'AS'
 tell application "Processing 0124"
activate
end tell
tell application "System Events"
        tell process "Processing"
            tell menu bar 1
                tell menu bar item "Edit"
                    tell menu "Edit"
                        click menu item "Select All"
                        click menu item "Paste"
                    end tell
                end tell
                tell menu bar item "Sketch"
                    tell menu "Sketch"
                        click menu item "Run"
                    end tell
                end tell
            end tell
        end tell
end tell
AS
L'idée générale c'est de copier le document textmate et de l'envoyer dans la fenetre processing puis de faire un "run"
mais avant d'appeler l'application processing je dois faire "Select All" et "Copy" dans textmate et je ne parviens pas à le faire en AppleScript, toute aide sera donc la bienvenue
 
curieusement
ceci fonctionne sous AppleScript
Bloc de code:
tell application "Processing 0124" to activate
    tell application "System Events"
        tell process "TextMate"
            set frontmost to true
            keystroke "a" using command down
            keystroke "c" using command down
        end tell
        tell process "Processing"
            set frontmost to true
            keystroke "a" using command down
            keystroke "v" using command down
            delay 0.3
            keystroke "r" using command down
        end tell
    end tell
mais adapté pour le Bundle de TexMate
Bloc de code:
    osascript <<-"APPLESCRIPT"
    tell application "Processing 0124" to activate
    tell application "System Events"
        tell process "TextMate"
            set frontmost to true
            keystroke "a" using command down
            keystroke "c" using command down
        end tell
        tell process "Processing"
            set frontmost to true
            keystroke "a" using command down
            keystroke "v" using command down
            delay 0.3
            keystroke "r" using command down
        end tell
    end tell
    APPLESCRIPT
ça ne prend plus en compte la première partie
Comprends pas
 
voici un réponse de JackJr300 sur un forum voisin
Ajoute une nouvelle (command) dans AppleScript ,
Sélectionne "entire document" dans le popup "Input".
Voici le code
content () {

iconv -cs -f utf-8 -t macroman//TRANSLIT | perl -pe 's/["\\]/\\$&/g'
}

osascript <<-APPLESCRIPT
tell application "Processing 0124" to activate
set the clipboard to "$(content)"
tell application "System Events" to tell process "Processing"
keystroke "a" using command down
keystroke "v" using command down
delay 0.3
keystroke "r" using command down
end tell
APPLESCRIPT