ここから本文です
  • 110,969

ビギナーズ投稿練習トピック

2013/04/12 17:59 更新

  • cj
    ユーザーメニュー
    VBAコードの投稿テスト

    返信数

    0

    No.110909

    2013/03/31 09:12

    0
    3

    Option Explicit
    ' 参照設定
    ' Microsoft InternetControls
    ' Microsoft HTML Object Library
    ' Microsoft VBScript Regular Expressions 5.5
    Private Declare Sub Sleep Lib "KERNEL32.dll" (ByVal dwMilliseconds As Long)
    Const SU = "http://textream.yahoo.co.jp/message/"
    Const SU1 = SU & "1834634/bgbd02bda5qa5bda53a5sa4o"
    Const SU2 = SU & "1834634/bgbd02bda5qa5bda53a5sa4oa1aa32"
    Const SU6 = SU & "2000335/c0beita5qa5bda53a5sa5afa5ia5va1a12bc4xa1a1a4bda4nobba1a1"
    Const SLIST = "〓winsuki2007〓wat*****〓kei2300jp〓" ' 追加可。両端は区切り文字。
    Const SDLM = "〓" ' SLIST の区切り文字
    Const SPTN = "userName[^>]*>([^<]+)<"

    Sub ポチッ() ' 簡易簡略版
    Dim arrU()
    Dim vU
    Dim oIe As InternetExplorer
    Dim oE As HTMLDTElement
    Dim oRe As RegExp
    Dim oM As Match
    Dim sIH As String
    Dim cn As Long
    Dim arrF(0 To 19) As Boolean
    Dim flg As Boolean

    arrU = Array(SU1, SU2, SU6)

    Set oRe = New RegExp
    With oRe
      .Global = True
      .IgnoreCase = True
      .Pattern = SPTN
    End With

    Set oIe = New InternetExplorer
    With oIe
      .Visible = True

      For Each vU In arrU
        .Navigate vU

        Do

          While .Busy Or .ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend

          sIH = .Document.Body.innerHtml
          Erase arrF
          cn = 0
          For Each oM In oRe.Execute(sIH)
            If InStr(SLIST, SDLM & oM.SubMatches(0) & SDLM) Then arrF(cn) = True
            cn = cn + 1
          Next

          cn = 0
          For Each oE In .Document.getElementsByClassName("btnBad")
            If arrF(cn) Then
              oE.Children(0).Click
              DoEvents
            End If
            cn = cn + 1
          Next

    '      cn = 0
    '      For Each oE In .Document.getElementsByClassName("btnGood")
    '        If Not arrF(cn) Then
    '          oE.Children(0).Click
    '          DoEvents
    '        End If
    '        cn = cn + 1
    '      Next

          flg = False
          With .Document.getElementsByClassName("btnNext")
            If .Length Then
              .Item(0).Children(0).Click
              flg = True
            End If
          End With

        Loop While flg

      Next vU

      .Quit
    End With
    End Sub

    '普通ポチボタンってipアドレスに付き1回よね?iいつまで?

PR

PR
Yahoo! JAPAN 復興支援 東日本大震災

スレッドを作成しよう!

このカテゴリにスレッド作成する

本文はここまでです このページの先頭へ