Jump to content
Sign in to follow this  
Cid

Run Program in a Minimized Window; with MouseMove also?

Recommended Posts

Cid

Is there an option to have a program running in the background, with mouse movement and clicks and not effect your current project?  Maybe something with AutoItSetOption(), with Pixel & Mouse Coord Mode.  

Example: Playing Minesweeper minimized, while playing Heaths Maximized.

 

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

Make sure to read the forum rules. A link can be found at the bottom right of each page.

Game automation of any kind isn't permitted here.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Cid

Thanks for having me.

I wan't really meaning minesweeper and hearts, It was an example of the the process I am looking to write my script to do.  I have a program I have to watch that has a green light pop up, and I have to write that code that follows it into a e-mail and send it.  I got that script working, but I want to have the window minimized so I can do other things beside just having that window open and controlling my mouse.

Share this post


Link to post
Share on other sites
Astormooke

Is your email online? such as gmail or yahoo? If so you can control the window while its minimized using _IE commands.

Share this post


Link to post
Share on other sites
water

Can you please be a bit mor specific? What does "watch a program that has a green light pop up" mean?

If we know which program you try to automate we can propose a secure and reliable solution.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Cid

I want to run this in the background, so I can work on other projects and this script not take control of my mouse and have the Monitor window minimized. 

#Region
#AutoIt3Wrapper_UseX64=n
#EndRegion
#include <ImageSearch.au3>

HotKeySet("{s}", "StartScript")
HotKeySet("{z}", "PauseScript")
HotKeySet("{q}", "QuitScript")

Global $Start = 0
Global $Light = 0
Global $LightX = 0
Global $LightY = 0

WinActivate("Monitor")

Func StartScript()
    $Start = 1
EndFunc

Func Light()
    Local $Light = _ImageSearcharea("LightOn.bmp", 1, 960, 0, 1440, 270, $LightX, $LightY, 100)
    If $Light = 1 Then
        MouseClickDrag("Left", $LightX, $LightY, $LightX+72, $LightY, 1)
        Send("^c")
        Run("notepad.exe")
        WinWaitActive("Untitled - Notepad")
        Send("^v")
    EndIf
EndFunc

Func PauseScript()
    $Start = 0
EndFunc

Func QuitScript()
    Exit
EndFunc

While 1
    If $Start = 1 Then
        Light()
    EndIf
    Sleep(1000)
WEnd

As for the program, it's just called Monitor.  It's a basic GUI that monitor one of the controllers in the plant.

Share this post


Link to post
Share on other sites
Astormooke

When the mouse clicks and drags, what is it dragging on? Specifics only make it easier for us to help you

  • Like 1

Share this post


Link to post
Share on other sites
Kidney

it looks like you r doing a copy and a paste. i would recommend looking at FileOpen and FileWriteLine. this will eliminate the need to have the notepad open and will speed up your script.

Share this post


Link to post
Share on other sites
Cid

But Can this Script be minimized the way I have it?

Share this post


Link to post
Share on other sites
Kidney

no it will not run.

the key component to your entire script is imagesearch. if imagesearch fails every time, your script is useless.

imagesearch can only search for an image that is present on the screen.

you might want to use the AU3Info tool in scite and see if you can get a handle on the light in the monitor program.

  • Like 1

Share this post


Link to post
Share on other sites
Cid

Ok thx, and I will look into the fileopen and filewriteline.

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  

×