AppleScript
[bearbeiten] Kommandozeillen Parameter eines Scripts auswerten
Any arguments following the script will be passed as a list of strings to the direct parameter of the "run" handler. For example:
| Datei: a.scpt
|
a.scpt:
on run argv
return "hello, " & item 1 of argv & "."
end run
|
% osascript a.scpt world
hello, world.
|
Quelle: [1]
[bearbeiten] System Variablen auswerten
In a Bourne style shell do this (in csh style shells do a setenv):
my_foo=val osascript foo.scpt
|
Now at the beginning of the AppleScript add this:
| Datei: foo.scpt
|
set this_foo to system attribute "my_foo"
|
[bearbeiten] Shell Befehle aufrufen
| Datei: foo.scpt
|
set Date to do shell script "date +%Y-%m-%d"
|
[bearbeiten] Aus einem ShellScript eine AppleScript starten
| Datei: test.sh
|
#!/bin/sh
/usr/bin/osascript << EOF
tell application "Finder"
activate
display dialog "howdy"
end tell
EOF
exit
|
oder wenn eine Skriptdatei bereits existiert
/usr/bin/osascript foo.scpt para1 para2
|
Quelle: [2] bzw. [3]