How would I find the number of times
</Placemark>
occurs and get that automatically onto the clipboard (for further processing elsewhere) please?
I can do the first stage, albeit in kludgy fashion, by using Find, then Mark All, then Edit > Copy Other > Bookmarked lines, but I've so far not found a way to copy the resulting number of lines in that final text doc. Using View > Document Properties displays the number, but short of an unreliable OCR tool I can't access it programmatically.
Terry, East Grinstead, UK
Get number of occurrences to clipboard?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
You can find the number of lines in a document or a selection with:
Search | Replace... (<F8>):
You can get part of the way to finding the number of occurrences of </Placemark> in your original file with:
Search | Replace... (<F8>):
Note to Helios: This solution could be improved if sequence numbers could be generated within replacement conditional expressions, but it seems they can't.
Search | Replace... (<F8>):
The last line of the result will contain the number of lines. But note that the number of lines you have copied and pasted is the number of lines containing occurrences of </Placemark>, not the number of occurrences of </Placemark>Find what: .*\n
Replace with: \i\n
[X] Regular expression
Replace All
You can get part of the way to finding the number of occurrences of </Placemark> in your original file with:
Search | Replace... (<F8>):
The penultimate line of the result will contain the number of occurrences of </Placemark>.Find what: [\s\S]*?</Placemark>|[\s\S]+
Replace with: \i\n
[X] Regular expression
Replace All
Note to Helios: This solution could be improved if sequence numbers could be generated within replacement conditional expressions, but it seems they can't.
Many thanks, that's very clever! Added to my archives for future use.
I've actually just finished a macro (written with Macro Express Pro) that achieves it in a way that I understand more intuitively.
- Source is the KML file of an entire folder of Google Earth placemarks
- I place it into a variable
- Determine its length nBefore
- Delete all occurrences of the target, </Placemark>
- Determine the new length and hence the difference nDiff
- Divide nDiff by 12 (the target length) to get the count
I've actually just finished a macro (written with Macro Express Pro) that achieves it in a way that I understand more intuitively.
- Source is the KML file of an entire folder of Google Earth placemarks
- I place it into a variable
- Determine its length nBefore
- Delete all occurrences of the target, </Placemark>
- Determine the new length and hence the difference nDiff
- Divide nDiff by 12 (the target length) to get the count