Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Sun Jun 16, 2019 9:19 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Text inside an application
Thanked: 0 time(s)  Unread post Posted: Sat Jun 01, 2019 8:42 pm 
New User
New User



Joined: Wed May 29, 2019 4:36 pm
Posts: 6
Been thanked: 0 time(s)
Has thanked: 2 time(s)
Contribution Points: 10
I was trying to automate a few things, but I couldn't find a way to make BEM auto detect a text inside an program, like a sentence in excel or a error message from any program, just something that sometimes works with pixel pattern...
Is there a way to scan for texts? Or I need to dig into the program memory for that?


Top
 Profile  
Reply with quote  
 Post subject: Re: Text inside an application
Thanked: 1 time(s)  Unread post Posted: Sun Jun 02, 2019 1:19 am 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1899
Location: USA
Been thanked: 409 time(s)
Has thanked: 33 time(s)
Contribution Points: 16568
Depends on the program and if it's really text or encoded. For example Notepad is fine the way it is, but Office products like Word and Excel will need extra scripting. For Notepad (or pure text files) you can use:
Code:
 begin
     File.Read text("C:\Users\Syrifina\Desktop\NotepadTest.txt", "result")
     if  Variable.Contains text("result", "sentence")
          begin
               Window.Display message box("The word was found", "yes")
               Macro.Abort()
          end
     Window.Display message box("The word could not be found", "yes")
 end
...or use "file.contains"; don't really need to read it for Notepad.

If your not sure it's going to work or want to use the same macro for everything, then you should probably just copy the file to the clipboard and use something like this:
Code:
 begin
     Window.Bring to front("Excel", "no")
     Macro.Pause("100")
     Keyboard.Press keys at once("{<ctrl>}a")
     Macro.Pause("100")
     Keyboard.Press keys at once("{<ctrl>}c")
     Clipboard.Get text("x")
     Variable.Trim white spaces("x")
     Clipboard.Set text("x")
     if  Variable.Contains text("x", "sentence")
          begin
               Window.Display message box("The word was found", "yes")
               Macro.Abort()
          end
     Window.Display message box("The word could not be found", "yes")
 end
If you get the wrong result the first time, try it again. I noticed that the first macro.pause may not be long enough for the first run, but after that it works fine at 100. It doesn't have time to select-all and copy; you should be able to notice that the spreadsheet didn't change to the blue color (selected) and/or the dashed lines are not visible. Or just make the pause longer from the beginning to be safe.

Another option is to use REGEX. You can do a forum search for more information on that route.

And one more option (which may be closer to your question since you asked about pixel patterns) would be to use "ctrl f" (almost everything uses that shortcut for "find"), type text [what you want to search for], and then use pixel patterns to see if a result was found.

Hope that helps!

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
 Post subject: Re: Text inside an application
Thanked: 0 time(s)  Unread post Posted: Sun Jun 02, 2019 1:32 am 
New User
New User



Joined: Wed May 29, 2019 4:36 pm
Posts: 6
Been thanked: 0 time(s)
Has thanked: 2 time(s)
Contribution Points: 10
Selecting all and sending to the clipboard was a good idea, the text I was needing to check is selectable, so I just made sure the macro checks the window title and tries to select everything inside, sending to the clipboard to analise...
After that I used the pixel pattern to make decisions, like click on a checkbox or an "OK" button.
Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: Text inside an application
Thanked: 0 time(s)  Unread post Posted: Sun Jun 02, 2019 2:53 am 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1899
Location: USA
Been thanked: 409 time(s)
Has thanked: 33 time(s)
Contribution Points: 16568
Glad you found something that works!

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group