summaryrefslogtreecommitdiff
path: root/Build/source/texk/gregorio/gregorio-4.0.0-beta2/contrib/TeXShop/gregorio.scpt
blob: 36fafce29235cc7f0de890f9944e359a6379ce20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--Applescript
-- Tracy Llenos <tllenos@gmail.com>
-- a workaround macro for compiling Gregorio gabc files inside TeXShop

set fileName to #FILEPATH#
if fileName is equal to ""
activate
display dialog "Please save the file first" buttons {"OK"} default button "OK"
return
end if

-- finds proper filenames
-- from the Claus Gerhardt TeXShop macros
set fileName to #NAMEPATH#
set n to (number of characters of contents of fileName)
set fileNamequoted to quoted form of fileName
set baseName to do shell script "basename " & fileNamequoted
set m to (number of characters of contents of baseName)
set dirName to quoted form of (characters 1 thru (n - m - 1) of fileName as string)
set gabcName to baseName & ".gabc"

do shell script "cd " & dirName & ";" & "/usr/local/bin/gregorio " & gabcName

tell application "TeXShop"
activate
end tell
-- we return to TeXShop  TODO: the option of opening the tex file?