myspacee Posted April 23, 2009 Share Posted April 23, 2009 hello, search for a function to drawn transparent square where i want to make in evidence portion od my desktop. think about GDI but anyone can suggest me a script to use... anyone can help me ? m. Link to comment Share on other sites More sharing options...
Skruge Posted April 24, 2009 Share Posted April 24, 2009 search for a function to drawn transparent square where i want to make in evidence portion od my desktop.I'm not sure what you mean by "evidence portion", but have you tried making a transparent GUI?If it's not the effect you're looking for, please describe the difference. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
martin Posted April 24, 2009 Share Posted April 24, 2009 hello,search for a function to drawn transparent square where i want to make in evidence portion od my desktop.think about GDI but anyone can suggest me a script to use...anyone can help me ?m.There are lots of ways. I would have thought searching would find them but this is one way. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
myspacee Posted April 24, 2009 Author Share Posted April 24, 2009 I need this : expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #Include <GDIPlus.au3> #Include <Misc.au3> $dll = DllOpen("user32.dll") HotKeySet("{ESC}", "Terminate") while 1 if _IsPressed("67", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 10, @DesktopHeight - (@desktopheight - 700), 80) ElseIf _IsPressed("68", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 90, @DesktopHeight - (@desktopheight - 700), 80) ElseIf _IsPressed("69", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 170, @DesktopHeight - (@desktopheight - 700), 80) ElseIf _IsPressed("64", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 10, @DesktopHeight - (@desktopheight - 800), 80) ElseIf _IsPressed("65", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 90, @DesktopHeight - (@desktopheight - 800), 80) ElseIf _IsPressed("66", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 170, @DesktopHeight - (@desktopheight - 800), 80) ElseIf _IsPressed("61", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 10, @DesktopHeight - (@desktopheight - 900), 80) ElseIf _IsPressed("62", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 90, @DesktopHeight - (@desktopheight - 900), 80) ElseIf _IsPressed("63", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 170, @DesktopHeight - (@desktopheight - 900), 80) EndIf sleep(10) WEnd ;------------------------------------- FUNCTIONS Func Terminate() Exit 0 EndFunc func my_square($start_x, $start_y, $mylenght) _GDIPlus_Startup () $hDC = _WinAPI_GetWindowDC(0) $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) $Color = 0xFF000000 $hPen = _GDIPlus_PenCreate($Color,2) _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y, $start_x + $mylenght, $start_y, $hPen);oriz UP _GDIPlus_GraphicsDrawLine($hGraphic, $start_x + $mylenght, $start_y, $start_x + $mylenght, $start_y + $mylenght, $hPen);right _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y + $mylenght, $start_x + $mylenght, $start_y + $mylenght, $hPen);oriz down _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y, $start_x, $start_y + $mylenght, $hPen);left $Color += Hex(2) _GDIPlus_PenSetColor($hPen, $Color) Sleep(250) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN) _WinAPI_ReleaseDC(0, $hDC) _GDIPlus_Shutdown() _GDIPlus_Shutdown() EndFunc but more stable, without flickering, and with windowsontop feature, But can't solve these issue, how improve it ? m. Link to comment Share on other sites More sharing options...
martin Posted April 24, 2009 Share Posted April 24, 2009 I need this : expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #Include <GDIPlus.au3> #Include <Misc.au3> $dll = DllOpen("user32.dll") HotKeySet("{ESC}", "Terminate") while 1 if _IsPressed("67", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 10, @DesktopHeight - (@desktopheight - 700), 80) ElseIf _IsPressed("68", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 90, @DesktopHeight - (@desktopheight - 700), 80) ElseIf _IsPressed("69", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 170, @DesktopHeight - (@desktopheight - 700), 80) ElseIf _IsPressed("64", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 10, @DesktopHeight - (@desktopheight - 800), 80) ElseIf _IsPressed("65", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 90, @DesktopHeight - (@desktopheight - 800), 80) ElseIf _IsPressed("66", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 170, @DesktopHeight - (@desktopheight - 800), 80) ElseIf _IsPressed("61", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 10, @DesktopHeight - (@desktopheight - 900), 80) ElseIf _IsPressed("62", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 90, @DesktopHeight - (@desktopheight - 900), 80) ElseIf _IsPressed("63", $dll) Then my_square(@DesktopWidth - (@DesktopWidth / 1.5) + 170, @DesktopHeight - (@desktopheight - 900), 80) EndIf sleep(10) WEnd ;------------------------------------- FUNCTIONS Func Terminate() Exit 0 EndFunc func my_square($start_x, $start_y, $mylenght) _GDIPlus_Startup () $hDC = _WinAPI_GetWindowDC(0) $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) $Color = 0xFF000000 $hPen = _GDIPlus_PenCreate($Color,2) _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y, $start_x + $mylenght, $start_y, $hPen);oriz UP _GDIPlus_GraphicsDrawLine($hGraphic, $start_x + $mylenght, $start_y, $start_x + $mylenght, $start_y + $mylenght, $hPen);right _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y + $mylenght, $start_x + $mylenght, $start_y + $mylenght, $hPen);oriz down _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y, $start_x, $start_y + $mylenght, $hPen);left $Color += Hex(2) _GDIPlus_PenSetColor($hPen, $Color) Sleep(250) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN) _WinAPI_ReleaseDC(0, $hDC) _GDIPlus_Shutdown() _GDIPlus_Shutdown() EndFunc but more stable, without flickering, and with windowsontop feature, But can't solve these issue, how improve it ? m.It flickers because you repeatedly draw the square all the time the key is pressed. So pass the value of the key pressed to your function as well as the other details, draw it once, and in your function wait untill that key is no longer pressed then delete the graphic. If you want the square to be on top then don't draw on the desktop but create a popup window like in the example I gave a link to before. Set the style to be on top. Then you can draw a line or a square and clear it all whenever you want by drawing a large rectangle in the transparent colour. GDI+ has problems drawing transparent bits as far as I can understand it but a graphic does not. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
myspacee Posted April 24, 2009 Author Share Posted April 24, 2009 thank you for attention.I try to make Autoit version of twostick a novel text entry method for game controllers. Post my script and hope someone can help me to go some step forwardhttp://www.megaupload.com/?d=J743869SThis version is modified for mouse use, but real one works with normal joypadAs you can see from script left analogic PAD is done, but now i seacrh a solution tomake in evidence in 3x3 grid only one square when right analogic PAD choose letter.I'm stuck 'cause GDI is too hard to use for me,maybe skilled Autoit user can suggest me new idea,Thank you all,m. Link to comment Share on other sites More sharing options...
martin Posted April 24, 2009 Share Posted April 24, 2009 (edited) thank you for attention. I try to make Autoit version of twostick a novel text entry method for game controllers. Post my script and hope someone can help me to go some step forward http://www.megaupload.com/?d=J743869S This version is modified for mouse use, but real one works with normal joypad As you can see from script left analogic PAD is done, but now i seacrh a solution to make in evidence in 3x3 grid only one square when right analogic PAD choose letter. I'm stuck 'cause GDI is too hard to use for me, maybe skilled Autoit user can suggest me new idea, Thank you all, m.The twostick is new to me, but maybe that's because I don't play games. What is the reason fo rmaking something like that though if you haven't got 2 joysticks? If you have a mouse a virtual keyboard would be better wouldn't it? I would agree that GDI is not so easy, but to create a layout like you want is actually very easy because you don't need any graphics at all. Try this expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form3 = GUICreate("Form3", 100, 99, 228, 169, $WS_POPUP) Global $Label1 = GUICtrlCreateLabel("a", 2, 2, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label2 = GUICtrlCreateLabel("b", 35, 2, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label3 = GUICtrlCreateLabel("c", 68, 2, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label4 = GUICtrlCreateLabel("", 35, 34, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFF00) Global $Label5 = GUICtrlCreateLabel("", 2, 34, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label6 = GUICtrlCreateLabel("d", 2, 66, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label7 = GUICtrlCreateLabel("", 68, 34, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label8 = GUICtrlCreateLabel("", 35, 66, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label9 = GUICtrlCreateLabel("e", 68, 66, 30, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) ;use labels for the lines between Global $Label10 = GUICtrlCreateLabel("", 2, 0, 97, 2) GUICtrlSetBkColor(-1, 0x000000) Global $Label11 = GUICtrlCreateLabel("", 1, 32, 97, 2) GUICtrlSetBkColor(-1, 0x000000) Global $Label12 = GUICtrlCreateLabel("", 1, 64, 97, 2) GUICtrlSetBkColor(-1, 0x000000) Global $Label13 = GUICtrlCreateLabel("", 2, 97, 97, 2) GUICtrlSetBkColor(-1, 0x000000) Global $Label14 = GUICtrlCreateLabel("Label14", 0, 0, 2, 98) GUICtrlSetBkColor(-1, 0x000000) Global $Label15 = GUICtrlCreateLabel("Label14", 33, 1, 2, 97) GUICtrlSetBkColor(-1, 0x000000) Global $Label16 = GUICtrlCreateLabel("Label14", 65, 1, 2, 97) GUICtrlSetBkColor(-1, 0x000000) Global $Label17 = GUICtrlCreateLabel("Label14", 98, 0, 2, 98) GUICtrlSetBkColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $label1;the top left Exit Case $label7;the middle right GUICtrlSetData($label1,'A') GUICtrlSetColor($label1,0xff0000) GUICtrlSetBkColor($label3,0xff0000) EndSwitch WEnd Using labels means you can respond when one is clicked on, (as clicking on 'a' closes my example) you can easily change the colour of the label or its text (click the middle right label) and you can use Koda to design it all like I did. Edited April 24, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
myspacee Posted April 24, 2009 Author Share Posted April 24, 2009 thank you again for reply, the reason for making something like that is that lot of media center user use a joypad as remote for their system. You can do all with a joypad, play, surf internet, use media center, there are script and program for everything but not exist a standard to write text. Twostick application is think mainly for disable people but i want to implement it in Autoit to give opportunity to everyone to add a more value to joystick. Not only for gamers, but for all people that want to use only one device for all. In your script event are driven by mouse click, how i can modify to other events ? (maybe _IsPressed() ) Thank you, really, m. Link to comment Share on other sites More sharing options...
martin Posted April 24, 2009 Share Posted April 24, 2009 ... In your script event are driven by mouse click, how i can modify to other events ? (maybe _IsPressed() ) Thank you, really, m.I don't really know enough about what you are doing to give a good answer. If you are using a mouse then you can click, if you are using a joystick then isn't there a button which can be detected with _IsPressed? If you have a path between the buttons then you could make it so that just moving onto a button is the same as clicking it. Like this expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form3 = GUICreate("Form3", 100, 99, 228, 169, $WS_POPUP) Global $Label1 = GUICtrlCreateLabel("a", 2, 2, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label2 = GUICtrlCreateLabel("b", 35, 2, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label3 = GUICtrlCreateLabel("c", 68, 2, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label4 = GUICtrlCreateLabel("", 35, 34, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFF00) Global $Label5 = GUICtrlCreateLabel("", 2, 34, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label6 = GUICtrlCreateLabel("d", 2, 66, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label7 = GUICtrlCreateLabel("", 68, 34, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label8 = GUICtrlCreateLabel("Case", 35, 66, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label9 = GUICtrlCreateLabel("e", 68, 66, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) Global $Label10 = GUICtrlCreateLabel("", 2, 0, 97, 2) GUICtrlSetBkColor(-1, 0x000000) Global $Label11 = GUICtrlCreateLabel("", 1, 32, 97, 2) GUICtrlSetBkColor(-1, 0x000000) Global $Label12 = GUICtrlCreateLabel("", 1, 64, 97, 2) GUICtrlSetBkColor(-1, 0x000000) Global $Label13 = GUICtrlCreateLabel("", 2, 97, 97, 2) GUICtrlSetBkColor(-1, 0x000000) Global $Label14 = GUICtrlCreateLabel("Label14", 0, 0, 2, 98) GUICtrlSetBkColor(-1, 0x000000) Global $Label15 = GUICtrlCreateLabel("Label14", 33, 1, 2, 97) GUICtrlSetBkColor(-1, 0x000000) Global $Label16 = GUICtrlCreateLabel("Label14", 65, 1, 2, 97) GUICtrlSetBkColor(-1, 0x000000) Global $Label17 = GUICtrlCreateLabel("Label14", 98, 0, 2, 98) GUICtrlSetBkColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $lastci4 = -1 $Ucase = False While 1 $ci = GUIGetCursorInfo() If Not @error And $lastci4 <> $ci[4] Then $lastci4 = $ci[4] Switch $ci[4] ; Switch $nMsg Case $GUI_EVENT_CLOSE, $Label1 Exit Case $Label7 GUICtrlSetData($Label1, 'A') GUICtrlSetColor($Label1, 0xff0000) GUICtrlSetBkColor($Label3, 0xff0000) Case $Label8 If $Ucase Then GUICtrlSetData($Label1, "a") GUICtrlSetData($Label2, "b") GUICtrlSetData($Label3, "c") Else GUICtrlSetData($Label1, "A") GUICtrlSetData($Label2, "B") GUICtrlSetData($Label3, "C") EndIf $Ucase = Not $Ucase EndSwitch EndIf WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now