2008/03/20

Vistaガジェットに「付箋」というのがありますが、その内容をテキストに書き出すスクリプトをWSHで書いてみました。(22:55 WshNetworkを使ってAddDataパスを取得していたのをShell.Application経由で取得に変更)

'sTextFolderにVistaガジェット付箋をページごとに0.txt, 1.txt...のように保存していく
sTextFolder = "D:\document\Advanced_es の文書\" 'テキストファイル保存フォルダ
Set Fs = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
Const CSIDL_LOCAL_APPDATA  = &H1C
Set tsIni = Fs.OpenTextFile(Fs.BuildPath(objShell.NameSpace(CSIDL_LOCAL_APPDATA).Self.Path, _
            "\Microsoft\Windows Sidebar\Settings.ini"),,,True)
Set regEx = New RegExp
regEx.Global = True
bCNotesSection = False
Do Until tsIni.AtEndOfStream
    sLine = tsIni.ReadLine()
    If InStr(sLine,"CNotes.Gadget") Then
        bCNotesSection = True
    End If
    If bCNotesSection And InStr(sLine,"[") Then
        bCNotesSection = False
    End If
    If bCNotesSection Then
        regEx.Pattern = "(\d+)\=""(.+)"""
        If regEx.Test(sLine) Then
            For Each oMatch In regEx.Execute(sLine)
                Set oSubs = oMatch.SubMatches
                Fs.CreateTextFile(sTextFolder & oSubs(0) & ".txt").Write unescape(oSubs(1))
            Next
        End If
    End If
Loop
tsIni.Close

私はこのスクリプトをタスクスケジューラで5分間隔で動かしています。Advanced esというスマートフォンを使ってますが、これにViewTextというTodayプラグインを使うとテキストファイルがTodayに表示できるので、同期センターを使うと付箋の内容を同期できるわけです。

元記事:http://blogs.wankuma.com/mutaguchi/archive/2008/03/20/128772.aspx

古い記事へ | 新しい記事へ


プライバシーポリシー

Twitter

Books