1#!/bin/sh
2
3# Directory we run from: blah/lamarc.app/Contents/MacOS
4LAMARC_BOTTOMDIR=`dirname "$0"`
5LAMARC_TOPDIR="$LAMARC_BOTTOMDIR/../../.."
6LAMARC_OUTPUT="$(/usr/bin/osascript -e "tell application \"System Events\" to activate" -e "tell application \"System Events\" to set thefile to choose folder with prompt \"Select your LAMARC output directory\"" -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")"
7LAMARC_INFILE="$(/usr/bin/osascript -e "tell application \"System Events\" to activate" -e "tell application \"System Events\" to set thefile to choose file with prompt \"Select your LAMARC infile\"" -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")"
8
9
10# Extra quoting required because $dirname may have spaces and double-quotes get
11# eaten below.
12
13scriptcmd="cd \\\"${mydir}/../../..\\\" ; \\\"${mydir}/lamarc -x\\\" ; exit"
14osascript <<EOF
15tell application "Terminal"
16	activate
17	do script "cd $LAMARC_OUTPUT; $LAMARC_BOTTOMDIR/lamarc -x $LAMARC_INFILE; exit"
18	set background color of window 1 to {52224, 65535, 65535}
19	set normal text color of window 1 to "black"
20	set cursor color of window 1 to "black"
21	set custom title of window 1 to "lamarc"
22end tell
23EOF
24
25