1905russell Posted November 27, 2016 Share Posted November 27, 2016 Hello wise people of the forums – long time since I’ve asked for assistance – it’s me, the Autoit dabbling accountant who is not a programmer (my standard disclaimer). Is there somewhere in the forums that I can find a snippet that creates a moving dashstyle rectangle, similar to the one displayed when copying (“^C”) in excel? I’ve searched, but surprisingly could not find. Your help is greatly appreciated. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 27, 2016 Moderators Share Posted November 27, 2016 @1905russell are you actually trying to copy data in Excel, or just looking for the effect? If the latter, is this in a GUI, web app, etc.? The more information you provide the better we are able to assist. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
1905russell Posted November 27, 2016 Author Share Posted November 27, 2016 (edited) Thanks for the quick response JLogan3o13 - I'm just looking for the effect. I'm making a little movie to illustrate a software system that I have finally received the US patent for. The movie uses a bunch of HotKeySets to fake what I can't program (while capturing the screen sequences). This dash-rectangle would be HotkeySet to display at a selected x,y on top of any image displayed until HotKeySet turns it off and the recorded scene capture is over. Am I making sense? Edited November 27, 2016 by 1905russell clarity Link to comment Share on other sites More sharing options...
1905russell Posted February 17, 2017 Author Share Posted February 17, 2017 Well obviously the above requested information I provided produced no help at all. So I tried to get a function written via Upwork/Freelancer (in Autoit or an exe) and I was ripped off by being charged for hours and hours (by mistake I was told) and nothing was ever produced. Upwork/Freelancer refunded me everything they had automatically taken from my credit card. I know there are Autoit members that can do this easily. It’s for illustration purposes, please. There are many examples of code out there written in #C and other languages and the “marching ants” concept has been around for decades. I have put together code using two approaches to create dash rectangles (with a hole) using forum snippets but they are static without animation. One uses _WinAPI_ExtCreatePen with $PS_DASH and the other uses _WinAPI_LineDDA. I have also tried to simply use splash image (and text) and then speed up the movie but it looks awful. I’m not a programmer. I will donate again to Autoit or I will pay someone to help me please. My email for this project is rl@transaxy.com Link to comment Share on other sites More sharing options...
Subz Posted February 17, 2017 Share Posted February 17, 2017 Maybe some of @UEZ code can help, hes a master of GdiPlus especially animations. Link to comment Share on other sites More sharing options...
1905russell Posted February 17, 2017 Author Share Posted February 17, 2017 Thanks Subz - I truly appreciate this - I had not found this before. I'll go through these examples and maybe I'll figure out something. I know UEZ is the animation expert and he could whip up something in seconds. There are others who are also pretty good but alas I think they find it infra dig to deal with me the accountant. Link to comment Share on other sites More sharing options...
Gianni Posted February 18, 2017 Share Posted February 18, 2017 a possible way... expandcollapse popup#include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() ; declare parameters to set the dashed rectangle; (out of screen and hidden at startup) Global $show = 0, $xPosition = @DesktopWidth, $yPosition = @DesktopHeight, $Width = 10, $Height = 10 Global $RectColor = 0xFFFF0000 ; FFRRGGBB Global $PixelThickness = 4 DashEdge() ; initialize the rectangle AdlibRegister("DashEdge", 100) ; set the refresh rate ; Your scipt here.... Local $Timer = TimerInit() Do ; ... when you need a dotted rectangle somewhere on the screen ; just set the following variables accordingly ... ; ; here we use random values $show = 1 $xPosition = Random(10, 600, 1) $yPosition = Random(10, 600, 1) $Width = Random(200, 500, 1) $Height = Random(150, 400, 1) $RectColor = Random(0, 16777215, 1) + 4278190080 ; 0xFF000000 to 0xFFFFFFFF Sleep(1500) Until TimerDiff($Timer) >= 10000 ; show demo for ten seconds ; The end $show = -1 ; set -1 to dispose all DashEdge() ; Clean up GDI+ resources Func DashEdge() ; following static variables are generated and initialized only the first time this function is called Local Static $AlphaKey = 0xFF0FF0FF ; this color will set background transparent (can be changed) Local Static $hGUI = GUICreate("", $Width, $Height, $xPosition, $yPosition, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_TRANSPARENT) Local Static $Dummy = _WinAPI_SetLayeredWindowAttributes($hGUI, $AlphaKey, 0, $LWA_COLORKEY) Local Static $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Local Static $hPen = _GDIPlus_PenCreate($RectColor, $PixelThickness) _GDIPlus_PenSetColor($hPen, $RectColor) ; dots and dashes alternate If _GDIPlus_PenGetDashStyle($hPen) = $GDIP_DASHSTYLEDOT Then _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDASH) Else _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDOT) EndIf Local $aWinPos = WinGetPos($hGUI) ; check if we need to move the rectangle If $aWinPos[0] <> $xPosition Or $aWinPos[1] <> $yPosition Or $aWinPos[2] <> $Width Or $aWinPos[3] <> $Height Then _GDIPlus_GraphicsDispose($hGraphic) WinMove($hGUI, "", $xPosition, $yPosition, $Width, $Height) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) EndIf ; show or hide dashes as from the $show variable If $show = 1 Then GUISetState(@SW_SHOW, $hGUI) If $show = 0 Then GUISetState(@SW_HIDE, $hGUI) _GDIPlus_GraphicsClear($hGraphic, $AlphaKey) ; erase rect _GDIPlus_GraphicsDrawRect($hGraphic, 0, 0, $Width, $Height, $hPen) ; draw again If $show = -1 Then ; we have to stop? AdlibUnRegister("DashEdge") _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() WinKill($hGUI) EndIf EndFunc ;==>DashEdge Subz 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
1905russell Posted February 18, 2017 Author Share Posted February 18, 2017 Yes Yes this will work – Chimp you’re a Champ. Unfortunately I’m away from my main computer for a week and am now using a limited laptop. I’m going to massage your script to run in my mini-movie but I can see that for sure it will work. Thanks to you, my weeks of frustration and going bananas (pun intended) are over. I can’t wait to get back home to modify your code. Thanks again and Abadabadaba Link to comment Share on other sites More sharing options...
UEZ Posted February 18, 2017 Share Posted February 18, 2017 Slightly modified version from Chimp's code: expandcollapse popup#include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() ; declare parameters to set the dashed rectangle; (out of screen and hidden at startup) Global $show = 0, $xPosition = @DesktopWidth, $yPosition = @DesktopHeight, $Width = 10, $Height = 10 Global $RectColor = 0xFFFF0000 ; FFRRGGBB Global $PixelThickness = 4 DashEdge() ; initialize the rectangle AdlibRegister("DashEdge", 100) ; set the refresh rate ; Your scipt here.... Local $Timer = TimerInit() Do ; ... when you need a dotted rectangle somewhere on the screen ; just set the following variables accordingly ... ; ; here we use random values $show = 1 $xPosition = Random(10, 600, 1) $yPosition = Random(10, 600, 1) $Width = Random(200, 500, 1) $Height = Random(150, 400, 1) $RectColor = Random(0, 16777215, 1) + 4278190080 ; 0xFF000000 to 0xFFFFFFFF Sleep(1500) Until TimerDiff($Timer) >= 10000 ; show demo for ten seconds ; The end $show = -1 ; set -1 to dispose all DashEdge() ; Clean up GDI+ resources Func DashEdge() ; following static variables are generated and initialized only the first time this function is called Local Static $AlphaKey = 0xFF0FF0FF ; this color will set background transparent (can be changed) Local Static $hGUI = GUICreate("", $Width, $Height, $xPosition, $yPosition, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_TRANSPARENT) Local Static $Dummy = _WinAPI_SetLayeredWindowAttributes($hGUI, $AlphaKey, 0, $LWA_COLORKEY) Local Static $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Local Static $hPen = _GDIPlus_PenCreate($RectColor, $PixelThickness) Local Static $fOffset = 0 _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDOT) _GDIPlus_PenSetColor($hPen, $RectColor) DllCall($__g_hGDIPDll, "int", "GdipSetPenDashOffset", "handle", $hPen, "float", $fOffset) ;this is the key for the animated dotted line ;-) Local $aWinPos = WinGetPos($hGUI) ; check if we need to move the rectangle If $aWinPos[0] <> $xPosition Or $aWinPos[1] <> $yPosition Or $aWinPos[2] <> $Width Or $aWinPos[3] <> $Height Then _GDIPlus_GraphicsDispose($hGraphic) WinMove($hGUI, "", $xPosition, $yPosition, $Width, $Height) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) EndIf ; show or hide dashes as from the $show variable If $show = 1 Then GUISetState(@SW_SHOW, $hGUI) If $show = 0 Then GUISetState(@SW_HIDE, $hGUI) _GDIPlus_GraphicsClear($hGraphic, $AlphaKey) ; erase rect _GDIPlus_GraphicsDrawRect($hGraphic, 0, 0, $Width, $Height, $hPen) ; draw again $fOffset += 0.5 If $show = -1 Then ; we have to stop? AdlibUnRegister("DashEdge") _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() WinKill($hGUI) EndIf EndFunc ;==>DashEdge Subz and Gianni 2 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Gianni Posted February 19, 2017 Share Posted February 19, 2017 (edited) 1 hour ago, 1905russell said: Yes Yes this will work – Chimp you’re a Champ. Unfortunately I’m away from my main computer for a week and am now using a limited laptop. I’m going to massage your script to run in my mini-movie but I can see that for sure it will work. Thanks to you, my weeks of frustration and going bananas (pun intended) are over. I can’t wait to get back home to modify your code. Thanks again and Abadabadaba You are welcome 46 minutes ago, UEZ said: Slightly modified version from Chimp's code: .... the master's touch makes the difference!... p.s.@UEZ, the _GDIPlus_PenSetDashStyle allows the $GDIP_DASHSTYLECUSTOM parameter as a user-defined, custom dashed line, but I've not found how to set the custom dashed line. Here (http://csharphelper.com/blog/2015/02/draw-lines-with-custom-dash-patterns-in-c/) there is a brief explanation on how to setup the custom dashed line, but I don't know how to do it in AutoIt. Do you know how to make use of the $GDIP_DASHSTYLECUSTOM parameter?? Thank You Edited February 19, 2017 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
UEZ Posted February 19, 2017 Share Posted February 19, 2017 @Chimp - that could be done this way: Local Static $fOffset = 0 _GDIPlus_PenSetColor($hPen, $RectColor) Local $iCount = 4, $tArray = DllStructCreate("float;float;float;float") DllStructSetData($tArray, 1, 5.0) ;dash length DllStructSetData($tArray, 2, 2.0) ;space length DllStructSetData($tArray, 3, 15.0) ;dash length DllStructSetData($tArray, 4, 4.0) ;space length DllCall($__g_hGDIPDll, "int", "GdipSetPenDashArray", "handle", $hPen, "struct*", $tArray, "long", $iCount) ;This method will set the DashStyle enumeration for this Pen object to DashStyleCustom. DllCall($__g_hGDIPDll, "int", "GdipSetPenDashOffset", "handle", $hPen, "float", $fOffset) ;this is the key for the animated dotted line ;-) Gianni 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Gianni Posted February 19, 2017 Share Posted February 19, 2017 @UEZ, ... it works. Very interesting, it allows nice effects. Thank You!. Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
UEZ Posted February 19, 2017 Share Posted February 19, 2017 1 hour ago, Chimp said: @UEZ, ... it works. Very interesting, it allows nice effects. Thank You!. Prego. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 19, 2017 Moderators Share Posted February 19, 2017 UEZ, Bravo! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
1905russell Posted February 20, 2017 Author Share Posted February 20, 2017 @UEZ I have always been in awe of your work and was blown away by the fact that you would take an interest in assisting me by expanding on Chimp’s code with your brilliance. I’m so excited and have ants in my pants to get back home to watch them march in my mini-movie. This week, if time allows, I hope to revisit the museum of your inspirer in St Petersburg. He was innovating rock star with his art, as you are with yours. Thank you so much. Link to comment Share on other sites More sharing options...
mikell Posted February 20, 2017 Share Posted February 20, 2017 How true ! (both assertions) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 20, 2017 Moderators Share Posted February 20, 2017 1905russell, I agree with both of your assertions: UEZ is indeed our GDI guru and the St Pete's Dali museum is one of my favourites too. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
UEZ Posted February 21, 2017 Share Posted February 21, 2017 Regarding assertion 1: guys, keep well grounded - no need to exaggerate. Assertion 2: well, maybe one day I will be in St. Petersburg to visit my avatar's art... Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ 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