Advertisement
Codydude56

Code for my RS Autotyper

Feb 3rd, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.IO
  2.  
  3. Public Class Form1
  4.     Dim FILE_NAME As String = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\savetext.txt"
  5.     Dim PRESETS As String = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\presets.txt"
  6.     Dim COLOR As Boolean
  7.     Dim EFFECT As Boolean
  8.     Dim EFFECT2 As Boolean
  9.     Dim MOVEMENT As Boolean
  10.     Dim EffectSet1 As String
  11.     Dim EffectSet2 As String
  12.     Dim EffectConvert1 As String
  13.     Dim EffectConvert2 As String
  14.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  15.         If TextBox1.Text = "" Then
  16.             MsgBox("You must type something in to send something.")
  17.         Else
  18.             Timer1.Start()
  19.             Button1.Enabled = False
  20.             Button2.Enabled = True
  21.             TextBox1.Enabled = False
  22.             ToolStripStatusLabel2.Text = "Active"
  23.         End If
  24.     End Sub
  25.  
  26.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  27.         Timer1.Stop()
  28.         Button1.Enabled = True
  29.         Button2.Enabled = False
  30.         TextBox1.Enabled = True
  31.         ToolStripStatusLabel2.Text = "Inactive"
  32.     End Sub
  33.  
  34.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  35.         SendKeys.Send(EffectConvert1 + EffectConvert2 + TextBox1.Text)
  36.         SendKeys.Send("{Enter}")
  37.     End Sub
  38.  
  39.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  40.         If System.IO.File.Exists(FILE_NAME) = True Then
  41.             System.IO.File.Delete(FILE_NAME)
  42.         End If
  43.         Dim Text As String = TextBox1.Text
  44.         Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
  45.         objWriter.WriteLine(Text)
  46.         objWriter.Close()
  47.     End Sub
  48.  
  49.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  50.         If System.IO.File.Exists(FILE_NAME) = True Then
  51.             Using sr As New StreamReader(FILE_NAME)
  52.                 Dim line As String
  53.                 line = sr.ReadToEnd()
  54.                 TextBox1.Text = line
  55.             End Using
  56.         End If
  57.         If System.IO.File.Exists(PRESETS) = True Then
  58.             Using r As New StreamReader(PRESETS)
  59.                 While (r.Peek() > -1)
  60.                     ListBox1.Items.Add(r.ReadLine)
  61.                 End While
  62.                 r.Close()
  63.             End Using
  64.         End If
  65.     End Sub
  66.  
  67.     Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
  68.         If Not TextBox1.Text = "" Then
  69.             ListBox1.Items.Add(TextBox1.Text)
  70.         Else
  71.             MsgBox("You must type something to set as a preset.")
  72.         End If
  73.     End Sub
  74.  
  75.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  76.         ListBox1.Items.Remove(ListBox1.SelectedItem)
  77.     End Sub
  78.  
  79.     Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
  80.         If Not ListBox1.SelectedItem = "" Then
  81.             Button4.Enabled = True
  82.         Else
  83.             Button2.Enabled = False
  84.         End If
  85.     End Sub
  86.  
  87.     Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
  88.         TextBox1.Text = ListBox1.SelectedItem
  89.     End Sub
  90.  
  91.     Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  92.         If Not ComboBox1.Text = "None" Then
  93.             COLOR = True
  94.             EFFECT = False
  95.             EFFECT2 = False
  96.             EffectSet1 = ComboBox1.Text
  97.             ComboBox4.Text = "None"
  98.             ComboBox2.Text = "None"
  99.         End If
  100.         If ComboBox1.Text = "None" Then
  101.             COLOR = False
  102.             If EFFECT = False And EFFECT2 = False Then
  103.                 EffectSet1 = ""
  104.             End If
  105.         End If
  106.     End Sub
  107.  
  108.     Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
  109.         If Not ComboBox2.Text = "None" Then
  110.             COLOR = False
  111.             EFFECT = True
  112.             EFFECT2 = False
  113.             EffectSet1 = ComboBox2.Text
  114.             ComboBox1.Text = "None"
  115.             ComboBox4.Text = "None"
  116.         End If
  117.         If ComboBox2.Text = "None" Then
  118.             EFFECT = False
  119.             If COLOR = False And EFFECT2 = False Then
  120.                 EffectSet1 = ""
  121.             End If
  122.         End If
  123.     End Sub
  124.  
  125.     Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
  126.         If Not ComboBox3.Text = "None" Then
  127.             MOVEMENT = True
  128.             EffectSet2 = ComboBox3.Text
  129.         End If
  130.         If ComboBox3.Text = "None" Then
  131.             MOVEMENT = False
  132.             EffectSet2 = ""
  133.         End If
  134.     End Sub
  135.  
  136.     Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
  137.         If Not ComboBox4.Text = "None" Then
  138.             COLOR = False
  139.             EFFECT = False
  140.             EFFECT2 = True
  141.             EffectSet1 = ComboBox4.Text
  142.             ComboBox1.Text = "None"
  143.             ComboBox2.Text = "None"
  144.         End If
  145.         If ComboBox4.Text = "None" Then
  146.             EFFECT2 = False
  147.             If COLOR = False And EFFECT = False Then
  148.                 EffectSet1 = ""
  149.             End If
  150.         End If
  151.     End Sub
  152.  
  153.     Private Sub Timer2_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
  154.         If ComboBox1.Text = "None" Then
  155.             COLOR = False
  156.         End If
  157.         If ComboBox2.Text = "None" Then
  158.             EFFECT = False
  159.         End If
  160.         If ComboBox4.Text = "None" Then
  161.             EFFECT2 = False
  162.         End If
  163.         If ComboBox3.Text = "None" Then
  164.             MOVEMENT = False
  165.         End If
  166.         If COLOR = True Then
  167.             If EffectSet1 = "White" Then
  168.                 EffectConvert1 = "white:"
  169.             End If
  170.             If EffectSet1 = "Red" Then
  171.                 EffectConvert1 = "red:"
  172.             End If
  173.             If EffectSet1 = "Purple" Then
  174.                 EffectConvert1 = "purple:"
  175.             End If
  176.             If EffectSet1 = "Green" Then
  177.                 EffectConvert1 = "green:"
  178.             End If
  179.             If EffectSet1 = "Cyan" Then
  180.                 EffectConvert1 = "cyan:"
  181.             End If
  182.         End If
  183.         If EFFECT = True Then
  184.             If EffectSet1 = "Glow 1" Then
  185.                 EffectConvert1 = "glow1:"
  186.             End If
  187.             If EffectSet1 = "Glow 2" Then
  188.                 EffectConvert1 = "glow2:"
  189.             End If
  190.             If EffectSet1 = "Glow 3" Then
  191.                 EffectConvert1 = "glow3:"
  192.             End If
  193.         End If
  194.         If EFFECT2 = True Then
  195.             If EffectSet1 = "Flash 1" Then
  196.                 EffectConvert1 = "flash1:"
  197.             End If
  198.             If EffectSet1 = "Flash 2" Then
  199.                 EffectConvert1 = "flash2:"
  200.             End If
  201.             If EffectSet1 = "Flash 3" Then
  202.                 EffectConvert1 = "flash3:"
  203.             End If
  204.         End If
  205.         If MOVEMENT = True Then
  206.             If EffectSet2 = "Wave" Then
  207.                 EffectConvert2 = "wave:"
  208.             End If
  209.             If EffectSet2 = "Slide" Then
  210.                 EffectConvert2 = "slide:"
  211.             End If
  212.             If EffectSet2 = "Shake" Then
  213.                 EffectConvert2 = "shake:"
  214.             End If
  215.             If EffectSet2 = "Scroll" Then
  216.                 EffectConvert2 = "scroll:"
  217.             End If
  218.             If EffectSet2 = "Wave 2" Then
  219.                 EffectConvert2 = "wave2:"
  220.             End If
  221.         End If
  222.     End Sub
  223.  
  224.     Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
  225.         If System.IO.File.Exists(PRESETS) = True Then
  226.             System.IO.File.Delete(PRESETS)
  227.         End If
  228.         Dim i As Integer
  229.         Dim objWriter As New System.IO.StreamWriter(PRESETS, True)
  230.         For i = 0 To ListBox1.Items.Count - 1
  231.             objWriter.WriteLine(ListBox1.Items.Item(i))
  232.         Next
  233.         objWriter.Close()
  234.     End Sub
  235.  
  236.     Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
  237.         If System.IO.File.Exists(PRESETS) = True Then
  238.             System.IO.File.Delete(PRESETS)
  239.         Else
  240.             MsgBox("You haven't saved anything!")
  241.         End If
  242.     End Sub
  243.  
  244.     Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
  245.         If System.IO.File.Exists(FILE_NAME) = True Then
  246.             System.IO.File.Delete(FILE_NAME)
  247.         Else
  248.             MsgBox("You haven't saved anything!")
  249.         End If
  250.     End Sub
  251. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement