|
From: Slava P. <sl...@je...> - 2003-10-18 19:37:52
|
Hi, The BeanShell cd() command does not do anything in jEdit. However, you can execute "cd ..." in the Console using runInSystemShell(). On Fri, 2003-10-17 at 14:43, Hemphill, Barry wrote: > I'm trying to put together a better macro for running perl scripts > from within jEdit - the Error List list plugin can be very useful in > quickly moving around from error to error. I'm using the Run Perl > Script macro (which uses runCommandInConsole to execute the script), > but there are a couple of problems I've found with it, so I made a > modified version. > > First, I found it tedious to type in the arguments at a prompt > (actually I guess that was the Run Perl Script with args macro), so I > put in some logic to look for arguments in the first 10 lines of the > script, in comments. That seems to work pretty well, but I'm still > having difficulty changing the current directory. If my perl script > has to read or write a file, and I don't include the fully file path, > I can't seem to make it work. If I either have the file name hard > coded (which I often do during development, and put command line arg > handling in later), or if the filename is passed as an argument, but > is relative, it fails with file not found, as the current working > directory is always the jEdit directory. > > Here's what I tried to do first: > > cd( buffer.getDirectory() ); > > I figured that way, if the file is in the same directory as the perl > program, it should work well. Unfortunately, it doesn't seem to > actually do anything - it doesn't error, but when I check (in the perl > program) what the current dir is, it's still the jEdit directory. > > Next I tried hard coding it: > > cd( "D:\\eHealth\\modules\\silicone" ); > > Once again, no effect at all. Am I misunderstanding what cd() does? Is > there a way I can either change the working directory for the macro to > the directory of the buffer or, even better, change it to any arbitary > directory before calling runCommandInConsole()? Should I be tackling > this in another way entirely? Ultimately, I want to be able to type a > key sequence (e.g. F11), have the script run, and if there are any > errors, pop them up in the error list plugin. File IO definitely seems > to be the sticking point. > > Thanks in advance for any suggestions, > > Barry > > > ---- > Barry Hemphill Senior Educational Specialist > Tel: (508) 486-4011 Educational Services > Fax: (508) 486-4004 Concord Communications, Inc. > bhe...@co... 600 Nickerson Road > http://www.concord.com Marlboro, MA 01752 > > "Human beings, who are almost unique in having the ability to learn > from the experience of others, are also remarkable for their apparent > disinclination to do so." > -- Douglas Adams, Last Chance to See > > > > ********************************************************************** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > This footnote also confirms that this email message has been swept by > the latest virus scan software available for the presence of computer > viruses. > ********************************************************************** -- Slava Pestov |