Wait Screen Image to ran 2 compile EXE

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Wait Screen Image to ran 2 compile EXE

Post by zealotz » Sat Feb 06, 2021 7:17 pm

I want to ran a compile EXE
If the Screen Image see a GREEN color it will ran a GREEN.EXE (green add time)
If the Screen Image see a RED color it will ran a RED.EXE (red create an account)
?
I do not know how to use if command
can anybody help?

Wait>0.20
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\red.bmp,red
Wait>0.20
ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\2. Create Account & Notice 2021.exe,2. Create Account & Notice 2021
Wait>0.20
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\green.bmp,0
Wait>0.20
ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\3. ADD Time to excisting account 2021.exe,3. ADD Time to excisting account 2021
Wait>0.20

BlockInput>0
Thanks for reading.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Wait Screen Image to ran 2 compile EXE

Post by Dorian (MJT support) » Sun Feb 07, 2021 1:46 pm

Here's a sample which will simply look for two images, one after the other, and execute an exe file if it finds the image in question.

Code: Select all

//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\redimage.bmp,SCREEN,0.7,1,XArr,YArr,RedNumFound,CCOEFF
If>RedNumFound>0
  ExecuteFile>path/to/green/exe
Endif

//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\greenimage.bmp,SCREEN,0.7,1,XArr,YArr,GreenNumFound,CCOEFF
If>GreenNumFound>0
  ExecuteFile>path/to/red/exe
Endif
Generate this code yourself by using the Image Recognition Wizard, then edit it to match mine. If you want to loop this in some way, then these two articles will help you : How To Loop The Loop and Can I Loop or Repeat my Macro

If the image is simply green or red and if the position can be reliably predicted, then maybe you don't even need to use Image Recognition. Maybe just looking at 1 pixel colour would suffice. In which case you should look into GetPixelColor or WaitPixelColor.
Yes, we have a Custom Scripting Service. Message me or go here

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Re: Wait Screen Image to ran 2 compile EXE

Post by zealotz » Sun Feb 07, 2021 3:17 pm

When I tried this method it Execute both green and red exe, how can we make it to execute 1 exe only?

and thanks very much for the reply really appreciate it. :D

//Find and Left Click Center of
FindImagePos>%BMP_DIR%\redimage.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>RedNumFound>0
ExecuteFile>path/to/green/exe
Endif

//Find and Left Click Center of
FindImagePos>%BMP_DIR%\greenimage.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>GreenNumFound>0
ExecuteFile>path/to/red/exe
Endif

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Wait Screen Image to ran 2 compile EXE

Post by Dorian (MJT support) » Sun Feb 07, 2021 5:13 pm

I apologize, RedNumFound and GreenNumFound should have also been in the FindImagePos lines. I have edited my original post.

Code: Select all

//Find 
FindImagePos>%BMP_DIR%\redimage.bmp,SCREEN,0.7,1,XArr,YArr,RedNumFound,CCOEFF
If>RedNumFound>0
  ExecuteFile>path/to/green/exe
Endif

//Find 
FindImagePos>%BMP_DIR%\greenimage.bmp,SCREEN,0.7,1,XArr,YArr,GreenNumFound,CCOEFF
If>GreenNumFound>0
  ExecuteFile>path/to/red/exe
Endif
I would have thought the code you posted would not have found either, but let's see how you get on with this now.
Yes, we have a Custom Scripting Service. Message me or go here

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Re: Wait Screen Image to ran 2 compile EXE

Post by zealotz » Mon Feb 08, 2021 3:48 pm

another problem

RED and GREEN is now ok

If the color is WHITE - it will not ran the EXE?

the search box has 3 color if you will not write nay name it will turn white that is why i want to stop the macro in 5 seconds is the person will not write any name. thanks

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Wait Screen Image to ran 2 compile EXE

Post by Dorian (MJT support) » Mon Feb 08, 2021 4:23 pm

Have you simply tried doing exactly what you did for red and green, but for white? It's quite likely you'll need to sample something other than just a white rectangle though as there will likely be other white areas on the screen - or use the wizard to just look at specific coordinates on the screen.

When this finds white it will run the exe then wait 5 seconds and exit.

Code: Select all

//Find 
FindImagePos>%BMP_DIR%\whiteimage.bmp,SCREEN,0.7,1,XArr,YArr,WhiteNumFound,CCOEFF
If>WhiteNumFound>0
  ExecuteFile>path/to/white/exe
  Wait>5
  exit
Endif
Yes, we have a Custom Scripting Service. Message me or go here

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Re: Wait Screen Image to ran 2 compile EXE

Post by zealotz » Thu Feb 11, 2021 5:28 pm

hi thanks for the fast replies

here's what's best for me
1. if the search box is RED no problem it only execute RED.

2. the problem is if the search box is green
it will both execute GREEN first and then RED.

what program or command will i do to not execute RED. I know this is super noob question sorry :)
I can't find one.... :)

--------------for Create Account - RED Button ------

