Jump to content
Sign in to follow this  
Max in montreal

green borderless rectangle...

Recommended Posts

Max in montreal

i need to create a rectangle...64 wide by 16 high. borderless, and without a title...how can i do this?

there are certain sections on my screen i would like to block out...

thanks again in advance.

max

Share this post


Link to post
Share on other sites
Max in montreal

maybe...

#include <GUIConstants.au3>

GUICreate ( "", 64, 16, -1, -1, $WS_POPUP)
GUISetState()
sleep(10000)

8)

yup perfect, now how do i change the location?if i want to place it at 0,0?

Edited by Max in montreal

Share this post


Link to post
Share on other sites
PsaltyDS

And, of course, he did say green...

#include <GUIConstants.au3>

GUICreate ( "", 64, 16, 0, 0, $WS_POPUP)
GUISetBkColor(0x00FF00)
GUISetState()
sleep(10000)

:)


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

Share this post


Link to post
Share on other sites
Max in montreal

And, of course, he did say green...

#include <GUIConstants.au3>

GUICreate ( "", 64, 16, 0, 0, $WS_POPUP)
GUISetBkColor(0x00FF00)
GUISetState()
sleep(10000)

:)

thanks for your examples, it helped me understand what is going on.

the one thing now i cannot figure out to do is kill that popup when i want to kill it, not when the sleep timer runs out.

i want to kill it if a certain pixel is a certain color, if i do not kill it, it must stay there...

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

this is also nice:

#include <GUIConstants.au3>
HotKeySet("{ESC}", "_end")

Global $start = MouseGetPos()

$gui = GUICreate("GUI", 30, 30, $start[0] - 15, $start[1] - 15, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0x00FF00)

_GUICreateInvRect($gui, 5, 5, 20, 20)
GUISetState()

While 1
    Sleep(10)
    $now = MouseGetPos()
    WinMove($gui, "", $now[0] - 15, $now[1] - 15)
WEnd

Func _GUICreateInvRect($hwnd, $l, $t, $w, $h)
    $pos = WinGetPos($hwnd)

    $1 = 0
    $2 = 0
    $3 = $pos[2]
    $4 = $t
    $ret = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4)
    $1 = 0
    $2 = 0
    $3 = $l
    $4 = $pos[3]
    $ret2 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4)
    $1 = $l + $w
    $2 = 0
    $3 = $pos[2]
    $4 = $pos[3]
    $ret3 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4)
    $1 = 0
    $2 = $t + $h
    $3 = $pos[2]
    $4 = $pos[3]
    $ret4 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4)

    DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret2[0], "int", 2)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret3[0], "int", 2)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret4[0], "int", 2)

    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hwnd, "long", $ret[0], "int", 1)
EndFunc   ;==>_GUICreateInvRect

Func _end()
    Exit(0)
EndFunc

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Max in montreal

woa! thats way too much. the first example was perfect.

#include <GUIConstants.au3>

GUICreate ( "", 64, 16, -1, -1, $WS_POPUP)
GUISetState()
sleep(10000)

the only thing i would like to know how to change is to take the sleep out. i want the box to stay there at all times, no timer needed...how do i do that?

Share this post


Link to post
Share on other sites
Paulie

#include <GUIConstants.au3>

Hotkeyset("{ESC}","quit")

GUICreate ( "", 64, 16, -1, -1, $WS_POPUP)
GUISetState()
While 1
sleep(100)
WEnd

Func quit()
Exit
EndFunc

Keeps the box open until you press escape.

Share this post


Link to post
Share on other sites
SmOke_N

woa! thats way too much. the first example was perfect.

#include <GUIConstants.au3>

GUICreate ( "", 64, 16, -1, -1, $WS_POPUP)
GUISetState()
sleep(10000)

the only thing i would like to know how to change is to take the sleep out. i want the box to stay there at all times, no timer needed...how do i do that?

You've been a member for over a year, and you've never heard of a loop?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Max in montreal

You've been a member for over a year, and you've never heard of a loop?

sarcasm noted. when you loop the first example, many popups open and fill the task bar at the bottom. try it.

the escape key might be what i need...

why do we have to put the sleep in there? i guess that was my dilemma...

i just want the rectangle to stay there forever....untill i end the program. when it is there, if i need it i will place it in the proper location. when not needed, i will locate it out of the way.

so i guess in pseudo code...

make a green rectangle

if a certain pixel is yellow, move the rectangle to x,y

if that pixel is not yellow move the rectangle x,y

Edited by Max in montreal

