Archive for August, 2018

h1

Some people’s words just make you smile

August 30, 2018

I got this delightful email from a reader in the UK—I like the way she writes :-)

I’ve only just discovered your lovely, informative WordPress blog, courtesy of an extremely boring temp job where I thankfully and gleefully had internet access. I might not have made it through those days without you. I love the techy stuff anyway, but I was like a dog with two tails when I discovered the ‘freewheeling through the ribbon with the mouse scroll’, and the ‘shakey shakey’ technique to drop the other windows. Strangers who passed me in the street on the way home now know of these two joys.

Glad I could help, Tessa!

h1

Word: Extract file names of images

August 30, 2018

In my post yesterday, I showed three ways of extracting file name information if it was entered in the Alt Text properties of the image. However, file names/file paths don’t automatically populate the Alt Text description field, except under some circumstances. In my testing:

  • if I dragged a saved image from Windows Explorer into Word 2010, the file path and name was added to the Alt Text description field automatically (NOTE: Dragging from Explorer did NOT add the file path/name information in Word 2016 [and possibly in Word 2013]! It seems Microsoft changed this function after Word 2010 for at least one of these reasons: large corporate clients didn’t want file paths visible to readers with the knowledge to find out what they were, or, putting the file path in Alt Text actually went against accessibility guidelines, because a screen reader would read the file path NOT a considered description of what the image was about.)
  • if I dragged a saved image from SnagIt Editor, the file path and name was added to the Alt Text description field automatically
  • if I clicked Insert > Picture in Word, selected an image, then clicked Insert, none of the file information was carried across
  • if I clicked Insert > Picture in Word, selected an image, then clicked the drop-down arrow next to Insert and then selected Insert and Link, the file path/name information is stored in Word, but NOT under Alt Text—you can only find it by going to File > Info, then clicking Edit Links to Files (bottom right of that Info window), then scrolling through the list of links to find those for images. Click the item in the list and the file path/name is displayed in the Source information section. You can’t select it to copy it.

An alternative way to find these file names (whether detailed in Alt Text or not) is to save the Word document as an XML file, then open the XML file in an HTML editing program (you can use a program like Notepad, but you have to find them one at a time for each image file extension [e.g. .gif, .jpg, .jpeg, .png, .emf, .svg, .bmp, .tif, .tiff, etc.]). Ignore any found with paths/names like /media/image1.png etc. as these are the automatically created image files when you saved as XML—they are not the original final names. When you find a legitimate file path/name, copy it to another document. Yes, this is tedious, and there is a marginally quicker way if you have an HTML editing program installed and have a lot of image file names to deal with.

NOTE: You will never get the file name/path for anything inserted using Insert > Picture without linking.

I had Microsoft Expression Web installed on my computer so I used that—it allows you to search for all instances of a term (in my case, a file extension) and lists them in a Results pane. From there, you select them all, then copy the list and paste it into Excel. Once in Excel, you can delete the columns you don’t need and do find/replace to clean up the XML coding you don’t want. Hopefully, you’ll get enough file names to make this a worthwhile exercise.

Here are the steps I used with Expression Web:

  1. Open a new Excel document.
  2. Open the Word document, then save it as an XML file (File > Save As, select Word XML document (*.xml) as the file type). Close the Word document.
  3. Go to (Windows) Explorer, right-click on the XML file you saved in Step 2, then choose the program to open it—in my case, I opened it with Microsoft Expression Web 2.0, and the rest of these instructions are for that program.
  4. Go to Edit > Find, then enter the search term for an image format file extension (the most common ones are .gif, .jpg, .jpeg, .png, .emf, .svg, .bmp, .tif, and .tiff). You can make this quicker by entering .jp to find both jpg and jpeg formats, or .ti to find both .tif and .tiff formats.
  5. Click Find All.
  6. The Results list below the main window shows all lines where the search term was found. Click in the Results list, then press Ctrl+a to select all results.
  7. Right-click on the selected results, then choose Copy Results (Note: Ctrl+c will NOT copy them).
  8. Go to your blank Excel document, and paste the copied results into Excel.
  9. Repeat Steps 4 to 8 for all the other image file formats.
  10. When you have finished finding them all and putting them into the Excel document, save the Excel file.
  11. Now it’s time to clean up the Excel file:
    • delete any columns you don’t need (I only needed the Matched Text column, so I deleted the others)
    • delete any rows you don’t need (those with /word/media/image1.png or /media/image1.png in them—these are the auto generated file names created when you save the Word document as XML)
    • delete any duplicates
    • if you see patterns in the XML code, do several find/replace runs on the file to get rid of the unwanted XML code (e.g. find <wp:cNvGraphicFramePr><a:graphicFrameLocks noChangeAspect=”1″… and replace with nothing)
    • manually delete any remaining XML code that you can’t delete easily with find/replace
  12. Once you’ve cleaned it up, your Excel file should list all the found file paths/names. Sort the list alphabetically so you can identify and delete any further duplicates. (Note: Some images may be listed twice — just the file name and another with the full file path.)

[Links last checked August 2018]

h1

Word: Extract Alt Text from images

August 29, 2018

Mary, one of this blog’s regular readers and donors, emailed me with a problem:

I want to manage all the image files in my Word 2007 docs and RoboHelp online help projects. Many times the image from the Word doc is used in the online help. Also an image can be used in more than one doc. So when an image is edited/updated it would be useful to know where it has been used. For that I need to know the image file name. Is there any way to find the original file name of the image? I know the ‘trick’ of saving as a web page to produce a media folder but the images are (unhelpfully) renamed as 1, 2, 3 and so on.

Hmmm… A curly one, for sure. Like Mary, I’d found that the images saved when you save to XML or HTML were unhelpfully named. I even checked the image properties to find if any of the information about the original image is preserved in the ‘save as’ file—it isn’t. So I went back to my test document in Word to look at the image properties and discovered something I hadn’t noticed before. In my test document, there was an Alt Text description for some of the images, AND, helpfully, that description often included the file name and sometimes the full file path on the network (see the follow-up post to this one for information on the method to use to always get the file name/path added automatically to the Alt Text description). This was a big bonus! Knowing that this information is stored with the image in the Word document means there has to be a way to extract it, right?

Well, yes there is, but all extraction methods below assume that the images have an Alt Text description associated with them. If you don’t have any Alt Text, there’s nothing to extract. For new documents, I would suggest that you start adding Alt Text to your images from now on (good practice for accessibility reasons anyway), and if you ever need the name of the original file, put that in the Alt Text description (along with the file path, if that’s unlikely to change). You can do this manually, or, if you use the right method, Word can add it automatically for you. For older documents, you’d have to find the original file and then add the Alt Text—this might not be practical, especially if you have a lot of documents with a lot of images. For information on how to add Alt Text, see: https://www.itsupportguides.com/knowledge-base/office-2016/word-2016-how-to-add-alt-text-to-images/

Now as to the solutions I looked at and that worked, from low tech to high tech. These solutions range from manually finding the Alt Text description (in the HTML file), to running a macro to display the Alt Text in a message box for each image, to running a macro that extracts all the Alt Text from a selected file and puts it into a new Word document. Choose the one that most suits your purposes.

I must thank John SR Wilson and Jay Freedman whose generosity in helping those on the Microsoft forums is amazing. I used their macros (with very minor adaptations) to achieve what Mary wanted.

Find the Alt Text description in the HTML file

Use this method if you only have a few images with Alt Text.

  1. Open the Word document.
  2. Save as an HTML file.
  3. Open the saved HTML file in a text editor (e.g. NotePad).
  4. Search for alt=.
  5. If the alt= information is a file name/path, copy that into another document so you have a list of them.

Macro to display the Alt Text for each image

This macro from John SR Wilson runs through your document and pops up a message box for each image it finds. The message box displays the Alt Text if there is any, otherwise it tells you that no Alt Text was found for that image. Keep clicking OK until the end (you can’t cancel). NOTE: The code runs off the screen, so copy/paste all lines—don’t try to type them out.

Sub getAltText()
'
' getAltText Macro
' Identifies if Alt Text is associated with an image or not. If so, displays the Alt Text; if not, says No Alt Text
' from: John SR Wilson, at https://answers.microsoft.com/en-us/office/forum/office_2010-customize/how-do-i-access-alt-text-for-pictures-with-vba/b3d196a6-b31f-4f28-90bb-be4f7e73958c?db=5

Dim oshp As InlineShape
For Each oshp In ActiveDocument.InlineShapes
oshp.Select
If oshp.AlternativeText <> "" Then
MsgBox "Alt Text is " & oshp.AlternativeText
Else
MsgBox "No Alt Text"
End If
Next

End Sub

Macro to extract the Alt Text from each image and put it into a separate document

This macro from Jay Freedman first asks you to select the file you want to run the macro on (it doesn’t have to be the currently open file), then a few seconds later, it asks where you want to save the new document containing all the Alt Text. NOTE: The code runs off the screen, so copy/paste all lines—don’t try to type them out.

