Sign in to follow this  
Followers 0

Send Keystroke To App

2 posts in this topic

Is it possible to use AutoIt v3 scripts to send keystrokes and read from applications running in the background? I have a program that reads text documents and books for me, and I almost always have it on. It's called ReadPlease. The problem is, I read a lot of annotated documents in MLA and CMS format, because of my studies and because one of my part-time jobs as a teacher's aid for an online class, and the reading program announces (Citation, pg. xx.x, ch. xx) etc, or reads the footnotes at the bottom of every page. It's irritating and screws up the flow of the documents, so I find myself bringing the window to the front all the time and skipping over the footnotes or just removing the footnotes before reading.

I am trying to have my script read the text from the program, ReadPleae, and send the keyboard command {arrow right} if I come to a number or an open parenthesis, effectively skipping the footnotes. Then I will just scan the documents quickly to see if I missed anything important in brackets or behind numbers. It would make it easier to multitask if I could have this keystroke sent to the application without making it active, and it would be yet another great study tool, saving hoards of time. History finals are right now, too. Total bummer.

Right now, the code is very simple, but I am going to try to add a que, so that the script will automatically pause and then load the next document in my que when finished reading.

AutoItSetOption("WinDetectHiddenText", 1)
While 1
$var = WinGetText("ReadPlease2003", ". (")
If $var = . ( 
          While $parenthesis = 0
          $var2 = WinGetText("ReadPlease2003", ")"
          If $var2 NOT 1
               Then $parenthesis = 1

How does the code look?

I'm not sure if the return is 1 or @error when text is not found, but I know that it is 1 when the title is not found, so I am just guessing it is 1 for text not found, also.

Another problem that exists, and it really sucks, is that the parenthesis is going to be found right away. When I wrote this, I was relying on it to only read the visible text in the ReadPlease window, and just have one word visible at a time, therefore making the script activate only when a parenthese became visible. Instead, the script finds all the parentheses in the document and reads them. I am reading the functions and available help files and forums trying to find a solution, but now my problem is public. Help please. Thanks if you help.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0