jEdit Community - Resources for users of the jEdit Text Editor
Invoking actions within a macro
Submitted by DanF on Wednesday, 25 August, 2004 - 06:26
Ok, here's how I'm doing it:
jEdit.getAction("find-next").invoke(view);
... but something's wrong. The action gets executed in some kind of strange silent mode. Messages aren't shown in the status bar (like "Search string not found!"), no confirm dialog box asks "Continue search from beginning?" (if auto-wrap is disabled), etc.

How do I invoke an action inside a macro? Are there other ways of doing this?
how to add reference of other api manuals from within a zip file to jedit help window?
Submitted by Anonymous on Sunday, 18 July, 2004 - 08:58
Hi,
Is there a way to add the references to manuals of other softwares - such as jdk api - so that the documentation can be loaded from a zip file into the jedit help window. i know that unziping the manual into jedit/doc/api folder along with a simple xml file does the job. However, its a criminal waste of space to unzip the manual (help files).

Thanks,

Salgavkar
Opening a file with a local apache server
Submitted by Anonymous on Wednesday, 30 June, 2004 - 12:38
Hello

I can't find a way to open a file in my browser from my local Apache server when that file is in a directory.

In MacOS X the default path for Apache is /Library/Webserver/Documents. But if I put a file in a directory /Library/Webserver/Documents/Jedit_file and i open the file from jedit, it always loads as http://127.0.0.1/the_jedit_file.php and not as http://127.0.0.1/Jedit_file/the_jedit_file.php.

Does anybody know how i can add this to a macro?

Thnx

Sjmielh
How to deal with buffer.isPerformingIO() ?
Submitted by Anonymous on Friday, 7 May, 2004 - 16:13
Hi I try to load file and perfomes some transformation on it then save on a loop of file.
But I am having a error on I/O perming so I try to wait for the
buffer to do it's job but then I only manage to have a Message instead of a error
Thread.sleep block Jedit an empty loop too.
this is the only working code but I like it to be without Message.

while(buffer.isPerformingIO()){
//this.wait(2);
//Thread.sleep(10);
Macros.message(view, nBFichier+" buffer.isPerformingIO()" );
}
Using external java libraries in macros
Submitted by AndreJRenard on Saturday, 1 May, 2004 - 13:38
Is it possible to use external java libraries in macros?
If yes, where should I put them?
Loading file Macro
Submitted by Anonymous on Monday, 19 April, 2004 - 21:15
Hi All,

Background:
I have been using jEdit for a few months and just starting to play with the Macros. I am ultimatly trying to change the permissions of a file and to edit a line of code. I use source safe and a local enviornment and have to modify a struts config file, which is read only until checked out. To make my life simple, I want to remove the read only attribute and find my DB reference line and change it to my local DB.

My problem:
I can change the attribs easily enough with
runCommandInConsole(view,"System","attrib amp-config.xml -r");

But I now need to load the file. I am not sure how I would load it into the buffer so I can see and manipulate it.

Any Suggestions?

Thanks
Tom
Waiting within startup script
Submitted by mbadran on Sunday, 18 April, 2004 - 15:50
Hi,

I'm trying to write a simple startup script that displays the actionbar and returns focus to the current buffer. The following code does this:

jEdit.getActiveView().actionBar();
textArea.requestFocus();

However, I can't seem to get it to execute at the right moment. I've tried a variety of ways, waiting for the view to be initialised, waiting for the buffer to load, etc., but none of it seems to work correctly.

Much appreciated,
Mohammed.
How do I modify the classpath of a macro?
Submitted by Anonymous on Friday, 9 April, 2004 - 11:09
I want to use a custom class to interpret a selected message (byte array) and create a new buffer with a nicely formatted, understandable, version of the message. I cant use the addClassPath() method of beanshell, I cant seem to get the instance of the Interpreter class, and I cant find the loadJarClasses.bsh mentioned in the jEdit manual.

Can anybody lend a hand?

Thanks
How do I modify the classpath of a macro?
Submitted by Anonymous on Friday, 9 April, 2004 - 11:08
I want to use a custom class to interpret a selected message (byte array) and create a new buffer with a nicely formatted, understandable, version of the message. I cant use the addClassPath() method of beanshell, I cant seem to get the instance of the Interpreter class, and I cant find the loadJarClasses.bsh mentioned in the jEdit manual.

Can anybody lend a hand?

Thanks
Select text in quotes - can macro do this?
Submitted by paulflory on Wednesday, 10 March, 2004 - 20:14
Here's what I'd like to do:

Assign a shortcut key to a macro that selects all the text within whatever quotes my cursor happens to be sitting between.

For example, say the cursor is sitting within the following line:

"How do you go to the stockyards?"

Does anyone an idea how I could write a macro that would select everything within the quotes? This would be quite convenient for doing quick replacements.

Thanks,
Paul
Launching DOS window from jEdit
Submitted by tupperduck on Tuesday, 9 March, 2004 - 02:12
(I am new to jEdit, so please bear with me)

I am learning C++ and am using jEdit (v4.1) as my editor of choice. I have noticed that the Console will not run programs requiring user input (e.g. std::cin >> menu_choice;) properly; it just continues through the program without waiting for values. Inconvenient, yes, but nothing major. These same programs function as expected when run from the Windows DOS prompt.

What I am trying to do is create a macro to run such a program in DOS. What I have so far is:

// filename parsing code, blah, blah, blah
runCommandInConsole(view,"System",runDOS);

