Jump to content

Reading Window Info, decisions based off of that


Recommended Posts

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 by mikethetechguy
Link to comment
Share on other sites

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")?

:D

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
Link to comment
Share on other sites

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.

:D

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
Link to comment
Share on other sites

The second line has the Text and ControlID parameters reversed.

:D

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

Link to comment
Share on other sites

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

StringRegExp() with flag 0, or just StringInStr().

:D

Edited 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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...