alexpgp: (Visa)
(I guess I'm starting to think in Russian, which is really strange because I'd expect "Belay that!"—which, along with perhaps "As you were!," is the English equivalent of the subject—to come into my mind in English.)

What am I belaying?

Reformatting the document I lost, is what.

Instead, I decided to recover some macros that Word trashed for me.

(I am reminded of an old joke about passengers on an overnight transoceanic flight that experiences a series of engine failures and concomitant assurances from the crew that the aircraft can fly safely with the remaining engines. However, each time an engine fails, the crew also announces an ever-later arrival time. Finally, after the third of the aircraft's four engines fails and the arrival time now becomes 4 hours after the originally scheduled time, The Hero Of Our Story™ is heard to remark "Golly, I hope that last engine doesn't conk out, or else we'll be up here all night!")

Why am I reminded of that story?

Well, as long as clients insist I use Word for their translations, I'll never have to worry about too much free time on my hands. (Yes, I have an attitude problem, but I'll get over it.)

Cheers...

P.S. One of the macros that I needed to "reinvent" (because Normal.dot went kerplowie! after a recent crash was the following:
Sub Add3After()
'
'
    With Selection.ParagraphFormat
        .SpaceAfter = .SpaceAfter + 3
    End With
End Sub
This macro will have two siblings, one to add 3 points before a graf and another to zero out all spacing before and after a graf.
alexpgp: (St. Jerome w/ computer)
As it turns out, I have a client who really, really does not like to see justified text in the documents I send him. This used to eat a certain amount of time during the post-translation phase, as the folks who put together the source document mix justified willy-nilly with left-aligned, with centered, as well as a dash of right-alignment to round things off.

So it was only natural for me to want to write a Word macro that, basically, goes through each paragraph within a document and changes only those with justified text to display as left-aligned. Check it out:
Sub ChangeJustifiedToLeft()

Dim oSource As Document
Set oSource = ActiveDocument

j = oSource.Paragraphs.Count

For i = 1 To j
StatusBar = "Processing " & i & " of " & j
If oSource.Paragraphs(i).Format.Alignment = wdAlignParagraphJustify Then
oSource.Paragraphs(i).Format.Alignment = wdAlignParagraphLeft
End If
Next i

End Sub

The StatusBar line is there to provide some visual feedback as the macro works its way through a file. Execution is not objectionably slow, but it's far from blazing fast. (Assigning the paragraph count to the variable j is done to keep things from slowing down even further by having to call oSource.Paragraphs.Count for each value of i.)

Cheers...
alexpgp: (Default)
In a bid to simplify my life, I called the interpretation client to ask about the pending gig, and was told that there was no news from the end client, and that if I had an opportunity to work at something else, to jump at it.

This makes my life just a bit easier to manage, and it may have had an effect on my perceived work load, as I proceeded to finish the rest of section 3 of The Horror in fairly straightforward fashion.

In related news, it turns out my tag copying and pasting macros has some objectively identifiable superiorities to the "placeable" navigation and copy feature in Wordfast. Copying a placeable via the established mechanism requires a minimum of 4 keystrokes (a two-key chord + an arrow key to select the first placeable + down arrow to copy it).

My macro requires Ctrl+8 to copy up to 20 tags, and Ctrl+9 to paste each one sequentially, which means I save at least 4 keystrokes for each tag past the first one in a cell. That may not sound like much, but my fingers are beginning to tell the difference.

Be that as it may and whatever I may do, my fingers will be taking a forced vacation tonight, as my charger has been left at home. Rats.

* * *
I found a great podcast from CanineCampus.com which seems to make more sense than most of the stuff I've heard/read so far (especially as concerns mouthing and nipping, which is my major complaint with Shiloh at the moment). The "zero tolerance" school that involves grabbing the puppy by the hair between the shoulder blades to mimic a canine mother's behavior just isn't working, and I've begun to suspect it's because Shiloh is still a puppy (i.e., along the same lines, you may as well expect a 18-month old human baby to be reading and writing).

Back to work.

Cheers...
alexpgp: (Default)
I was simply too tired last night to explain why the "- 1" was important in the macro line
myRange.End = myRangeEnd - 1
but not decrementing the value ate a lot of time, so hopefully, this post will reinforce the knowledge gained. (Can you tell I don't want to settle down and translate?)

By the time we get to this point in the code, we've selected the contents of the table cell we're working with and assigned them to a range called myRange. We've also saved the value of the end point in a variable called myRangeEnd.

If the pattern we're looking for is found, the next step after copying the pattern is to shorten the range to exclude the found pattern. To do this, I wrote code to move the start of the range over by the length of the pattern and then set the end of the range to the original end value.

Schematically, the initial range looks like:

it's time for {123}all{124} good men and women to party
S------------------------------------------------------E


After the first pattern is found, the range is:

it's time for {123}all{124} good men and women to party
              S----E


Then we move the start point "over" the end point:

it's time for {123}all{124} good men and women to party
                   S


And we restore the original end point:

it's time for {123}all{124} good men and women to party
                   S-----------------------------------E


Only after instrumenting the code to show my selection did I realize what that did. If you work much with Word tables, have you ever noticed what happens if you select text in a cell and go one character past the end? The contents of the entire cell become selected!

That's what was killing me yesterday: everytime the code was executed, the range being examined was being reset to the original range, and I couldn't figure out why.

Extending the end point to one character shy of "the end," i.e., like this:

it's time for {123}all{124} good men and women to party
                   S----------------------------------E


solved the problem. The next time the pattern is searched for, "{124}" will be found (even if it's at the end of the text).

Apropos of which, the macro works like a charm and actually makes it much easier to deal with the source text. It was a good investment in time.

Cheers...

UPDATE: Wordfast has this concept of a "placeable," which basically is any source text string that's not translatable, such as document designations (e.g., the '50578' in "SSP 50578"). It turns out - I find out by accident - that strings such as "{123}" are treated as placeables as well, and since Wordfast has hotkeys for navigating and copying placeables, it turns out my macro sort of reinvented the wheel. Still, I don't regret the time spent developing the code.

Profile

alexpgp: (Default)
alexpgp

July 2017

S M T W T F S
       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 272829
3031     

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 28th, 2017 08:39 am
Powered by Dreamwidth Studios