Which works BUT as soon as the all the values are entered and the rest of the program executes, the DOS prompt window disappears and focus returns to the jEdit Console. It seems that the DOS prompt is not being spawned independently of jEdit/Console.

Looking through the documentation I tried variations using "&" to create a background process and "%detach" to create a separate process. Same result. I also tried the approach in the Launching External HTML Checker script by specifying the actual application path (C:\WINNT\system32\cmd.exe), but that runs DOS within Console (without spawing a DOS window) and I can't figure out how to send commands to it.

SO I guess my questions are:
1) Is there a way to launch the DOS prompt as an independent window?
2) Is there a way to send commands to a DOS process running in Console?

Hope that makes sense.
Thanks.
Get/set Edit mode?
Submitted by Anonymous on Thursday, 26 February, 2004 - 11:46
Hi! I would like to toggle the edit mode with a key. For this I need to get and set the edit mode with bean shell. How is this done?
Any help appreciated, thanks!

Spookyy
buffer.save problem
Submitted by jcb on Thursday, 19 February, 2004 - 08:45
Hello,

I'm struggling with the following problem: I wrote a macro which takes the current buffer, saves it at first and runs then a command line utility via runToBuffer() on the saved file. If this was successful it closes the buffer and tries to save the new untitled one (which holds the results of the computation).

runCommandToBuffer(...);
waitForConsole(view);
jEdit.closeBuffer(view,buffer);
buffer.save(view, null, true);

But the last statement in my macro - buffer.save(view,null,true) does not save the buffer "Untiteld-1". The bean shell variable buffer still points to the formerly closed buffer. Is someone out there who knows how i could save the new buffer created by runToBuffer() in my macro? Any help is greatly appreciated!

Jens-Christoph Brendel
Close the console problem
Submitted by baloo on Friday, 13 February, 2004 - 15:39
Hi, i modified a macro to do this

import console.Console;

startBatch()
{
String strCheckerPath = "F:\\projects\\javapaint\\makejar.bat";

runCommandInConsole(view, "System", strCheckerPath);

// close the console if it is open
// manager = view.getDockableWindowManager();
//if (manager.isDockableWindowVisible("console")) {
//manager.toggleDockableWindow("console");
//}
}

startBatch();

it's start a batch file, but if i uncomment the code for closing the console my batch file isnt starting anymore... if i let this in comment my batch file is starting but the console isnt closing. So how can modify this to be able to close the console and that my batch file start

thx
Format of date
Submitted by Anonymous on Monday, 26 January, 2004 - 12:26
Hey all, Trying to customize the stock Insert_Date.bsh macro to use the format I want but can't get it to work. So I tried this, and it didn't work either. What am I doing wrong?
    Date today;
    String output;
    SimpleDateFormat formatter;

    formatter = new SimpleDateFormat("E, M d, y - h :m  a", currentLocale);
    today = new Date();
    output = formatter.format(today);

    // inserting date and internet time to textarea
    textArea.setSelectedText(ouput);
Thanks in advance
Getting string properties
Submitted by Anonymous on Saturday, 24 January, 2004 - 19:38
Which method is recommended for getting a string property like "lineComment" which depend on the current editing mode?
buffer.getMode().getProperty() or can I use buffer.getStringProperty()?
Macro Help Needed by Newbie
Submitted by Anonymous on Tuesday, 20 January, 2004 - 01:24
Hello and thanks for looking and helping me out. I am using version 4.1 final.

For my second macro, I wish to write a routine that allows me to prompt the user for a single character and then to replace every character position in a selected area with that user-supplied character. Seems like it sould be pretty simple.

What I am finding is that it is not as easy as I expected. It seems that when selections include areas beyond the end of a line, the values I get for the start and end positions on those lines are not what I expect. They are offets into the buffer and there is no accounting for the selected area that has "virtual" space. There appears to be no way (in the API) for me to find the on-screen bondaries of the selected area.
Get environment variable from Windows
Submitted by Anonymous on Friday, 16 January, 2004 - 16:13
I am not a java programmer, so I'm not sure where or how to do it, but is there a way to get an environment variable into a macro variable? I would like to use environment variable %USERPROFILE% so that when I copy my .jedit folder to other computers that I use, all of my macros, and configurations work as they should on the other computers, seamlessly without modification. Example macro:
user = "grymmjack";
quot = "\"";
prog = "hh";
file = "C:\\Documents and Settings\\" + user + "\\.jedit\\reference\\php.chm";
line  = quot + prog + quot + " " + file;
runCommandInConsole(view, "System", line);
  
Regular expression in macro doesn't work
Submitted by Anonymous on Tuesday, 23 December, 2003 - 23:48
Hi, Macros like below
 
>>>>
    Pattern p = Pattern.compile("*.\(([0-9]+)\).*");
    lineText = textArea.getLineText(line);
    Matcher m = p.matcher(lineText);
>>>>

or 

>>>>
gnu.regexp.RE re = new gnu.regexp.RE("^(\*.)\\t(\*.)\\t(\*.)$");
lineText = textArea.getLineText(line);
gnu.regexp.REMatch match = re.getMatch(lineText);
lineText = "<1>=" + match.toString(1) + "<2>=" + 
   match.toString(2) + "<3>=" + match.toString(3);
>>>>
don't work. Parsing fails on both. Does it mean I can't use any regular expressions in macros or am I doing something wrong?
How to Un-comment a selection
Submitted by orapower on Wednesday, 17 December, 2003 - 17:36
I'm looking to do the opposite of applying comments (both line and range) to a selection. Any idea how to do this?
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
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
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293