Running Lispworks from the shell.

Shell script for Mac OS X that launchs Lispworks Personal edition and then uses applescript to initialize it. The initialization then presumably loads swank, so slime can talk to it. This works with the recently release 4.4.5 LispWorks.

I spend an inordinate amount of time working thru an AppleScript error where the line activate application "LispWorks Personal" would fail on one machine but not on another. Finally deleting LispWorks, empting the trash, rebooting the machine, reinstalling LispWorks, and firing it up via the finder before running this script fixed it. I think some sort of directory of known applications was wedged.

#!/bin/sh

# Because we fork, and then wait for the fork to end you can't do all
# this in AppleScript.
# 1. Fork Lispworks.
# 2. Run an applescript to step it thru start-up.
# 3. Finally wait till it exits.

cd ~/w/lispworks

"/Applications/LispWorks Personal 4.4.5/LispWorks Personal.app/Contents/MacOS/lispworks-personal-4-4-5-darwin" &

osascript <<EOS

-- Wait for it.
tell application "System Events"
  repeat until process "lispworks-personal-4-4-5-darwin" exists
    delay 1
  end repeat

  activate application "LispWorks Personal"

  -- Clear splash screen, force feed the init, hide the application.

  tell process "lispworks-personal-4-4-5-darwin"
    repeat until window "LispWorks Personal Edition" exists
      delay 1
    end repeat
    click button "Close" of window "LispWorks Personal Edition"
    tell window "Listener 1"
      keystroke "(load \"~/w/lispworks/init\")"
      keystroke return
    end tell
--    set visible to false
  end tell
end tell

EOS

wait

Leave a Reply

Your email address will not be published.