
TEXファイルをplatexでコンパイル、dvipdfmxでpdfに変換、openする過程をドラッグアンドドロップで自動でやってくれる.appを作ろうと思っているのですが、do shell script でPerlプログラムを実行した際にこけてしまいます。
###AppleScript(main.scpt)
Applescript
1on open DropFile 2 set thePath to POSIX path of (path to current application) 3 set aCMD to "perl " & thePath & "Contents/Resources/Code/tex.pl " & POSIX path of DropFile 4 display dialog aCMD 5 do shell script aCMD 6 display dialog result 7end open
###Perlファイル(tex.pl)
perl
1use strict; 2use warnings; 3use utf8; 4 5my $FilePath = $ARGV[0]; 6my $DirPath = `dirname $ARGV[0]`; 7my $FileName = `basename $FilePath .tex`; 8my $EndCode = 1; 9 10chomp($FileName); 11chomp($DirPath); 12my $PlatexResult = system("cd $DirPath ; /usr/texbin/platex -interaction=batchmode $DirPath/$FileName.tex"); 13if ($PlatexResult != 0){ 14 $EndCode = 2; 15 goto end; 16} 17my $DvipdfmxResult = system("cd $DirPath ; /usr/texbin/dvipdfmx $DirPath/$FileName.dvi"); 18if ($DvipdfmxResult != 0){ 19 $EndCode = 3; 20 goto end; 21} 22my $OpenPngResult = system("cd $DirPath ; /usr/bin/open $DirPath/$FileName.pdf"); 23if ($OpenPngResult != 0){ 24 $EndCode = 4; 25 goto end; 26} 27 28end: 29 30system("clear"); 31sleep 1; 32print "$EndCode\n";
###結果(ダイアログ)
3
結果から、dvipdfmxの処理でエラーになっているようなのですが、ターミナルで/bin/shをし、tex.plにmain.scptが渡すコマンド(aCMD)を入力してみると結果(print)は1となっていて通っています。do shell scriptは特別な書き方があるのでしょうか。原因のわかる方回答お願い致します。
###補足情報
OSX 10.10

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。