名前: sakoda 日時: 2007-10-11 12:47:05 IPアドレス: 202.25.83.*
>>49788 TeXShop+AppleScriptの話に乗ったついでに、 先日知人に頼まれて作ったものを紹介させて下さい。 デジカメやスキャナからのJPEG画像を取り込む際に、 TeXShopからebbを実行し、 デフォルトのfigure環境を文書中に挿入します。 (ebbへのPATHや画像のwidthなどは適宜調節する必要があります) --Applescript direct --calls ebb for finding Bounding Box of some image files such as JPEG, PNG, and PDF --(but I'm not sure if it is useful for PDF) activate set ebbCOM to "/usr/local/teTeX/bin/ebb " set theWIDTH to "0.5" tell application "Finder" to set selectedItem to the selection as alias if not (folder of (info for selectedItem)) then tell application "Finder" set destination to parent of selectedItem as alias end tell end if do shell script "cd " & (POSIX path of (destination)) & "; " & ebbCOM & (POSIX path of (selectedItem)) tell application "TeXShop" activate set PicName to (POSIX path of (selectedItem)) set the clipboard to (return & "\\begin{figure}[htbp]" & return & "\\begin{center}" & return & "\\includegraphics[width=" & theWIDTH & "\\textwidth]{" & (PicName) & "}" & return & "\\caption{default}" & return & "\\label{default}" & return & "\\end{center}" & return & "\\end{figure}" & return & return) tell application "System Events" keystroke "v" using command down end tell end tell
この書き込みへの返事: