Help for Zap and StrongED
Stefano Bertinetti (2512) 21 posts |
I’m trying to write some sort of ‘batch’ files in RISC OS, and my attempts are unsuccesful and in some way frustrating. At work from time to time I write little script files to help doing massive tasks (moving 100 BTSs at a time from one place to another can be very boring). I normally use PSPad and Notepad on Windows, and when trying to replicate some commands in Zap or StrongED I fail. |
||||||||||||||||||||
Julie Stamp (8365) 474 posts |
Hi Stefano :-) Could you give an example of what you are trying to do, like what the text would be before and after? Are you trying to write a script to do the same search and replace in lots of text files? |
||||||||||||||||||||
GavinWraith (26) 1563 posts |
I think this is my cue for saying something about scripting, possibly with StrongED. If Stefano would give us more details, I think he would get lots of possible solutions. |
||||||||||||||||||||
Steve Fryatt (216) 2105 posts |
You don’t say what version of RISC OS. Assuming 5.27 from recent months, select the text, press Ctrl-E (Zap) or Shift-Ctrl-C (StrongED) to copy it to the clipboard, place the caret in the dialogue box, press Ctrl-V to paste the text.
You might be over thinking it. Both Zap and StrongED use the “outdated” immediate cut/copy/paste model, so Ctrl-X deletes the selected text, Ctrl-V moves it to the cursor position and Ctrl-C copies it to the cursor position. To accommodate the more modern global clipboard model, they use different keys – which Zap names in an Emacs style:
|
||||||||||||||||||||
Chris Johnson (125) 825 posts |
If you are using Zap, then open the S&R (or S) dbox, select the text, put the cursor in the S&R field and use Ctrl-P. That copies the selected text in to the S&R field. That works here. |
||||||||||||||||||||
Stefano Bertinetti (2512) 21 posts |
First, thank to all for answers. |
||||||||||||||||||||
Chris Hall (132) 3559 posts |
On my version of Zap, CTRL-C is copy – you highlight some text, move the cursor and CTRL-C copies it. |
||||||||||||||||||||
Steve Fryatt (216) 2105 posts |
Not much use if you want to paste into an icon, as that’s Zap’s “immediate” copy. As I wrote above, to copy to the clipboard, you need Ctrl-E in Zap, or Shift-Ctrl-C in StrongED. |
||||||||||||||||||||
Colin (478) 2433 posts |
Duplicate deleted |
||||||||||||||||||||
Colin (478) 2433 posts |
I modified the StrongEd Basemode modefile file so that Ctrl-X Ctrl-C and Ctrl-V cut copy and paste to the clipboard years ago. Personally think it should have been the default but now I’ve worked out how to change it it doesn’t matter to me now. |
||||||||||||||||||||
Fred Graute (114) 645 posts |
Apart from using the clipboard you can also use F7 in StrongED to copy selected text to Search and Search&Replace windows. Another option is Ctrl-W which will copy the word the cursor is in, press again to get the next word, etc.
There are some examples of Advanced Search in the StrongHelp manual but these only scratch the surface. Getting the search expression right can be difficult at times. If you can remember S&R expressions you used, post them here and I’ll have a look at them to see why it didn’t work. |
||||||||||||||||||||
Ronald (387) 195 posts |
Action RISC OS StrongED Zap Zap Name Netsurf is using the clipboard the RISC OS way, but hangon, there are changes coming to RISC OS?, easier to wait and see when the time comes I think. |
||||||||||||||||||||
Stefano Bertinetti (2512) 21 posts |
Thank you Fred. Only today I managed to redo the S&R that didn’t work: If you select the end-of-line mark ( > ) as the search and when replacing select “replace all” StrongED goes in infinite loop as: |
||||||||||||||||||||
GavinWraith (26) 1563 posts |
The whole subject of text-manipulation is fraught with difficulties. The nearest thing to a standard notation is PCRE (Perl Compatible Regular Expressions) which itself suffers from historic misunderstandings, is too general for many problems, and too special for others. Every text-editor, every piece of software that needs notation for patterns or captures, reinvents the wheel for itself. !Edit, !Zap, !StrongED all have their own notations – in fact two of them, simple & advanced, in the latter two cases. But whatever notation one has, the fact remains that it seems to be very difficult for human beings to specify precisely what they are looking for. Take a word like word : what is it? We all think we know, but it can be a very slippery notion to tie down. Because I am now more familiar with Lua’s pattern-matching syntax I tend to use homemade solutions written in Lua, either for use with StrongED, or on their own. YAL (Yet Another Locater), for example, searches textfiles in directories for all lines that match a given set of patterns and do not match another set of patterns. |
||||||||||||||||||||
Rick Murray (539) 13851 posts |
Yup. And annoyingly there are quirks so that what works in Edit (and should work in Zap) acts in subtly different ways leading to results that aren’t quite what was expected.
If we’re talking about Latin like languages that aren’t German, it’s a series of alphabetics separated by one or more non alphabetics. As for German. Tendency to run a lot of words together. I remember an advert on German TV from the early 90s (Astra 19.2E) that was for, I presume, some female sanitary product. The end of advert text was two lines of characters, only a couple of spaces, and a few capital letters in the middle. So determining what a word is then will be…more challenging. As for the non alphabetic separator, that’s to allow things like “container-ship” to be correctly interpreted as two words. I choose that example carefully, as “container ship” is an alternative (open vs closed compounds), but then again, so is “containership” just to come full circle and arrive at Gavin’s “what it a word” conundrum. In a text editor when trying to determine how what and why in searches, we make arbitrary rules as to what a word is. You can see this every time your software provides you with a word count. Did you ever stop to consider how the software actually counts words? Does it count “that’ll do pig” as three or four? |
||||||||||||||||||||
John WILLIAMS (8368) 495 posts |
I continue to be flummoxed reading the word “miniseries”, which seems somehow to be associated with unhappiness. But to whom can we appeal to have it hyphenated to make it more meaningful? On the “word” thing, a word has either a space before and after it, or the after bit is a punctuation mark in English, one of “?!,:;”, unless its in quotes or brackets. Of course, French drives a coach and horses through this! See my page on French punctuation! Makes word-counting in WP programs very language-specific. |
||||||||||||||||||||
GavinWraith (26) 1563 posts |
Even without the differences between languages, even forgetting Unicode and sticking to plain ASCII, things are bad enough. Abstractly, a string is just a finite sequence of characters (possibly an empty sequence, of course). So a character in a string has two qualities: its value (ASCII code in the case of ASCII) and its index in the string, a number from 1 to the length of the string – what and where . There are certain subsets, character classes , of the set of character values that we may be interested in: upper case characters, lower case characters, decimal digits, hexadecimal digits, control characters, punctuation symbols, … in the ASCII case we have 2^256 character classes to consider, from the empty class to anything_goes and all that is in between. For every class we have its complement – the classes form a Boolean algebra. For the position of a pattern we might need to know if it occurs at the beginning of the string or at the end of a string. It is easiest to understand what patterns are if we consider what operations on patterns we need to make: there is catenation (first this then that), there is alternation (try this, if it doesn’t work, try that), there is subtraction (so long as it doesn’t match this try that), there is repetition (match this at least x-many times, and match this at most x-many times). |
||||||||||||||||||||
David Feugey (2125) 2709 posts |
Almost correct :)
No. They are different.
Read “with some printing systems”.
No. Preceded by an half space, and followed by a space The problem is that half space did not exist on typewriters.
Not only that. Words have much different sizes in French. From the very common “et” to things as “anticonstitutionnellement”. So we count pages as characters (with spaces) and not words. I suspect German journalists do the same as their words can be very very long. |
||||||||||||||||||||
Rick Murray (539) 13851 posts |
By that logic, you count “twentieth-century”, “early-onset”, and “cost-effective” as single words… nor single quotation marks.
I never really noticed the French idea of the two-point punctuation being offset by a space. It would explain part of why written French looks a little odd to me. French doesn’t tend to capitalise things that we English do. Sunday, 28th June when written in French would have neither the day nor the month bearing capitals. I don’t tend to read French books. The quotation style (preceding dash) annoys me. In your example, it’s interesting to look at which parts are indented and which parts aren’t, to try to work out which is actually quoted speech and what’s describing actions or thoughts in between the speech. The way the French do it…just looks messy. BTW, yes, I’m aware of the leftpondians sticking their sentence structure punctuation inside quotes. That’s not messy, that’s just dumb.
That’s because you’re missing a syllable when parsing it. If you drop the “ni”, the result is “miseries”. Gavin, for English I prefer the “it’s a series of alphabetics separated by one or more non alphabetics” approach. Much simpler. ;-) PS: Shouldn’t this be in Aldershot by now? |
||||||||||||||||||||
John WILLIAMS (8368) 495 posts |
I would be grateful to get this right, if you have the time to discuss it in more detail! Most of my French friends lack real expertise in this area! petit.fouratfree.fr should be fairly easy to decipher! |
||||||||||||||||||||
John WILLIAMS (8368) 495 posts |
Which they are – compound words – like “mini-series” would be if it were written sensibly!
Ah, you noticed that too! |
||||||||||||||||||||
GavinWraith (26) 1563 posts |
Before we rightly take ourselves off to Aldershot, may I ask if anybody has had the experience of finding a word running through their head, and only afterwards realizing that the corner of the eye has picked up something from the spine of a book on a shelf that you did not realize was there? Subliminal vision means that the miseries of miniseries, and the shoplifting shopfitters are serious phenomena. Ad men have long known this, Amen to Freud. |
||||||||||||||||||||
Rick Murray (539) 13851 posts |
Yes. Sometimes to the point where I drop everything and go looking to satisfy my curiosity of why a random unexpected word is rattling around in my head. It’s one thing to do it at home. It’s quite another to walk around town looking for a word. |