A Comma Alert and an OpenOffice Macro

Printer-friendly version

Author: 

Taxonomy upgrade extras: 

"That's a job well done, Susie."

"What have you been fiddling away with, hunched over like that, Jeffrey?"

"I finally managed to force myself to reread our first nine chapters, and I've inserted a multitude of missing commas."

"Come again."

"That's right - our comma count has increased from 1,553 to 2,216."

"Sometimes, Jeffrey, I worry about your pernickety attention to detail."

"I didn't tot them up by hand, Susie."

"I wouldn't be surprised if you had. But if you'd time to spare, you shouldn't have wasted it on tiddly little commas nobody notices. You should have given me some extra funnies."

"I also made a few minor edits to smooth things out and indicate scene changes. And I did slip in a Susieism or two while I was at it."

"I hope they're sympathetic ones, Jeffrey. With that unflattering Shambleau reference right at the start, folk may have got the wrong impression of my character."

"Nobody caught on, and the story quickly took a different path."

"Only thanks to my sunny nature, Jeffrey."

"I soon recognised it, Susie, and I unselfishly gave you the punch line at the end of our first posting."

"I certainly deserved it after what I went through setting up the situation."

"And that's why I thought you merited the best punctuation available."

"There's more to this than meets the eye, Jeffrey. You can't fool me; this blog is a none too subtle attempt to entice a few more readers our way."

"If the prospect of perusing all those freshly minted commas doesn't hook people, Susie, I don't know what will."

"It'd be better if you weren't so blatant about it, Jeffrey. Try and catch those uninterested in us off guard. Sneak the plug in under the guise of something else."

"Like what?"

"Well, has anything unusual happened to you lately?"

"No."

"Have you a fashion tip to offer?"

"No - have you a recipe to share?"

"Definitely not."

"I suppose I could set a few brain-teasers."

"No, Jeffrey - we have to make it something useful."

"Let's see … Saving a time-stamped copy of a file in multiple locations would be a boon to creative authors who fear losing the fruits of their labours. And they can do it at the click of a button with my carefully crafted Open\LibreOffice Basic macro."

"Show-off!"

"Okay - here it is."

*  *  *  *  *  *  *

Go to Tools - Macros - Organise Macros - LibreOffice Basic... Enter MySave in the Macro name box, click New, and paste (by clicking on Edit) the following code between Sub MySave and End Sub. The macro will then be in My Macros - Standard - Module1.

*  *  *  *  *  *  *

Dim document as object
Dim documentName as String
Dim newURL as String
Dim NameAndPath as String
Dim backupPath(10) as String
Dim timeStamp as String
Dim i as Long
Dim j as Long
Dim dargs(0) as new com.sun.star.beans.PropertyValue

dargs(0).Name = "FilterName"
dargs(0).Value = "Writer8"

document = ThisComponent

backupPath(0) = "C:\Users\Anon\Documents\"
backupPath(1) = "D:\"
backupPath(2) = "F:\"
backupPath(3) = "G:\"

NameAndPath = ConvertFromURL(document.getLocation())

For i = Len(NameAndPath) To 1 Step -1
 If Mid(NameAndPath, i, 1) = "." Then
  If i - 17 > 0 Then
   If Mid(NameAndPath, i - 17, 3) = "_20" Then
    i = i - 17
   End If
  End If
  For j = i - 1 to 1 Step -1
   If Mid(NameAndPath, j, 1) = "\" Then
    documentName = Mid(NameAndPath, j + 1, i - j - 1)
    j = 0
    i = 0
   End If
  Next j
 End If
Next i

timeStamp = "_" & Format(Year(Now), "0000") & "-" & _
Format(Month(Now), "00") & "-" & _
Format(Day(Now),"00") & "_" & _
Format(Hour(Now), "00") & "-" & _
Format(Minute(Now), "00")

i = 0
While backupPath(i) <> ""
newURL = ConvertToURL(backupPath(i) & documentName & timeStamp & ".odt")
document.storeToUrl(newURL, dargs())
i = i + 1
Wend

*  *  *  *  *  *  *

Notes:

1. You'll have to change the backupPaths strings locations to suit your computer.

2. If using Linux change all occurrences of \ to /.

3.If you want to save in a different format, substitute for -

"Writer8"                   ".odt"

One of the following pairs -

"Text"                         ".txt"

"MS Word 2007"       ".docx"

"Rich Text Format"   ".rtf"

"MS Word 97"            ".doc"

4. Before running the macro for the first time, save the document as usual so that it has a name.

5. For convenience, assign the macro a button on a toolbar. Right click the toolbar and then click Customise... Click Add... and then in the Category box find LibreOffice Macros, expand My Macros to Module1, click it and then select MySave in the command box and follow the instructions. Back in Customise click Modify and Change Icon if you want to select an icon.

*  *  *  *  *  *  *

"Finished already, Jeffrey - that was quick."

"It's a lot easier than funny dialogue, Susie, and you can test the thing to see if it works as it should."

"Right, Jeffrey, with that done and our commas all present and correct, head down and apply yourself to our latest tale while I swot up on my driving test theory. Only another 49 weeks, 1 day, 3 hours, 27 minutes  an 11 seconds to go."

"You'll never get a car, Susie - your longing for it has become just another comic device."

"Not to me, it hasn't."

"Well, it makes no difference because we're destined to be forever sixteen."

"Oh, bugger!"

"And have endless adventures together, like true comic book heroes."

"Okay, Jeffrey, I can live with that. But when we escape from being kidnapped in mistake for Alice and Amy, make sure I'm behind the wheel."

"The world will be your Reliant Robin, Susie."

*  *  *  *  *  *  *

"Here's some breaking news, Susie - they've found 200 trillion cubic feet of gas, right under our feet, on the Fylde coast."

"Gee, Jeffrey, we'll have to be careful we don't blow up the whole county."

Comments

Blowing up Blackpool!

Angharad's picture

That woulda Fylde a few pages.

Angharad

PS Poor old Nicole could only manage 4th, better luck Cav, tomorrow.

Angharad

Commas are like capitals

Puntuation has meening and give direction. Captitals also. I was helping my Uncle Jack off a horse.
I was helping my uncle jack off a horse.
Good editing is hard work. It seems that many writers think faster than they type and many editors see what they want instead of read what is there.

I give Kudos to ALL who write and edit. Not just because I stink at both but because it is hard work.
Keep the commas comming

James

But!

Which one did you mean?

LoL
Rita

Age is an issue of mind over matter.
If you don't mind, it doesn't matter!
(Mark Twain)

LoL
Rita

No commant.

And that's all I don't have to say.

Bev.

bev_1.jpg

Show-off!

Show-off!

I thought, maybe, it would be, a macro, to add, commas, like?

Kris

{I leave a trail of Kudos as I browse the site. Be careful where you step!}

Kris

{I leave a trail of Kudos as I browse the site. Be careful where you step!}

Pretty sure it's both.

Or, more accurately, it's a blog, about edits to a story and an openoffice macro, written as dialogue between the main characters of the story that received the edits. As a dialogue between characters rather than plainly written English direct from the author, it's probably capable of being classed as an extremely short story.

Abigail Drew.

So Comma-cal

joannebarbarella's picture

Look Out! Dangerous blog comma-long,

Joanne

Despite the lack of a link

LibraryGeek's picture

Despite the lack of a link to the stories, an influx of new readers has been detected. Mission accomplished.

Yours,

JohnBobMead

Yours,

John Robert Mead