0
Xcodeに次のAppDelegate.applescriptがあります。私は一緒に行くインターフェイスを作成し、スクリプト(とUI)のすべてのコードは正常に動作します。しかし、UIの一番下にあるサーバーのバージョンに気付く(リンクの画像)。今はハードコードされています。Applescript + Xcode - cli出力からvarを読み込んでテキストに挿入
私はそれをhttpd -v |grep version
の出力を読み取って動的にしたいと思っていました。これはServer version: Apache/2.4.18 (Unix)
のようなものです。
つまり、私はdo shell script "/usr/local/bin/httpd -v |grep version"
になり、結果をUIのなんらかの種類のテキストセル(または他のセル)に表示したいと考えています。私はプロジェクトをより簡単に提供できる。前もって感謝します!
script AppDelegate
#### PROPERTY LIST ####
property parent : class "NSObject"
property startApache : missing value
property restartApache : missing value
property stopApache : missing value
property editConfig : missing value
property editVHosts : missing value
property openDir : missing value
property resetConfig : missing value
#### APACHE CMDs ####
on startApache_(sender)
do shell script "/usr/local/bin/apachectl start" with administrator privileges
end startApache_
on restartApache_(sender)
do shell script "/usr/local/bin/apachectl restart" with administrator privileges
end restartApache_
on stopApache_(sender)
do shell script "/usr/local/bin/apachectl stop" with administrator privileges
end stopApache_
on editConfig_(sender)
do shell script "open -a /Applications/BBEdit.app /usr/local/etc/apache2/2.4/httpd.conf"
end editConfig_
on editVHosts_(sender)
do shell script "open -a /Applications/BBEdit.app /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf"
end editVHosts_
on openDir_(sender)
do shell script "open /usr/local/var/www/htdocs/"
end openDir_
on resetConfig_(sender)
display dialog "Are you sure you want to reset the httpd.conf to it's default settings?\n\n This cannot be undone!" with icon stop with title "Reset Configuration File"
do shell script "/usr/sbin/apachectl stop" with administrator privileges
do shell script "cp /usr/local/etc/apache2/2.4/httpd.conf.default /usr/local/etc/apache2/2.4/httpd.conf ; cp /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf.default /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf" with administrator privileges
end resetConfig_
on applicationWillFinishLaunching_(aNotification)
end applicationWillFinishLaunching_
on applicationShouldTerminateAfterLastWindowClosed_(sender)
return true
end applicationShouldTerminateAfterLastWindowClosed_
on applicationShouldTerminate_(sender)
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
は、内のプロパティにテキストフィールドを接続し、 '変数へのシェルscript'ラインを行うの結果を割り当てをそのスクリプトに 'stringValue'を設定します。 – vadian
私は何が間違っているのか分かりません。偶数ではない:私のアウトレットを「これは何らかのテキストです」に設定しています。 –
httpdVersionのstringValue()を "this is some text"に設定しました\も動作していません –