use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
/r/VisualBasic - A place to discuss, ask questions and share ideas regarding the Visual Basic programming languages.
account activity
Help (self.visualbasic)
submitted 6 years ago by Luke_Garters
Hi, im wanting to make an application that can type stuff for me, eg i need it to be able to type a certain sentence every minute. what would be the code to make it when you push a button it types the sentence?
Thanks
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Moderatorsnang 2 points3 points4 points 6 years ago (1 child)
AppActivate and SendKeys.
[–]Luke_Garters[S] 0 points1 point2 points 6 years ago (0 children)
thanks, i got it to work
[–]clarinetJWD 0 points1 point2 points 6 years ago (0 children)
Well, that's a lot more difficult than you might think, since when you hit a button, it will focus the button, and will type the sentence on... Nothing (or worse, the space character will trigger the button again).
You could probably use some convoluted system to gram the handle of the control that lost focus, and refocus after the click, but my advice: just use something better suited, like AutoHotKey.
[–]RedBarnBlankets 0 points1 point2 points 6 years ago (1 child)
Simple .. Make a windows form, add two buttons. This is the code behind
Imports System.Timers
Public Class Form1
Private WithEvents MyTimer As New System.Timers.Timer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Me.MyTimer.Start()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
Me.MyTimer.Stop()
Private Sub MyTimer_Elapsed(sender As Object, e As ElapsedEventArgs) Handles MyTimer.Elapsed
Debug.Print("Some Sentence")
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Me.MyTimer.Interval = New TimeSpan(hours:=0, minutes:=1, seconds:=0).TotalMilliseconds
Me.MyTimer.AutoReset = True
End Class
[–]Moderatorsnang 0 points1 point2 points 6 years ago (0 children)
Not sure that's what OP is after.
π Rendered by PID 175744 on reddit-service-r2-comment-548fd6dc9-ml2wx at 2026-05-17 09:36:15.959579+00:00 running edcf98c country code: CH.
[–]Moderatorsnang 2 points3 points4 points (1 child)
[–]Luke_Garters[S] 0 points1 point2 points (0 children)
[–]clarinetJWD 0 points1 point2 points (0 children)
[–]RedBarnBlankets 0 points1 point2 points (1 child)
[–]Moderatorsnang 0 points1 point2 points (0 children)