やっつけ仕事ですが、1390記事ぶんのデータを作成して、一気にインポート は無理があるのでデータは 10 記事づつに出力して、今日は100記事インポ ートしてテストしました。 ■ スクリプトの先頭に、1ログに格納する記事数を設定可能になっています ■ AUTHOR と登録カテゴリも設定可能です( ブログ側のデータを設定します ) 手順 1) フォルダを作成 2) maglog のバックアップファイルをフォルダ内に保存 3) このスクリプトをフォルダ内に保存 4) エクスプローラからスクリプトを実行 (注意)Twitter と連携してる場合は注意です。Twitter のツイートがえらい事になります
strAuthor = "night walker"
strCat = "maglog"
numSet = 10
Dim Fso,obj,strCurPath
' ファイルシステムオブジェクト
Set Fso = CreateObject( "Scripting.FileSystemObject" )
' 現在実行されているスクリプトのフルパス
strCurPath = WScript.ScriptFullName
' ファイルオブジェクトを作成
Set obj = Fso.GetFile( strCurPath )
' ファイルオブジェクトが存在するフォルダオブジェクト
Set obj = obj.ParentFolder
Set colFiles = obj.Files
For Each target In colFiles
aData = Split( target.Name, "." )
if UBound( aData ) = 1 then
if UCase( aData( 1 ) ) = "XML" then
targetFile = target.Name
Exit For
end if
end if
Next
' DOM Object 作成
Set dom = Wscript.CreateObject("Msxml2.DOMDocument")
' 既存 XML 入力
dom.load( targetFile )
Set nodeList = dom.getElementsByTagName("row")
fcnt = 0
fncnt = 0
For I = 0 to nodeList.length - 1
err_sw = 0
if fcnt Mod numSet = 0 then
if fcnt <> 0 then
logObj.Write( "" & vbLf )
logObj.Close()
end if
fcnt = fcnt + 1
fncnt = fncnt + 1
Set logObj = Fso.OpenTextFile( "convert" & Right("00000" & fncnt,5 ) & ".log", 2, True )
else
fcnt = fcnt + 1
end if
on error resume next
Set targetNode = nodeList.item(I).getElementsByTagName("title")
wk1 = Replace(targetNode(0).firstChild.nodeValue, " ", "" )
if Err.Number <> 0 then
err_sw = 1
end if
on error goto 0
on error resume next
Set targetNode = nodeList.item(I).getElementsByTagName("summary")
wk2 = targetNode(0).firstChild.nodeValue
if Err.Number <> 0 then
err_sw = 1
end if
on error goto 0
on error resume next
Set targetNode = nodeList.item(I).getElementsByTagName("contents")
wk2c = targetNode(0).firstChild.nodeValue
if Err.Number <> 0 then
wk2c = ""
end if
on error goto 0
on error resume next
Set targetNode = nodeList.item(I).getElementsByTagName("relese_dtime")
wk3 = targetNode(0).firstChild.nodeValue
if Err.Number <> 0 then
err_sw = 1
end if
on error goto 0
if err_sw = 0 then
logObj.Write( "AUTHOR: " & strAuthor & vbLf )
logObj.Write( "TITLE: " & wk1 & vbLf )
logObj.Write( "STATUS: Publish" & vbLf )
logObj.Write( "ALLOW COMMENTS: 0" & vbLf )
logObj.Write( "CONVERT BREAKS: 0" & vbLf )
logObj.Write( "ALLOW PINGS: 0" & vbLf )
logObj.Write( "PRIMARY CATEGORY:" & vbLf )
logObj.Write( "CATEGORY: " & strCat & vbLf )
aData = Split(wk3)
logObj.Write( "DATE: " & Replace(Right(aData(0),5),"-","/") & "/" & Left(aData(0),4) & " " & aData(1) & vbLf )
logObj.Write( "-----" & vbLf )
logObj.Write( "BODY:" & vbLf )
logObj.Write( wk2 & vbLf )
logObj.Write( "-----" & vbLf )
logObj.Write( "EXTENDED BODY:" & vbLf )
if wk2c <> "" then
logObj.Write( wk2c & vbLf )
else
logObj.Write( "" & vbLf )
end if
logObj.Write( "-----" & vbLf )
logObj.Write( "EXCERPT:" & vbLf )
logObj.Write( "" & vbLf )
logObj.Write( "-----" & vbLf )
logObj.Write( "KEYWORDS:" & vbLf )
logObj.Write( "" & vbLf )
logObj.Write( "-----" & vbLf )
logObj.Write( "--------" & vbLf )
end if
Next
logObj.Write( "" & vbLf )
logObj.Close()
|
|
【開発琴線の最新記事】
- CSS3 で時計作ってくれないかなぁ
- 4月から Windows8 の Metro スタイルのアプリを作って中身を調べています
- 「Twitter 日本マイクロソフト IE Team」から拾い読み
- WEBページをサムネイル化したり、PDF化したり、APIまであるこまめなサービス
- Safari for Windows 5.0.3 のいきなりな使い勝手( ちょっとびっくり )
- ベンジャミンさんの HTML5 サンプル : Canvascape "3D Walker"
- Google MAP API : ルート探索。太平洋をカヤックで横断する 6,243 km
- IE9 Beta の安全なお試し方法
- CodeIgniterというフレームワークとTwitter API CodeIgniter Libraryというもので簡単にTwitter投稿できるようなサービスが作れますが・・・
- どうもまだ XPモードを誤解している人が居るようなので
- Windows7 の仮想 PC にインストールされる XP の複製
- Windows7 : Virtual PC( 仮想PC ) と XP モード
- iモードHTMLシミュレータII
- Shadowbox.js 3.0b 使ってるページは IE6 や 7 では表示されない可能性があります
- 手書きブログの裏技
- うそ・・・まだMIFES ってあったんや
- 巨大はちゅねのスクリーンセーバーになります(笑)
- Papervision3D : マテリアルローダのプロトタイプ完成
- YouTube の謎の仕様
- 多少気にはなってたけれど、テストしたかったので、windows に拡張子 php を登録すると・・・




