Skip to content

Commit

Permalink
2.0.1 Code snippets now append after cursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Catboy96 committed Apr 3, 2018
1 parent 7337db6 commit 558769d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,4 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml
*.psd
29 changes: 18 additions & 11 deletions Automator/Automator/MainWindow.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ Class MainWindow

Private Sub btnInput_Click(sender As Object, e As RoutedEventArgs)
If tgbReturn.IsChecked = True Then
txtCode.AppendText(vbCrLf & "DigiKeyboard.println("""");")
InsertString(vbCrLf & "DigiKeyboard.println("""");")
Else
txtCode.AppendText(vbCrLf & "DigiKeyboard.print("""");")
InsertString(vbCrLf & "DigiKeyboard.print("""");")
End If
End Sub

Private Sub btnDelay_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.delay();")
InsertString(vbCrLf & "DigiKeyboard.delay();")
End Sub

Private Sub btnAdd_Click(sender As Object, e As RoutedEventArgs)
Expand Down Expand Up @@ -82,38 +82,45 @@ Class MainWindow
End If
End If
strAdd &= ");"
txtCode.AppendText(vbCrLf & strAdd)
InsertString(vbCrLf & strAdd)
End Sub

Private Sub btnSendGUI_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);")
InsertString(vbCrLf & "DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);")
End Sub

Private Sub btnSendReturn_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ENTER);")
InsertString(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ENTER);")
End Sub

Private Sub btnSendSpace_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_SPACE);")
InsertString(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_SPACE);")
End Sub

Private Sub btnSendDown_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_DOWN);")
InsertString(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_DOWN);")
End Sub

Private Sub btnSendUp_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_UP);")
InsertString(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_UP);")
End Sub

Private Sub btnSendLeft_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_LEFT);")
InsertString(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_LEFT);")
End Sub

Private Sub btnSendRight_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_RIGHT);")
InsertString(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_RIGHT);")
End Sub

Private Sub btnInfo_Click(sender As Object, e As RoutedEventArgs)
Process.Start("https://github.com/CYRO4S/Automator")
End Sub

Private Sub InsertString(ByVal Prompt As String)
Dim index As Integer = txtCode.SelectionStart
txtCode.Text = txtCode.Text.Insert(index, Prompt)
txtCode.SelectionStart = index + Prompt.Length
txtCode.Focus()
End Sub
End Class
4 changes: 2 additions & 2 deletions Automator/Automator/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ Imports System.Windows
' 方法是按如下所示使用“*”: :
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("2.0.0.0")>
<Assembly: AssemblyFileVersion("2.0.0.0")>
<Assembly: AssemblyVersion("2.0.1.1437")>
<Assembly: AssemblyFileVersion("2.0.1.1437")>

0 comments on commit 558769d

Please sign in to comment.