2016/6/7

How to highlight all acronyms in Microsoft Word?

Hit Ctrl-F to bring up a find box, and type this in exactly as written:

<[A-Z]{2,}>

Hit the "More >>" button, then check the "Use Wildcards" box. Finally, click the "Reading Highlight" box, then click "Highlight All". 

2016/6/6

AKB48 - チャンスの順番

チャンスの順番じゅんばん 次つぎは君きみに来くる
どんなに負まけてても 今度こんどは勝かちに行いこう
あきらめなければ 夢ゆめは叶かなうんだ
ずっと 頑張がんばって来きた
君きみの努力どりょく 報むくわれるように…空そらを流ながれる白しろい雲くもたちの
どれが速はやいかなんて 意味いみがないと思おもう
昨日きのうの君きみが出遅でおくれていても
そのうち 風かぜの向むきも変かわり始はじめる
自分じぶんには何なにが足たりないのだろう
一いち人にん 悩なやんだ時ときもあった
だけど 立たち止どまっていてもしょうがない
じゃんけんみたいに 運うんは巡めぐるもの
今いままでついてなかった 今度こんどは君きみの番ばんだ
くじけちゃいけない 泣ないてちゃいけない
長ながい冬ふゆの後のちには
君きみの春はるがすぐそこに来きてる

まわりの友ともは 一いち人にん また一いち人にん
夢ゆめに続つづく階段かいだん 上のぼって行いったよ
たとえビリでも焦こげることないさ
どこかで風かぜが吹ふいたら追おいつき追おい越こせる
途中とちゅうで誰だれかと比くらべるよりも
未来みらいの自分じぶん 信しんじるんだ
君きみのペースでゴールまで走はしり抜ぬけろ!夢ゆめの方ほうからは そっぽ向むかないよ
勝手かってにこっちから背せを向むけてしまうもの
何なにがあったって その手て 伸のばすんだ
運うんはがむしゃらの味方みかた
君きみにできる すべてのことをやれ!チャンスの順番じゅんばん いつかきっと来くる
まだ先さきのようでも確たしかに近ちかづいてる
声こえが掛かかるまで 光ひかり当あたるまで
君きみは今いままで以上いじょうに
どんな時ときも輝かがやいていよう

2016/6/4

How to count words in a PDF file with JavaScript?

Paste the follow code in JavaScript Console of Adobe Acrobat, highlight the code and then press Ctrl + Enter.

var cnt=0;
for (var p = 0; p < this.numPages; p++) cnt += getPageNumWords(p);
//console.println("There are " + cnt + " words in this file.");
app.alert("There are " + cnt + " words in this file.");

2016/6/3

How to create a list of acronyms in Microsoft Word with Macro?

Sub ListAcronyms()
    Dim strAcronym As String
    Dim strDefine As String
    Dim strOutput As String
    Dim newDoc As Document

    Application.ScreenUpdating = False
    Selection.HomeKey Unit:=wdStory
    ActiveWindow.View.ShowHiddenText = False

   'Loop to find all acronyms
    Do
        'Search for acronyms using wildcards
        Selection.Find.ClearFormatting
        With Selection.Find
            .ClearFormatting
            .Text = "<[A-Z]@[A-Z]>"
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindStop
            .Format = False
            .MatchCase = True
            .MatchWildcards = True
            .MatchWholeWord = True
            .Execute
        End With

        'Only process if something found
        If Selection.Find.Found Then
            'Make a string from the selection, add it to the
            'output string
            strAcronym = Selection.Text

            'Look for definition
            Selection.MoveRight Unit:=wdWord
            Selection.MoveRight Unit:=wdCharacter, _
              Extend:=wdExtend
            strDefine = ""
            If Selection.Text = "(" Then
                While Selection <> ")"
                    strDefine = strDefine & Selection.Text
                    Selection.Collapse Direction:=wdCollapseEnd
                    Selection.MoveRight Unit:=wdCharacter, _
                      Extend:=wdExtend
                Wend
            End If
            Selection.Collapse Direction:=wdCollapseEnd
            If Left(strDefine, 1) = "(" Then
                strDefine = Mid(strDefine, 2, Len(strDefine))
            End If
            If strDefine > "" Then
                'Check if the search result is in the Output string
                'if it is, ignore the search result
                If InStr(strOutput, strAcronym) = 0 Then
                    strOutput = strOutput & strAcronym _
                      & vbTab & strDefine & vbCr
                End If
            End If
        End If
    Loop Until Not Selection.Find.Found

    'Create new document and change active document
    Set newDoc = Documents.Add

    'Insert the text
    Selection.TypeText Text:=strOutput

    'Sort it
    newDoc.Content.Sort SortOrder:=wdSortOrderAscending
    Application.ScreenUpdating = True
    Selection.HomeKey Unit:=wdStory
End Sub