Okay, I'm making a spammer with a few functions.
They are:
Ad before message - CheckBox4
@ after message for anti-mute - CheckBox5
Textbox3.text = Message
Textbox4.text = @ (anti-mute character)
Textbox5.text = skiiiz spammer= (advertisement)
Bold is what the problem is in.
My code doesn't seem to be working right.
Code:
If CheckBox4.Checked = True Then
SendKeys.Send(TextBox5.Text + TextBox3.Text)
SendKeys.Send("{ENTER}")
Else
If CheckBox5.Checked = True Then
SendKeys.Send(TextBox3.Text)
SendKeys.Send("{ENTER}")
SendKeys.Send(TextBox3.Text + TextBox4.Text)
SendKeys.Send("{ENTER}")
Else
If CheckBox4.Checked = True And CheckBox5.Checked = True Then
SendKeys.Send(TextBox5.Text)
SendKeys.Send(TextBox3.Text)
SendKeys.Send(TextBox4.Text)
SendKeys.Send("{ENTER}")
SendKeys.Send(TextBox5.Text + TextBox3.Text)
SendKeys.Send("{ENTER}")
Else
SendKeys.Send(TextBox3.Text)
SendKeys.Send("{ENTER}")
End If
End If
End If
If CheckBox4.Checked = True and CheckBox5.Checked = True Then
Sorry hejsan1, still have the same problem, it only sends the ad + message, not the anti-mute.
Usually, I believe in "Clean Code" However, it may be best if your code looks like this
Code:
If CheckBox4.Checked = True and Checkbox5.Checked = False Then
SendKeys.Send(TextBox5.Text + TextBox3.Text)
SendKeys.Send("{ENTER}")
End If
If CheckBox5.Checked = True and CheckBox4.checked = False Then
SendKeys.Send(TextBox3.Text)
SendKeys.Send("{ENTER}")
SendKeys.Send(TextBox3.Text + TextBox4.Text)
SendKeys.Send("{ENTER}")
End If
If CheckBox4.Checked = True And CheckBox5.Checked = True Then
SendKeys.Send(TextBox5.Text)
SendKeys.Send(TextBox3.Text)
SendKeys.Send(TextBox4.Text)
SendKeys.Send("{ENTER}")
SendKeys.Send(TextBox5.Text + TextBox3.Text)
SendKeys.Send("{ENTER}")
Else
SendKeys.Send(TextBox3.Text)
SendKeys.Send("{ENTER}")
End If
Not that I have any idea as to what exactly you are trying to do....
I believe we need to sticky a thread that tells all about this stuff and gives solutions to possible problems...because I see this more than anything
We could Create a sendkeys tutorial (if there isn't a few already) But the code is fine, It's the If , Else if, To the naked eye, the else statements look fine, and else is easy to accomplish, the fact though when using If, Else , End if, With and statments and also having matching prerequisites, it becomes much more tricky, So best bet is use radio buttons If radio button one then this happens, if radio button 2 then this and this happens, if radio button 3 then this that and the other thing.
Lets look at his code as an example
[php]
' This statment checks if checkbox 4 is checked
' If it is checked then perform the action
If CheckBox4.Checked = True Then
SendKeys.Send(TextBox5.Text + TextBox3.Text)
SendKeys.Send("{ENTER}")
Else
'' This statment checks if checkboxr is checked
' If it is checked then perform the action
If CheckBox5.Checked = True Then
SendKeys.Send(TextBox3.Text)
SendKeys.Send("{ENTER}")
SendKeys.Send(TextBox3.Text + TextBox4.Text)
SendKeys.Send("{ENTER}")
Else
' Here is where it gets tricky, Check4 check action above will occur, as well as ' this action
If CheckBox4.Checked = True And CheckBox5.Checked = True Then
SendKeys.Send(TextBox5.Text)
SendKeys.Send(TextBox3.Text)
SendKeys.Send(TextBox4.Text)
SendKeys.Send("{ENTER}")
SendKeys.Send(TextBox5.Text + TextBox3.Text)
SendKeys.Send("{ENTER}")
Else
SendKeys.Send(TextBox3.Text)
SendKeys.Send("{ENTER}")
End If
End If
End If
[/php]
Think about it "Logically" If Checkbox4 and 5 is checked , then checkbox4.checked still = true right, Which Means part 1 and 3 of the code are accurate, so both will be completed. Fact is it is hard to explain,
So either separate the IF then statements, use radio buttons or
[php]
If CheckBox4.Checked = True and checkbox5.checked = False Then
SendKeys.Send(TextBox5.Text + TextBox3.Text)
SendKeys.Send("{ENTER}")
Else
If CheckBox5.Checked = True and checkbox4.checked=falseThen
SendKeys.Send(TextBox3.Text)
SendKeys.Send("{ENTER}")
SendKeys.Send(TextBox3.Text + TextBox4.Text)
SendKeys.Send("{ENTER}")
Else
' Here is where it gets tricky, Check4 check action above will occur, as well as ' this action
If CheckBox4.Checked = True And CheckBox5.Checked = True Then
SendKeys.Send(TextBox5.Text)
SendKeys.Send(TextBox3.Text)
SendKeys.Send(TextBox4.Text)
SendKeys.Send("{ENTER}")
SendKeys.Send(TextBox5.Text + TextBox3.Text)
SendKeys.Send("{ENTER}")
Else
SendKeys.Send(TextBox3.Text)
SendKeys.Send("{ENTER}")
End If
End If
End If
[/php]