------------------ execute a program that --------------
//Find
Let>WSI_TIMEOUT=5
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\green.bmp,0
ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi GREEN.exe,


------------------ execute Create Account --------------
If>RedNumFound>0
Let>WSI_TIMEOUT=5
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\red.bmp,0
ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi RED.exe,
Endif

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Wait Screen Image to ran 2 compile EXE

Post by Dorian (MJT support) » Fri Feb 12, 2021 11:19 am

Let's examine what you've got here :

Code: Select all

Let>WSI_TIMEOUT=5
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\green.bmp,0
ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi GREEN.exe,
Line 1 : You set the timeout to 5 seconds
Line 2 : You wait for the image for 5 seconds
Line 3 : You execute a file regardless of whether or not the image was found.

Is that what you want? Or do you want it to wait 5 seconds and then only execute the file if the image was found? If you want it to only execute if green was found, then you need this :

Code: Select all

if>WSI_Timedout=FALSE
  ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi GREEN.exe,
endif
Similarly for the red one. I have removed the If>RedNumFound reference as it wasn't clear whether you were still using that.

Code: Select all

Let>WSI_TIMEOUT=5
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\red.bmp,0
if>WSI_Timedout=FALSE
  ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi RED.exe,
Endif
If you read the help file for WaitScreenImage you will see an in-depth description of WSI_Timedout
Yes, we have a Custom Scripting Service. Message me or go here

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Re: Wait Screen Image to ran 2 compile EXE

Post by zealotz » Fri Feb 12, 2021 11:46 am

Here the summary of what i want

1. if it find a green color, it will send a message and terminate everything immediately with out doing anything.

//Find
Let>WSI_TIMEOUT=5
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\green.bmp,0
ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi GREEN.exe,

2. if it find a RED - it will execute RED only.
this is the only thing i want.

thanks :)

------------------ execute Create Account --------------
If>RedNumFound>0
Let>WSI_TIMEOUT=5
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\red.bmp,0
ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi RED.exe,
Endif

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Wait Screen Image to ran 2 compile EXE

Post by Dorian (MJT support) » Fri Feb 12, 2021 6:20 pm

Code: Select all

//Execute a file then exit if it sees green.
//Simply change the executefile for any action you like. It currently runs the green exe
Let>WSI_TIMEOUT=5
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\green.bmp,0
if>WSI_Timedout=FALSE
 ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi GREEN.exe,
 Exit
endif


//Execute a file if it sees red. The script will exit anyway as this is the end of the script
Let>WSI_TIMEOUT=5
WaitScreenImage>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\red.bmp,0
if>WSI_Timedout=FALSE
  ExecuteFile>C:\PC Files\0. Desktop wall paper 1-23-2021\Robot\Hi RED.exe,
Endif
Yes, we have a Custom Scripting Service. Message me or go here

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Re: Wait Screen Image to ran 2 compile EXE

Post by zealotz » Sat Feb 13, 2021 2:06 am

You know what super thank you :)

my next project is trading stocks

I am tired watching and staying on my pc monitor 4 to 5 hours in Fucos mode. :)

I will make a macro that reminds me to sell or cut off.

by the way thank you

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Re: Wait Screen Image to ran 2 compile EXE

Post by zealotz » Sat Feb 13, 2021 2:08 am

hey I do not know where are you right now in this world

But can i add you on facebook

:)

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Re: Wait Screen Image to ran 2 compile EXE

Post by zealotz » Mon Feb 15, 2021 5:19 pm

hello new problem :)
I start to ran the computer with Block 1 open it with a limited time of 50 seconds by block 0 wait 50 and block 1
then let my customer write there user account names and give them 50 seconds to do so.
1. problem: I want them to click enter when there done writing there name with a delay of 5 secods

ex. I type my name and ended up to 20 seconds, I do not want to wait 30 seconds more to continue
i will tap ENTER to stop timer and just deley it to 5 seconds.

===================================
===================================
Wait>0.20
BlockInput>0

Wait>50

BlockInput>1
Wait>0.20
====================================




2. Second problem
I want my customer to tap a F1 to access my pc and ready the form to be fill up.
there are 2 ways to open this form. single tap no guide, double tap rans with guide first then open the form.

a. Single tap on F1, means open the from and let them fill up the form

b. Double tap on F1, means it will ran a executable video guide on how to fell up the form. and
open the form to be fill up. this is meant for first timers.

thanks once again

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Wait Screen Image to ran 2 compile EXE

Post by Dorian (MJT support) » Mon Feb 15, 2021 5:55 pm

Can you post this as a new thread please?
Yes, we have a Custom Scripting Service. Message me or go here

zealotz
Newbie
Posts: 11
Joined: Sat Feb 06, 2021 6:54 pm

Re: Wait Screen Image to ran 2 compile EXE

Post by zealotz » Mon Feb 15, 2021 8:04 pm

Subject:

How to Block keyboard and mouse open to fill up a form.

already post it thanks

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts