Author Topic: Starting OS X SlickEdit from Terminal  (Read 8183 times)

jkwuc89

  • Senior Community Member
  • Posts: 199
  • Hero Points: 6
Starting OS X SlickEdit from Terminal
« on: July 27, 2006, 04:51:01 pm »
When doing development work, I am a command line junkie.  Under Linux and under Windows, I have scripts set up that allow me to do this:

s <file to edit>

If SlickEdit is not running, a new instance is started and a buffer window is opened with <file to edit>.  If SlickEdit is already running, the existing instance is used to open <file to edit>.

Under /Applications/SlickEdit11Trial.app/Contents/slickedit/bin, there is a binary named vs but when I try to run it from a Terminal window, I get this:

SlickEdit: Can't open connection to X. DISPLAY='<Default Display>'

How do I duplicate my s script mentioned above on OS X?

garion911

  • Senior Community Member
  • Posts: 200
  • Hero Points: 13
Re: Starting OS X SlickEdit from Terminal
« Reply #1 on: July 27, 2006, 08:22:46 pm »
You can use the open command..

open -a /Applications/SlickEdit11.app <filename>

Just tried this myself, and it works..

dmw

  • Senior Community Member
  • Posts: 145
  • Hero Points: 15
Re: Starting OS X SlickEdit from Terminal
« Reply #2 on: July 27, 2006, 10:12:28 pm »
You can also run it by calling 'vs' directly, just make sure you have X running first (X11.app).  I usually have 'vs' in my path and X11.app in my startup items.  The side benefit to having 'vs' in the path is that you can run other SlickEdit tools from the command line, such as 'vsdiff' (very handy).

jkwuc89

  • Senior Community Member
  • Posts: 199
  • Hero Points: 6
Re: Starting OS X SlickEdit from Terminal
« Reply #3 on: July 28, 2006, 02:15:16 am »
Thank you for the replies.  Using open -a /Applications/SlickEdit11.app <filename> from Terminal works as expected.  I tried running /Applications/SlickEdit11.app/Contents/slickedit/bin/vs with X11 already running and I still get this error message:  SlickEdit: Can't open connection to X. DISPLAY='<Default Display>'

So, I'll fashion a script to use the open -a command described above.

dmw

  • Senior Community Member
  • Posts: 145
  • Hero Points: 15
Re: Starting OS X SlickEdit from Terminal
« Reply #4 on: July 28, 2006, 02:49:37 am »
Try setting the DISPLAY variable first.

export DISPLAY=:0

garion911

  • Senior Community Member
  • Posts: 200
  • Hero Points: 13
Re: Starting OS X SlickEdit from Terminal
« Reply #5 on: July 28, 2006, 05:08:12 pm »
His problem is that X11 is not running at the time.. He wanted a way that would auto-start X11 if it wasn't running.. THe open command solves that.

dmw

  • Senior Community Member
  • Posts: 145
  • Hero Points: 15
Re: Starting OS X SlickEdit from Terminal
« Reply #6 on: July 28, 2006, 11:43:30 pm »
I'm sorry, I was unaware that offering alternatives is unacceptable.

Seriously though, I hope you didn't take the view that my offering of an alternative was in any way suggesting that your solution was somehow inferior.  There is more than one way to approach just about any problem, and sometimes the things we learn from having alternate views available have benefits that go beyond the solving of the immediate problem.

jkwuc89

  • Senior Community Member
  • Posts: 199
  • Hero Points: 6
Re: Starting OS X SlickEdit 2007 from Terminal
« Reply #7 on: April 06, 2007, 04:48:58 pm »
When I start SlickEdit 2007 from Terminal, the SlickEdit window is reused if it is already open which is good.  However, the input focus is not given to the SlickEdit window.  It stays with the Terminal window.  Is there a way to force the input focus to SlickEdit when I start it from Terminal?