Excelで動かす
こんな感じでしっかりとGUIまでつけてあります
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
#If VBA7 Then Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr) #Else Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long) #End If Sub Log_In_Good_Click() Dim username As String Dim password As String Dim Url As String Dim ie As InternetExplorer Dim i As Long Dim Click_Num As Long If UserForm1.TextBox2.Value = "" Then MsgBox "クリック回数を入力してください" GoTo FINAL End If If UserForm1.TextBox2.Value > 100 Then MsgBox "100以上はできないようになってます" GoTo FINAL End If If UserForm1.CheckBox2.Value = 0 Then If UserForm1.TextBox3.Value = nall Then MsgBox "クリックの間隔時間を入力してください" GoTo FINAL End If End If If UserForm1.TextBox1.Value = "" Then MsgBox "URLを入力してください" GoTo FINAL End If ' If UserForm1.CheckBox2.Value = True Then ' MsgBox "お試し版では、クリックの間隔時間をランダムにはできません" ' GoTo FINAL ' End If If Worksheets("Auto_LogIn_Good_Retweet").Cells(i, 1).Value = "" Then MsgBox "IDを入力してください" GoTo FINAL End If If Worksheets("Auto_LogIn_Good_Retweet").Cells(i, 2).Value = "" Then MsgBox "Passwordが入力されてないです" GoTo FINAL End If 'URLの取得 Url = UserForm1.TextBox1.Value 'クリック回数の取得 Click_Num = UserForm1.TextBox2.Value i = 2 ' For i = 2 To 10 username = Worksheets("Auto_LogIn_Good_Retweet").Cells(i, 1).Value password = Worksheets("Auto_LogIn_Good_Retweet").Cells(i, 2).Value 'ログインをする Call Auto_LogIn_Twitter(username, password) ' UserForm1.Label3.Caption = i - 1 '対象のページを開く Call View_IE(ie, Url, UserForm1.CheckBox1.Value) 'スクロールを最初にする(改善の余地しかない) Call Auto_croll(ie) '次にいいねをクリックしていく Call Good_Click(ie, Click_Num) '(ie,いいね数) ie.Quit ' 'テキトウな時間待つ ' Sleep RndNumber(10, 3) * 1000 ' Next i Beep MsgBox "完了" FINAL: End Sub Sub Log_In_Retweet_Click() Dim username As String Dim password As String Dim Url As String Dim ie As InternetExplorer Dim i As Long Dim Click_Num As Long If UserForm1.TextBox2.Value = "" Then MsgBox "クリック回数を入力してください" GoTo FINAL End If If UserForm1.CheckBox2.Value = 0 Then If UserForm1.TextBox3.Value = nall Then MsgBox "クリックの間隔時間を入力してください" GoTo FINAL End If End If If UserForm1.TextBox2.Value > 100 Then MsgBox "100以上はできないようになってます" GoTo FINAL End If If UserForm1.TextBox1.Value = "" Then MsgBox "URLを入力してください" GoTo FINAL End If If Worksheets("Auto_LogIn_Good_Retweet").Cells(i, 1).Value = "" Then MsgBox "IDを入力してください" GoTo FINAL End If If Worksheets("Auto_LogIn_Good_Retweet").Cells(i, 2).Value = "" Then MsgBox "Passwordが入力されてないです" GoTo FINAL End If 'URLの取得 Url = UserForm1.TextBox1.Value 'クリック回数の取得 Click_Num = UserForm1.TextBox2.Value i = 2 ' For i = 2 To 10 username = Worksheets("Auto_LogIn_Good_Retweet").Cells(i, 1).Value password = Worksheets("Auto_LogIn_Good_Retweet").Cells(i, 2).Value 'ログインをする Call Auto_LogIn_Twitter(username, password) ' UserForm1.Label3.Caption = i - 1 '対象のページを開く Call View_IE(ie, Url, UserForm1.CheckBox1.Value) 'スクロールを最初にする(改善の余地しかない) Call Auto_croll(ie) 'リツイートをクリックしていく Call Retweet_Click(ie, Click_Num) '(ie,リツイート数) ie.Quit ' 'テキトウな時間待つ ' Sleep RndNumber(10, 3) * 1000 ' Next i Beep MsgBox "完了" FINAL: End Sub |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#If VBA7 Then Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr) #Else Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long) #End If Sub Good_Click(objIE As InternetExplorer, Number As Long) 'Good_Click(objIE As InternetExplorer, 回数を入れる) Dim a As Long '回数を数える変数 a = 0 'タグをクリック For Each objTag In objIE.document.getElementsByClassName("ProfileTweet-actionButton js-actionButton js-actionFavorite") If UserForm1.CheckBox2.Value = True Then '1second×1000microsecond 'ランダムで1~5秒間隔で押す Sleep RndNumber(5, 1) * 1000 Else '指定した時間待つ Sleep UserForm1.TextBox3.Value * 1000 End If objTag.Click If a > Number Then Exit For End If UserForm1.Label4.Caption = a a = a + 1 Next End Sub |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#If VBA7 Then Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr) #Else Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long) #End If Sub Retweet_Click(objIE As InternetExplorer, Number As Long) Dim a As Long '回数をカウントする変数 a = 0 'リツイートボタンをクリック For Each objTag In objIE.document.getElementsByClassName("ProfileTweet-actionButton js-actionButton js-actionRetweet") If UserForm1.CheckBox2.Value = True Then 'ランダムで1~5秒間隔で押す Sleep RndNumber(5, 1) * 1000 Else '指定した時間待つ Sleep UserForm1.TextBox3.Value * 1000 End If objTag.Click '要素を0をにしないといけない objIE.document.getElementsByClassName("EdgeButton EdgeButton--primary retweet-action")(0).Click If a > Number Then Exit For End If UserForm1.Label4.Caption = a a = a + 1 Next End Sub |
コメント