Hiya Nobumi, Thank you very much for your reply and the detailed explanation.
On Wednesday, October 23, 2002, at 06:51 PM, Nobumi Iyanaga wrote:
On Tuesday, October 22, 2002, at 11:46 PM, Kino wrote:
Yes, very simple, But, if I understand well, your script repeatsSo I'd like to have the ability to exchange data between NW macro and perl/shell commands in NW X. In other words and for example, the ability to send strings selected non-contiguously to perl and replace them with those processed by perl one by one so that perl/shell process does not affect style attributes of non selected portion.This can be done already with the Frontier/Perl combination, although there may be problems of timing. -- I just tested a simple macro of the kind you described. Here it is:
> Find All "^.+" "g-SA"
> s -> push (StartEnds)
> loop:
> if (! s -> size) Exit
> SetSelect (s -> pop, s -> pop)
> Frontier Sample Macros:�Send Selected Text
> Frontier Do Script 'MacJPerl.runScripts.executeScript ("hiragana2katakana", {Nisus.basicUtilities.returnedValue})'
> MacroPaste
> GoTo loop
And I have a Perl script named "hiragana2katakana" in Frontier's databse, at "user.MacJPerl.scripts" table. This worked without any problem. You see how this is simple!
Frontier Do Script 'MacJPerl.runScripts.executeScript ("hiragana2katakana", {Nisus.basicUtilities.returnedValue})'
for each selection in NW? It is not rare for me to treat over 5000 character offsets or strings in a storage variable with NW macro. So this might take not a very short time. In the current NW macro, I think your method would be the best. But, with the *hypothetical* NW X macro language, I will be glad if I'll be able to do, for example, something like this:
// convert hiragana to katakana
set tmp_out=AUTO
set tmp_in=AUTO
Find All "[:hiragana:]+" "ogT"
s->push (StartEnds)
tmp_out->push (Strings)
// tmp_out will be generated automatically as a temporary file
// with an appropriate path/name and an appropriate
// separator between items.
DoShellScript ( ~/bin/hiragana2katakana.pl < tmp_out > tmp_in )
// tmp_in -- with an appropriate name automatically assigned by NW X
// -- will be read by NWX and used as a storage variable
// of the same name in the current macro.
loop:
SetSelect(s->pop, s->pop)
clipboard=tmp_in->pop
MacroPaste
if(s->size) goto loop
// end of macro
If the model I described above could be implemented, then there would be no problem to specify the path of perl or other commands. We would simply do:
....
do shell script "/opt/perl/bin/perl 'hiragana2katakana.pl' " & s
....
I think you are quite right.
But at least perl is not so verbose and wordy as AppleScript. And perl is cross-platform, so much more worth trying than AS, I feel.Perhaps Apple Script could satisfy some of lacks mentioned above. But I know nothing about it and it would be hard for me to learn more than a language at the same time ;-)Yes, I understand. And I find the AppleScript language not easy at all in general (by the way, Perl is not easy either...!).
Another merit to implement the ability to interact with perl or shell command in general into NW X macro language would be their ability to handle file system. With the current NW macro language, we have to invent a tricky routine just to know if a file of such and such a name is already existent or not. I know this is a piece of cake with Frontier and once you kindly wrote for me a Frontier script for this. But, as you said, Frontier/Radio for OS X is not free and perl is free. BTW I'm tended to trust a free software than a commercial product. In a free program very widely used such as perl, many and many people are involved. A bug is usually discovered and fixed very quickly.
Anyway, for this specific problem, the best solution would be to implement such features to NW X macro language. But the interactive ability above described will give the unlimited extensibility to NW X macro language. This is what I think to be the most important.
Anyway, I think people should post in this list descriptions of the scripting support that they wish to be implemented in Nisus Writer X -- with specific examples if possible. This may give ideas to Nisus developers.I agree with you. And I'd like to add: not only on scripting support but also on formatting features, speech ability, graphics or anything else. Our requests might be too late for NW X 1.0 but Nisus X developing team might try to implement some of them into NW X 1.0.3 or 2.0 ;-)
Kino
The Nisus Interactive List
[EMAIL PROTECTED]
Searchable archives:
http://www.mail-archive.com/nisus-interactive%40nisus.com/
To unsubscribe from this list please send a message with "unsubscribe
nisus-interactive" in the body of the email to [EMAIL PROTECTED]
