I'm currently trying to write a macro to Send Selection To Python, but I need some help to improve the stuff : I would like to be able to switch back to make active the previous buffer (the one the selecton came from) and the best would be maybe to do that in a transparent way without having the file popping into jEdit. I tried with the jEdit.openTemporary(); but didnt figured how to make it work. Some help would be really appreciated Here is the simple macro so far :
// Send Selected Text To Python
String pythonPath = "D:\\Softwares\\Developpement\\Python25\\pythonw.exe";
String currentFile = "D:\\_Temp\\_SendSelectedTextToPython.py";
Can anyone demonstrate a macro script that collates an array of filenames that match a certain extension within a specified directory path?
I would need a specific example of how to access each array item, and to know how many array items there are.
This does NOT have to recursive.
I'm trying to collate the names of all the files within a specific directory path with a specific extension.
My bsh macro file contains the following:
class OnlyExt implements FilenameFilter
public OnlyExt(String ext)
this.ext = "." + ext;
public boolean accept(File dir, String name)
file_path = "/example/mydir";
File f1 = new File(sys_file_path);
FilenameFilter only = new OnlyExt("bak");
// This is the OFFENDING LINE!!!
String filtered_files = f1.list(only);
for (int i=0; i
I have a macro that I use to save my current document to disk and then to the server on which I am required to launch builds. This all works fine. But when I do a save, the macro runs (running ssh) and the cursor ends up in the Console. How can I have the cursor jump back into the text area where I am working?
Also, the act of saving causes any errors in the Error List to be cleared. I can understand this given that Console does the error parsing, but is there some way I can tell Console not to clear the Error List?
How would I create a macro to toggle the tab size between 4 and 8? I tried to start one by recording a macro while I changed the tab size using the buffer options dialog, but the resulting macro only showed this: new BufferOptions(view,buffer) - which just brings up the buffer options dialog. I'm not sure now how to proceed. I want to learn how to write good macros, and eventually plugins, so I'm hoping for advice rather than a complete solution. But any help at all will be appreciated.
I'd like to write a macro for jEdit which runs an external application, and in doing this I wish to check whether a file at a specified path exists, and conditionally execute macro content on this basis.
Does anyone have a script that demonstrates how to use a Modal dialog from within a Beanshell macro?
Problem: I am trying to get user input in a beanshell script and set a variable based on that input. The problem is when I set modal=true for the JDialog box, the JDialog no longer disposes after presses of "OK" or "Cancel". The dialog just sits there and won't go away, therefore I cannot capture the result and set the variable.
I am writing a basic macro to find the next occurrence of the currently selected text. Something along these lines already exists and can be downloaded using the Macro Manager plugin. What's new in my version is that I would like to have the Search & Replace dialog be displayed if no text is currently selected. (That way, I can map it to Ctrl+F and still access the dialog via this shortcut.)
I couldn't find much info on this and what I did find seemed to refer to the "SearchDialog.showSerachDialog" method that doesn't seem to exist any more. I would be most grateful if someone could point me in the right direction.
I have been using jEdit for a few months now, and it is an awesome editor. I have written a few macros, but I do not know Beanshell very well and now I am stumped.
I want to write a macro to correct some words using SearchAndReplace command. I would like to be able to define the words to be searched and replaced, and then to run a loop, where the replacements happen. I am vaguely aware of things such as arrays and maps, and I think in my case I am going to have to use one of those, but I don't know where to begin.
This is an example of how I want it to work (just a concept, not a working code):
//Define search and replace pairs
searchReplacePairs = ("thats","that's",
//Grab each pair and perform replace
As you can see, I do not know how to define the array, then how to parse it to get the textToSearch/textToReplace pair and process it in the loop. Any help would be welcome.
How do I get to the class or method that control the Highlight. when you save as "example.java" the extension will know that it is a java program other extensions are Java,xml,php, perl.etc. example of what I am saying is below.
public SyntaxStyle getStyle()
Color foreground = (fgColorCheckBox.isSelected()
When I save a new file as "example.java" Those color on public, getsysle etc. should not appear again.
I have tried all the GlobalOptions, SyntaxHillit, and others I cannot find it. I am a babe learning.
Is it possible to write a macro that can return the xpath of the element or attribute the cursor is located at?
For example, given the following xml document, and assuming the cursor is located on the Target element, the macro would return the string: /Links/Link/Target
I can not find this functionality in the XML plugin or elsewhere.
I often have the task to select or delete a text (more than one line) from the actual position till a pattern to search for. If you know UEDIT there you can press "shift" and initiate the search. All the text from the current position including the string found will be marked.
I accomplished this by recording a macro and manipulating the Java code afterwards. However, if you are recording a quick macro this is much too intricate.
I've been trying to write some simple beanshell code which calls some methods from the Console plugin. In one part of this code I'm calling the following method:
runInSystemShell(view, "latex " + file);
Now in examples like the above, the program (in this case "latex") returns a process or error level number when it finishes. If the program completes without errors, it returns 0. If it encounters an error it usually returns a non-zero process code. Is there a beanshell/Java command or Console method that will return this process code?? Unfortunately, the above method (runInSystemShell) doesn't return a value so I don't know what the process code is after it completes.