Sign in to follow this  
Followers 0
narayanjr

Script doesnt work

4 posts in this topic

#include <GUIConstants.au3>
opt("PixelCoordMode", 2)
opt("MouseCoordMode", 2)

Hotkeyset("!^+q","quit")

GUICreate ( "", 1152, 864, 0, 0, $WS_POPUP)
GUISetState()
GUISetBkColor(0x000000)

;$var = PixelGetColor(692, 395)
;MsgBox(0,"The decmial color is", $var)

While 1
    
    $coord = PixelSearch(0, 0, 1152, 864, 16777215, 10, 100)
    if Not @error Then
        $coord = PixelSearch(200,630, 390,790, 16777215, 10, 100)
        if Not @error Then
            MouseMove(1152,0,1)
            MouseClick("left")
        Else
            Send("{ALT down}")
            Sleep(200)
            Send("{F4}")
            Sleep(200)
            Send("{ALT up}")
            Sleep(200)
            MouseMove(1152,0,1)
            MouseClick("left")
        EndIf
    EndIf
    
;MouseMove(200,630,50)
;mousemove(390,790,50)
    
sleep(100)
WEnd


Func quit()
Exit
EndFunc

Sorry about bad title name couldn't think of what to call it.

I want it to cover the screen in a black box (which it does). And then i have it checking over and over again if it sees white any where on screen. If it does then i have it checking if its the start menu from hitting the windows key. if it is i want it to go to top right of screen and click. other wise i want it to alt f4 the new window then go to the top left of screen.

Alt f4 out of a window works fine

black box works fine

but when its the menu it still does alt f4 and brings up the shut down dialog

How do i make it just move mouse and click when its the menu and not do alt f4

and instead of looking for white, can i make it look for every color but black?

Thanks

Share this post


Link to post
Share on other sites



u want it to close the start menu if it opens?

If WinActive("Start Menu") Then

WinClose("Start Menu")

EndIf


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

thanks that worked

is there any way to set it to close any window that opens?

Share this post


Link to post
Share on other sites

is there any way to set it to close any window that opens?

Check the help file for the WinList () Function: "Retrieves a list of windows" .

You should be able to modify that for use in your While loop to close any Windows that open other than the one you want to stay open.

Also, it looks like what you are trying to do with your colour search is really just for identifying when new windows open and then close them, is that right?

If so, take a close look at the WinList example in the helpfile. You could easily modify that to do what I think you want, and you wouldn't have to be colour checking all the time. You might even do away with the all black screen, unless you're using it to hide stuff from the user(s).

Make sure you keep the part from the example about only closing Visible windows, otherwise your system may start to behave abnormally.

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  
Followers 0