mausfang
Aktives Mitglied
Thread Starter
- Dabei seit
- 04.08.2016
- Beiträge
- 2.948
- Reaktionspunkte
- 1.282
Hallo Leute,
das Thema hat mich ganz schön Nerven gekostet. Ich befasse mich gerade mit dem Automator (Mojave 10.14.4).
Das Problem:
Ähm. Zum Debuggen irgendwie blöd. Entweder das Ganze läuft im Automator und dann im Finder nicht, oder umgekehrt. Was mache ich falsch? Mache ich etwas falsch?
das Thema hat mich ganz schön Nerven gekostet. Ich befasse mich gerade mit dem Automator (Mojave 10.14.4).
- Im Kontextmenü eines Ordners möchte ich ein AppleScript laufen lassen.
- Das Script soll den ausgewählten Ordner als Argument für ein Shellscript übergeben.
- Ich habe mit viel gegoogle ein funktionierendes Script erarbeitet.
Code:
on run {input, parameters}
set thePath to input as alias
set thePath to quoted form of POSIX path of thePath
--display dialog of thePath
if application "Terminal" is running then
tell application "Terminal"
# do script without "in window" will open a new window
do script "cd " & thePath & "; clear; if [ -d .git ] ; then git status; else echo -e \"\\033[1;31mNot a git repository! \\033[0m\"; fi"
activate
end tell
else
tell application "Terminal"
# window 1 is guaranteed to be recently opened window
do script "cd " & thePath & "; clear; if [ -d .git ] ; then git status; else echo -e \"\\033[1;31mNot a git repository! \\033[0m\"; fi"
activate
end tell
end if
tell application "System Events"
-- keystrokes always go to the frontmost application
set frontmost of application process "Terminal" to true
--keystroke newKey using command down
end tell
return input
end run
Das Problem:
- Wenn ich im Automator den Schritt "Ausgewählte Finderobjekte abfragen" integriere, dann funktioniert das Ganze im Automator.
- Wenn ich im Automator den Schritt "Ausgewählte Finderobjekte abfragen" weglasse, dann funktioniert das Ganze im Finder.
Ähm. Zum Debuggen irgendwie blöd. Entweder das Ganze läuft im Automator und dann im Finder nicht, oder umgekehrt. Was mache ich falsch? Mache ich etwas falsch?