mikethetechguy Posted April 17, 2008 Posted April 17, 2008 (edited) Hey Guys, I'd like to read the text from a window if it exists, and then compare it to something to make decisions, so... read text from a box in access (3rd party program that runs on top, aeries, title "Microsoft Office Access", text "Your software is over 6 months behind! You should download a newer release!") if that exists, then I want to perform an action so my understanding of how to get this done is declaring a variable for the text to exist in (the window title doesn't seem relevant enough to use, as everything will have an Access title), getting the text from the current in focus window, then saying if $var = "Your software is over 6 months behind! You should download a newer release!" then perform the following actions. The getting text and comparing text is the part that I get tripped up on, any help is much appreciated. I've been looking for this answer for quite a while with no luck. my best looking attempt at this have been the following, note however that this is a simple test to see what I could get and write, and does not involve comparison logic, which I would appreciate a helping hand in. (the following has been edited) $var = ControlGetText("test.txt - Notepad", "", "Edit1") ControlSetText("testwrite.txt - Notepad", "","Edit1", $var) the text copy bit is finally working, now I'd just like to search within $var for text and assign a different variable a 0 or 1 depending on a search within that text. So $var = "fun time happiness" at the moment, I want to search if it contains "fun", and if so assign a variable the number 1. Edited April 18, 2008 by mikethetechguy
mikethetechguy Posted April 17, 2008 Author Posted April 17, 2008 Please post the code you have already done. Then we may assist you.I did. I wanted to nail out the first step before moving on and making things more muddled.
PsaltyDS Posted April 17, 2008 Posted April 17, 2008 The getting text and comparing text is the part that I get tripped up on, any help is much appreciated. I've been looking for this answer for quite a while with no luck.my best looking attempt at this have been the following, note however that this is a simple test to see what I could get and write, and does not involve comparison logic, which I would appreciate a helping hand in.$var = ControlGetText("C:\WINDOWS\system32\cmd.exe", "", "Edit1")ControlSetText("testwrite.txt - Notepad", "Edit1", "", $var)There is no "Edit1" control in a command line console, which is what "C:\WINDOWS\system32\cmd.exe" would be.Are you trying to read text from a console ("DOS box")? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
mikethetechguy Posted April 17, 2008 Author Posted April 17, 2008 There is no "Edit1" control in a command line console, which is what "C:\WINDOWS\system32\cmd.exe" would be.Are you trying to read text from a console ("DOS box")? in this test case, yeah.
mikethetechguy Posted April 17, 2008 Author Posted April 17, 2008 This one makes more sense, you're right... $var = ControlGetText("test.txt - Notepad", "", "Edit1") ControlSetText("testwrite.txt - Notepad", "Edit1", "", $var)
PsaltyDS Posted April 18, 2008 Posted April 18, 2008 This one makes more sense, you're right...$var = ControlGetText("test.txt - Notepad", "", "Edit1")ControlSetText("testwrite.txt - Notepad", "Edit1", "", $var)The second line has the Text and ControlID parameters reversed. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
mikethetechguy Posted April 18, 2008 Author Posted April 18, 2008 The second line has the Text and ControlID parameters reversed. Yay! It worked, thank you!Now any idea on how to do a boolean from searching within the captured text?For an example mine says "fun time happiness", I want to code a "does happiness exist in $var" yes set to 1
PsaltyDS Posted April 18, 2008 Posted April 18, 2008 (edited) Yay! It worked, thank you!Now any idea on how to do a boolean from searching within the captured text?For an example mine says "fun time happiness", I want to code a "does happiness exist in $var" yes set to 1StringRegExp() with flag 0, or just StringInStr(). Edited April 18, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
mikethetechguy Posted April 18, 2008 Author Posted April 18, 2008 StringRegExp() with flag 0, or just StringInStr(). have I mentioned today that YOU ARE THE FREAKIN MAN! Worked like a charm and now I can do a lot more with autoIT, thank you so much!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now