Sub ExportAltText()
' Exports all Alt Text for inline images in a selected document into a separate file, ready for translation
' From Jay Freedman, at https://answers.microsoft.com/en-us/office/forum/office_2007-word/need-word-macro-to-export-and-import-alt-text/af9d12fc-8eab-4343-a25d-f086ae7d73b3

    Dim strPictures As String
    Dim docPictures As Document
    Dim docTranslate As Document
    Dim objInlinePic As InlineShape
    Dim objFloatPic As Shape
    Dim tblTranslate1 As Table
    Dim tblTranslate2 As Table
    Dim tblLoop As Table
    Dim rowCurrent As Row
    Dim oRg As Range

    MsgBox "In the next dialog, select the file containing " & _
        "the pictures whose alt text will be translated."
    strPictures = GetFileName()
    If strPictures = "" Then Exit Sub

    On Error GoTo BadInputFile
    Set docPictures = Documents.Open(FileName:=strPictures)

    Set docTranslate = Documents.Add
    With docTranslate
        ' set up header and footer in translation document
        .Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = _
            "Alt Text of " & docPictures.FullName
        Set oRg = .Sections(1).Footers(wdHeaderFooterPrimary).Range
        oRg.Text = vbTab
        oRg.Collapse wdCollapseEnd
        .Fields.Add Range:=oRg, Type:=wdFieldPage, PreserveFormatting:=False

        ' create two 2x2 tables
        Set tblTranslate1 = .Tables.Add(Range:=.Range, numrows:=2, numcolumns:=2)


        Set oRg = .Range
        oRg.InsertParagraphAfter
        Set oRg = .Range
        oRg.Collapse wdCollapseEnd

        Set tblTranslate2 = .Tables.Add(Range:=oRg, numrows:=2, numcolumns:=2)

        ' put the docPictures path & filename in a document variable
        ' so the import macro can locate it
        .Variables("docPictures").Value = docPictures.FullName
    End With

    ' put a heading row in the table and set borders
    For Each tblLoop In docTranslate.Tables
        With tblLoop
            .Cell(1, 1).Range.Text = "Original Alt Text"
            .Cell(1, 2).Range.Text = "Translated Alt Text"
            .Rows(1).Range.Font.Bold = True
            .Rows(1).HeadingFormat = True
            .Borders.InsideColor = wdColorAutomatic
            .Borders.InsideLineStyle = wdLineStyleSingle
            .Borders.OutsideColor = wdColorAutomatic
            .Borders.OutsideLineStyle = wdLineStyleSingle
        End With
    Next tblLoop

    ' put the alt text of each inline picture into the first column of the table's
    ' last row, and add a new empty row below it
    On Error Resume Next
    For Each objInlinePic In docPictures.InlineShapes
        If objInlinePic.AlternativeText <> "" Then
            tblTranslate1.Rows.Last.Cells(1).Range.Text = objInlinePic.AlternativeText
            If Err.Number <> 0 Then
                MsgBox "Error " & Err.Number & vbCr & Err.Description
                Err.Clear
            End If
            tblTranslate1.Rows.Add
        End If
    Next objInlinePic
    tblTranslate1.Rows.Last.Delete

    ' put the alt text of each floating picture into the first column of the table's
    ' last row, and add a new empty row below it
    On Error Resume Next
    For Each objFloatPic In docPictures.Shapes
        If objFloatPic.AlternativeText <> "" Then
            tblTranslate2.Rows.Last.Cells(1).Range.Text = objFloatPic.AlternativeText
            If Err.Number <> 0 Then
                MsgBox "Error " & Err.Number & vbCr & Err.Description
                Err.Clear
            End If
            tblTranslate2.Rows.Add
        End If
    Next objFloatPic
    tblTranslate2.Rows.Last.Delete

    docPictures.Close wdDoNotSaveChanges
    docTranslate.Save

    Exit Sub

BadInputFile:
    MsgBox "The file " & strPictures & " could not be opened." & _
        vbCr & "Error " & Err.Number & vbCr & Err.Description
End Sub

Function GetFileName() As String
    Dim dlg As FileDialog

    Set dlg = Application.FileDialog(msoFileDialogFilePicker)
    If dlg.Show <> -1 Then
        GetFileName = ""
    Else
        GetFileName = dlg.SelectedItems(1)
    End If
End Function

[Links last checked August 2018]

 

h1

EditorsWA Winter Seminar, August 2018

August 28, 2018

On 25 August 2018, I attended and spoke at the annual Winter Seminar, held by EditorsWA, the Western Australian branch of IPEd, the national professional association for editors.

Here are my notes from two of the three sessions; the third session (on efficiency) was mine, so there are no notes for it.

Conflict of interest (Vanessa Herbert)

This was an interesting and thought-provoking session. Vanessa started by explaining what conflict of interest means, and that it can be actual, perceived, or potential. She then spent a bit of time discussing IPEd’s Code of Ethics and Code of Conduct members must abide by, and the Conflict of Interest Declaration that IPEd councillors, committee members, contractors or volunteers must sign.

