' cocoWrite
userId = ""
userPass = ""
Set Ie = WScript.CreateObject("InternetExplorer.Application")
Set objADO = CreateObject("ADODB.Connection")
objADO.Open "dsn=smartmemo3;uid="
strSqlStmt = "select " & _
"search_key_phrase " & _
"from ACCESS_TRACKER " & _
"where to_char(search_date,'YYYYMMDD') like to_char(current_timestamp -'1 day'::interval,'YYYYMMDD') " & _
"order by search_date"
'objADO.Options = dbSQLPassThrough
Set objADORS = objADO.Execute(strSqlStmt)
' いったんログアウト
targetUrl = "https://app.cocolog-nifty.com/t/app?__mode=logout"
Ie.Navigate targetUrl
Do While IE.Busy Or IE.ReadyState<>4
WScript.Sleep 100
Loop
targetUrl = "https://app.cocolog-nifty.com/t/app"
Ie.Navigate targetUrl
Do While IE.Busy Or IE.ReadyState<>4
WScript.Sleep 100
Loop
Set document=IE.document
'For Each item In document.forms(0).elements
' WScript.Echo item.type & "[" & item.value & "]"
'Next
document.forms(0).username.value = userId
document.forms(0).elements(1).value = userPass
'WScript.Echo document.forms(0).elements(0).type & "[" & document.forms(0).elements(0).value & "]"
'WScript.Echo document.forms(0).elements(1).type & "[" & document.forms(0).elements(1).value & "]"
' タイプの設定
'Set radios = document.All.Item("type")
'radios(1).checked = true
'For Each item In document.all
' If item.tagName = "HTML" Then
' 'WScript.Echo item.innerText
' WScript.Echo item.innerHTML
' End If
'Next
document.forms(0).submit()
Do While IE.Busy Or IE.ReadyState<>4
WScript.Sleep 100
Loop
'Set document=IE.document
'For Each item In document.all
' If item.tagName = "HTML" Then
' 'WScript.Echo item.innerText
' WScript.Echo item.innerHTML
' End If
'Next
' 新規投稿画面
targetUrl = "https://app.cocolog-nifty.com/t/app/weblog/post?blog_id="
Ie.Navigate targetUrl
Do While IE.Busy Or IE.ReadyState<>4
WScript.Sleep 100
Loop
For Each item In document.forms(1).elements
WScript.Echo item.type & "[" & item.value & "]@" & item.name
Next
Set document=IE.document
' タイトルの設定
document.forms(1).title.value="昨日の検索ワード"
' 日記・コラム・つぶやき 255269
document.forms(1).category_id.value=255269
' 本文
' 集計結果表示
buf = ""
Do While Not objADORS.EOF
For i = 0 to objADORS.Fields.Count -1
buf = buf & objADORS(i) & vbTab
Next
buf=buf & "
"
objADORS.MoveNext
Loop
document.forms(1).text.value=buf
' 保存ボタンをクリック
Set targetBtn = document.forms(1).elements(16)
targetBtn.Click()
Do While IE.Busy Or IE.ReadyState<>4
WScript.Sleep 100
Loop
Set document=IE.document
For Each item In document.all
If item.tagName = "HTML" Then
'WScript.Echo item.innerText
WScript.Echo item.innerHTML
End If
Next
WScript.Sleep 1000
With CreateObject("ScriptControl")
.Language = "JScript"
With .CodeObject
On Error Resume Next
strSearch = .doRedirect()
End With
End With
Do While IE.Busy Or IE.ReadyState<>4
WScript.Sleep 100
Loop
Set document=IE.document
For Each item In document.all
If item.tagName = "HTML" Then
'WScript.Echo item.innerText
WScript.Echo item.innerHTML
End If
Next
objADORS.Close
Set objADORS = Nothing
' mdbコネクションを切断
objADO.Close
Set objADO = Nothing