Running perl scripts on the fly

J

jrosik

Hi all,

I would like to run perl scripts as in the following scenario:

1. I open a text editor - for example Notepad, Wordpad, Word.
2. I paste some text into this text editor.
3. I press a magic key - let's say I double press the Shift key.
4. A magic window appears and I enter the following script:
while (<>) {
s/you/You/;
print;
}
5. I execute the script.
6. Now there are two text editor windows - one with the source text
and another with the output text.

Is this possible?

One note: I have not saved any document during my scenario!

Regards,
Jiri Rosicky
 
K

krakle

Hi all,

I would like to run perl scripts as in the following scenario:

1. I open a text editor - for example Notepad, Wordpad, Word.
2. I paste some text into this text editor.
3. I press a magic key - let's say I double press the Shift key.
4. A magic window appears and I enter the following script:
while (<>) {
s/you/You/;
print;
}
5. I execute the script.
6. Now there are two text editor windows - one with the source text
and another with the output text.

Is this possible?

One note: I have not saved any document during my scenario!

Regards,
Jiri Rosicky

Check out SciTe!
 
M

Mumia W.

Hi all,

I would like to run perl scripts as in the following scenario:

1. I open a text editor - for example Notepad, Wordpad, Word.
2. I paste some text into this text editor.
3. I press a magic key - let's say I double press the Shift key.
4. A magic window appears and I enter the following script:
while (<>) {
s/you/You/;
print;
}
5. I execute the script.
6. Now there are two text editor windows - one with the source text
and another with the output text.

Is this possible?

One note: I have not saved any document during my scenario!

Regards,
Jiri Rosicky

It sounds like you want an IDE (Integrated Development Environment) for
Perl. Do a yahoo search for it.

However, the Perl debugger might suffice for some of your needs, e.g:

C:\> perl -de 42

Read the "perldebug" document:

Start->Run->"perldoc perldebug"


HTH
 
J

jrosik

Yes Len, I need to do more complex things. The scenario can look like
this:

1. I open a text editor - for example Notepad, Wordpad, Word.
2. I paste some text into this text editor.
3. I press a magic key - let's say I double press the Shift key.
4. A magic window appears and I enter the following script:
while (<>) {
next if (/Start ignoring HERE/) .. (/End ingnoring HERE/);
s/AAA(\d+)(.+?)BBB(\d+)/AAA$3$2BBB$1/;
print;
}
5. I execute the script.
6. Now there are two text editor windows - one with the source text

Another variant of the 4th step could be just the removal of comment
marks from the line beginnings:
4.
while (<>) {
s/^> >//;
print;
}

I am trying to accomplish the most simple way to filter text data
using perl script.

The text data usually come from a "text editor" (it also can be a web
form). I need to pick the data -> process it -> put it back as
simple / fast as possible.

The problem with common perl filtering process is that:
- I need to save the source data somewhere,
- I need to save the perl script somewhere,
- I need to execute the perl script .. "perl script.pl data.txt",
- I need to capture the output,

Regards,
Jiri Rosicky

l v napsal:
 
J

Jim Ford

Hi all,

I would like to run perl scripts as in the following scenario:

1. I open a text editor - for example Notepad, Wordpad, Word.
2. I paste some text into this text editor.
3. I press a magic key - let's say I double press the Shift key.
4. A magic window appears and I enter the following script:
while (<>) {
s/you/You/;
print;
}
5. I execute the script.
6. Now there are two text editor windows - one with the source text
and another with the output text.

Is this possible?

One note: I have not saved any document during my scenario!

I believe you can do just this sort of thing easily with the Plan9 O.S..
Try running Plan9 with Qemu and have a fiddle - it's weird, but fun!

Jim Ford
 
J

JussiJ

I would like to run perl scripts as in the following scenario:

1. I open a texteditor- for example Notepad, Wordpad, Word.
2. I paste some text into this texteditor.
3. I press a magic key - let's say I double press the Shift key.
4. A magic window appears and I enter the following script:
while (<>) {
s/you/You/;
print;
}
5. I execute the script.

FWIW the Zeus IDE can be configured to do this.

The "magic window" would be nothing more than a new or existing
document window and the "magic key" would be any key bound to
a Zeus macro.

For example this macro script:

http://www.zeusedit.com/forum/viewtopic.php?t=220

does something very similar for SQL scripts. It takes the text
from the current document and sends it to iSql and captures the
output.

So all that is needed is the command line contained in the script
is changed to run Perl instead of iSql.exe utility.
6. Now there are two texteditorwindows - one with the source text
and another with the output text.

In the case of Zeus you would be left with the original document
window and a new tool output window containing the output generated
by the perl script.
Is this possible?
Yes.

One note: I have not saved any document during my scenario!

Zeus will run the script whether the document is save or not saved.

Jussi Jumppanen
Author: Zeus for Windows IDE
 
J

jrosik

Jussi,

I have tried Zeus and the example of a macro running iSql.exe. I did
not figure out where to place the perl script. Actually I need two
windows - one with the text to process and another one with the perl
script. The "iSql.exe" macro example operates only with one window.

Jiri


JussiJ napsal:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top