But the most revealing part of the session was when we worked in small groups, discussing the three potential conflict of interest scenarios she posed for us. The biggest takeaway is that what initially appeared to be black and white, may not be, and that many shades of grey exist between those black and white stances. The group I was in found all sorts of fuzziness around the edges, making it difficult to come to a firm answer. Vanessa had made us aware of using false justifications, and that was the hardest part to reconcile.

As I said, thought-provoking. The bottom line is to be open and transparent in all dealings.

Scientific writing (David Lindsay)

Some notes I took during David’s session:

  • The theme of all good scientific stories:
    • how and why does it fit (or not) with other scientists’ work
    • how and where does it fit into the ‘real world’
    • what does it mean for science and the real world.
  • The primary aim of a scientific article is to be read by as many people as possible, and for those readers to be influenced by it.
  • These days, the influence of an individual article is measured by the number of citations it gets (i.e. citation indexes), and the influence of a scientific journal is measured by its ‘impact factor’ (i.e. number of articles from that journal cited in the past xx years). Many articles are never cited and many journals have an impact factor <1.
  • The secret of telling a scientific story is based on the principle of expectation:
    • Readers should have some idea of what to expect from the article (informative and interesting title, familiar structure, sections that deliver what’s expected [e.g. scientific method] and build expectation for what’s coming in the next section, writing style that is clear, concise, and brief [avoid being ‘impressive’, otherwise you’ll alienate readers]).
    • The hypothesis is just a prediction of what the scientist expected, and the rest of the article shows evidence to support or reject that hypothesis.
  • The scientific story has these parts:
    • title (must be interesting and informative to attract the reader)
    • introduction (two parts only—the hypothesis, and the reasoning that makes that hypothesis the most plausible explanation)
    • methodology and materials
    • results (prioritise—some are much more important than others, so spend more time and space on these; include those that relate to the hypothesis and those that don’t)
    • discussion (again, prioritise the arguments that support/refute the hypothesis; consequences for others and possibly the ‘real world’; discard anything that just adds fluff and doesn’t help tell the story)
    • references
  • Characteristics of good scientific writing—precise, clear, brief.
  • Every paragraph must have a conclusion and a way to lead into the next paragraph. Every sentence must follow on from the previous sentence.
h1

Microsoft hell with personal and business accounts

August 21, 2018

I’ve been going through Microsoft’s version of hell with changes to their Partners services. That’s a long story for another time, but in the several hours spent going in endless loops on their website, in an online chat with a support person, on a call that kept breaking up, and finally in a couple of calls and emails with a woman who actually knew what she was talking about and was able to explain it to me, I came across this article: http://www.brucebnews.com/2016/06/finding-your-way-through-microsofts-maze-of-work-and-personal-accounts/

I think it’s required reading for anyone with one or more Microsoft accounts. It certainly helped clarify some things for me.

[Link last checked August 2018]

h1

Word: Selected text won’t move

August 15, 2018

Here’s one I’ve encountered every so often, but have never figured out why—sometimes when I select a piece of text in a Word document, then try to drag it to another location (e.g. a different table cell; elsewhere in the paragraph), I can’t do it. Instead, I see a small black circle with a black diagonal line through it and the selected text won’t go where I want it to go. I have to copy the text, then paste it at the new location, instead of dragging and dropping it. It doesn’t happen every time, which of course it what makes it hard to figure out the cause.

I’ve now found out why, courtesy of one of my global colleagues on a Facebook group for editors—the reason it won’t drag to the new location is because the Cross Reference window is open! If you close that window, you can move the selected text. (Note: Other windows that can remain open while you’re working on a document may also result in this behaviour—I haven’t tested those.)

This situation is unlikely to happen to most Word users, because most have no use for cross-referencing. But power users and those working in large documents with lots of cross references may like to know that an open Cross Reference window is the reason you can’t move selected text.

h1

Word: The things you learn – scroll tabs on the ribbon

August 14, 2018

Just when I thought there wasn’t much new to learn about the Word for Office for Windows interface… (NOTE: I tested this technique in Word, Outlook, PowerPoint, and Excel, and it works the same in all of them, so it must be a Microsoft Office thing.)

Over on an editors’ Facebook group today, one of the members posted a trick that was new to her—it’s new to me too, but may well have been in Office for Windows ever since the ribbon interface came in with Office 2007.

That trick is quickly moving between tabs on the ribbon by hovering over one tab, then rolling the scroll wheel of your mouse. It’s another way to minimise wrist movements using a mouse.

Whether you go left to right through the tabs, or vice versa, depends on which way you roll the scroll wheel—roll it towards you and you go from left to right; roll it forward and you go from right to left. You can only roll to the first or last tab; further rolling doesn’t ‘wrap’ around the tabs.