jEdit Community - Resources for users of the jEdit Text Editor
Running macro xxx times
Submitted by heinkonijn on Monday, 21 April, 2008 - 12:08
Hi,

I have created a macro, and I weant to run it multiple times.
I have read the documentation and I cannot find how it should be done.

Is it possible?

Thanks,
Hein
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Please explain a bit more.
by elberry on Mon, 21/04/2008 - 20:41
Please explain a bit more.

Do you want to to run it multiple times individually, by hitting a shortcut key to activate it?

Or programmatically run it multiple times?

The first one can be achieved with shortcuts. See "Global Options" -> "Shortcuts".

For the second one, why not just add an input to your macro that takes a user input for the number, and then just execute your code that many times?

Eg.
[code]
String input = Macros.input(view, "How many times?");
int times = 1;
if(input != null && input != "") {
   try {
      times = Integer.parseInt(input);
   } catch(Exception e) {
      // bad number, just execute once.
   }
}
for(int count = 0; count < times; count++) {
   // your previous macro code goes here.
}
[/code]

Learn from the past. Live in the present. Plan for the future.
11101000
 
I meant the second one. Th
by heinkonijn on Tue, 22/04/2008 - 11:23
I meant the second one.

Thanks, it works great!!!

Thanks a lot!

Hein
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   82349
Context Free Art (*.cfdg)   0.31   46055
BBEdit scheme   1.0   18595
JBuilder scheme   .001   18495
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