Share this post


Link to post
Share on other sites
Paulie

when you loop the first example, many popups open and fill the task bar at the bottom. try it.

Not when you loop it correctly, If you loop the entire script, yes, but note what i have looped in the escape key example, only the sleep.

why do we have to put the sleep in there? i guess that was my dilemma...

Just to give the script something to do in the loop. I believe the script will either error out, or use 100%CPU if you have nothing in an infinite loop.

Share this post


Link to post
Share on other sites
Paulie

so i guess in pseudo code...

make a green rectangle

if a certain pixel is yellow, move the rectangle to x,y

if that pixel is not yellow move the rectangle x,y

I missed this...

So you want to check the color of a pixel, and if it is yellow, you want the rectangle to move to (x,y) if its any other color, you want it to just be at (x',y')

Things to look at in the helpfile:

:) Edited by Paulie

Share this post


Link to post
Share on other sites
Max in montreal

#include <GUIConstants.au3>

$topbracket = PixelGetColor(471,318)
$bottombracket = PixelGetColor(471,330)

select
case    $topbracket = 16776960;if there is a top bracket 
        GUICreate ( "green", 75, 12, 470, 310, $WS_POPUP)
        GUISetBkColor (0x00FF00)
        GUISetState()
        sleep(100)
    
case    $bottombracket = 16776960 ;if there is a bottom bracket  
        GUICreate ( "green", 75, 12, 470, 322, $WS_POPUP)
        GUISetBkColor (0x00FF00)
        GUISetState()
        sleep(100)
    
case else   
    ;winmove("green",700,25, 100,100)
    ;GUICreate ( "greendada", 75, 12, 700, 25, $WS_POPUP)
    ;GUISetBkColor (0x00FF00)
    ;GUISetState()
    ;sleep(100)

EndSelect

i am having trouble saying what i am asking.

a program is running, if a yellow bracket appears a certain pixel will be yellow.

cover this bracket with the green rectangle.

there are 2 possible locations for this bracket to appear.

only 1 bracket shows up at a time.

i want the bracket to be covered untill i check a 3rd pixel somwhere else. if this 3rd pixel is the color i want, this means the brackets are not there, move the green rectangle, untill one of the brackets shows up again.

Share this post


Link to post
Share on other sites
Paulie

ok the only problem with covering it up is that you will not be able to check whether or not it is still yellow. soo yeah.

Share this post


Link to post
Share on other sites
Max in montreal

ok the only problem with covering it up is that you will not be able to check whether or not it is still yellow. soo yeah.

correct, but if the 3rd pixel is white....(the 3rd pixel is not not under the green rectangle), i know that all the brakets are gone and i could move the rectangle until the brackets show up again.

Share this post


Link to post
Share on other sites
Paulie

Try something like this.

(Note, i didn't know the coords for the 3rd pixel)

#include <GUIConstants.au3>

Hotkeyset("{ESC}","quit")

$Window=GUICreate("", 64, 16, -1, -1, $WS_POPUP)
GUISetBkColor(0x00FF00)
GUISetState()
While 1
    If PixelGetColor(471,318) = 16776960 then ;Top Bracket
        WinMove($Window,"",470, 310)
        Do
            Sleep(100)
        Until PixelGetColor(0,0) = 0xFFFFFF ; Set 3rd pixel Coords
        WinMove($Window,"",0,0);Coords to move if 3rd pixel is white
    ElseIf PixelGetColor(471,330) = 16776960 then ;Bottom Bracket
        WinMove($Window,"",470, 322)
        Do
            Sleep(100)
        Until PixelGetColor(0,0) = 0xFFFFFF ; Set 3rd pixel Coords
        WinMove($Window,"",0,0);Coords to move if 3rd pixel is white
    Else
        Sleep(100)
    EndIf
WEnd

Func quit()
Exit
EndFunc
Edited by Paulie

Share this post


Link to post
Share on other sites
Max in montreal

Paulie, thanks a lot for helping me out, after a few minor adjustments, it is working perfectly. The adjustments were just an actual change of colors for the pixels...

I also want to cover an actual window, but still use the window, and everytime i clicked on it, the green rectangle would end up behind the window, and not cover it.

My solution was to put a winactivate in the loop, and it works fine. Would there be a better way to have done this? When creating the green rectangle, can we get it to always stay on top?

Anyways you were a great help, thanks.

Max

Share this post


Link to post
Share on other sites
Max in montreal

if i wanted to place the number 53 in there.....in the green rectangle...how would that work?

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  

×