ShelbySue Posted June 7, 2005 Share Posted June 7, 2005 (edited) EDIT: This program is done, but some XP's having problems. See post below I have an old sign design program that doesn' t save a common image format nor convert so that I can email the image. I have to print it out, scan it, and then use it. I have practiced with Lazycat's scripts and know that I can do this dynamically. For the most part, the sign program displays the image at the same location, so I can enter the size. However, I would like to be able to select a region. Can I do this by creating a transparent window, except for the sides, and resize the window over the image? That would be the neatest solution since I can get the capture from one of LazyCat's scripts. I have searched the forum and found many ideas, but need some help with a WISE approach. Edited June 9, 2005 by ShelbySue Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 7, 2005 Share Posted June 7, 2005 My guess would be using something like MouseGetPos() in conjuction with a HotKeySet()? That way you could goto the top right press a key... it would record the pos and goto bottom right and press the button again to get the second recording. (or press a different button) Then use those 4 coords to create a 'Screen Capture' function of your creation.I hope I have helped you get along in your way of making this interesting program.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
ShelbySue Posted June 7, 2005 Author Share Posted June 7, 2005 (edited) Okay, Works great with hotkey/mousegetpos. Now, can I change the mouse pointer outside my window to show we are in "select" mode? EDIT: I am wondering if creating a window and setting it to transparent would allow me control of the entire screen? Edited June 7, 2005 by ShelbySue Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 7, 2005 Share Posted June 7, 2005 Okay, Works great with hotkey/mousegetpos.Now, can I change the mouse pointer outside my window to show we are in "select" mode?<{POST_SNAPBACK}>Yes GUISetCursor() Though that seems to need to a GUI. Not sure if you can get it to work in any window or just one that is created by AutoIt. It is certainly worth looking into though.The way I understand it in the helpfile you can if you can get the handle of the window you are in then you could possibly make it work with that window. Not positive on that. I will let you do the testing.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 7, 2005 Share Posted June 7, 2005 Okay, Works great with hotkey/mousegetpos.Now, can I change the mouse pointer outside my window to show we are in "select" mode?EDIT: I am wondering if creating a window and setting it to transparent would allow me control of the entire screen?<{POST_SNAPBACK}>What do you mean control of 'entire screen'? What else are you wanting?Based on my above reply creating a transparent GUI might be your best bet. You could still use the mouse stuff... if you wanted.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
ShelbySue Posted June 8, 2005 Author Share Posted June 8, 2005 I don't know how to reference another post, but this result is in Scrips and Scraps - ShelbySue Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 8, 2005 Share Posted June 8, 2005 Here it is. Excellent work btw. Nice idea. The link is http://www.autoitscript.com/forum/index.php?showtopic=12279(To do this so you know for future reference you use...)[ u r l = http//stuff ]link text[ / u r l ]Without the spaces of course JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
ShelbySue Posted June 9, 2005 Author Share Posted June 9, 2005 So XP machines do not display the tranparency correctly. Can anyone give any ideas? expandcollapse popup#region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> ;FileInstall("captdll.dll",@ScriptDir & "\") Const $ImageSaveLocation = "c:\screen.jpg" Dim $Button_1 Dim $Button_2 Dim $Button_3 Const $Select_Mode = 1 Const $View_Mode = 2 Const $sLeft = 0 Const $sTop = 1 Func __CreateSelectWindow() GuiCreate("MyGUI", @DesktopWidth, @DesktopHeight, -1, -1, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_EX_TOPMOST, _ $WS_EX_TRANSPARENT ) $Button_1 = GuiCtrlCreateButton("RESET", 30, 20, 75, 30) $Button_2 = GuiCtrlCreateButton("DONE", 105, 20, 75, 30) $Button_3 = GuiCtrlCreateButton("HELP", 180, 20, 75, 30) GUICtrlSetData($button_1,"NOT ACTIVE") GUICtrlSetState($Button_1,$GUI_SHOW) GUICtrlSetState($Button_2,$GUI_SHOW) GUICtrlSetState($Button_3,$GUI_SHOW) GUISetCursor(3) guisetstate() EndFunc func __CreateShowWindow() GuiCreate("MyGUI", @DesktopWidth, @DesktopHeight, -1, -1, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_EX_TOPMOST ) $Button_1 = GuiCtrlCreateButton("TRY AGAIN", 30, 20, 75, 30) $Button_2 = GuiCtrlCreateButton("DONE", 105, 20, 75, 30) $Button_3 = GuiCtrlCreateButton("HELP", 180, 20, 75, 30) GUICtrlSetState($Button_1,$GUI_SHOW) GUICtrlSetState($Button_2,$GUI_SHOW) GUICtrlSetState($Button_3,$GUI_SHOW) guisetstate() EndFunc $TopChosen = 0 $Status = 0; 1 = transparent 2 = view Func __SwitchToWIndow($w) if $w = $Select_Mode Then GUIDelete() __CreateSelectWindow() $Status = $w Else GUIDelete() __CreateShowWindow() $Status = $w EndIf EndFunc __SwitchtoWIndow($Select_Mode) While 1 if $TopChosen then $CurMouse = MouseGetPos() $OldMouse = $CurMouse EndIf $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $button_3; Help msgbox(0,"Capture 1.0","Select a corner of your image with the RIGHT Mouse Button. Then Select the OPPOSITE corner of your image with the RIGHT Mouse Button.") case $msg = $button_1 ; TryAgain or ReStart if GUICtrlRead("Button_1") = "TRY AGAIN" then __SwitchToWindow($Select_Mode) EndIf $TopChosen = 0 case $msg = $button_2 ; Done ExitLoop case $msg = $GUI_EVENT_SECONDARYDOWN if $status = $Select_Mode then if not $TopChosen Then $MouseTop = MouseGetPos() $TopChosen = 1 GUICtrlSetData($button_1,"RESTART") Else $MouseBot = MouseGetpos() ; Get the opposite corners. User can click on either corner as long as the other mouse ; click is in the opposite corner ; $ImageWide = $MouseBot[$sLeft] - $MouseTop[$sLeft] if abs($ImageWIde) <> $ImageWide then; $ImageLeft = $MouseBot[$sLeft] else $ImageLeft = $MouseTop[$sLeft] EndIf $ImageHi = $MouseBot[$sTop] - $MouseTop[$sTop] if abs($ImageHi) <> $ImageHi then; swap if needed $ImageTop = $MouseBot[$sTop] else $ImageTop = $MouseTop[$sTop] EndIf $ImageWide = abs($ImageWide) $ImageHi = abs($ImageHi) clipput( $ImageSaveLocation) DllCall("captdll.dll", "int", "CaptureRegion", "str", $ImageSaveLocation, "int", $ImageLeft, "int", $ImageTop, "int", $ImageWide, "int", $ImageHi, "int", 100) $TopChosen = 0 __SwitchToWindow($View_Mode) guictrlcreatepic( $ImageSaveLocation,$ImageLeft,$ImageTop,$ImageWide+8,$ImageHi+8,$WS_THICKFRAME ) EndIf endif; if $status = 1 then EndSelect if $TopChosen Then ; Draw Rectangle to Current Pos EndIf WEnd guidelete() if $status = $View_Mode Then msgbox(0,"Capture 1.0","File Name Was Copied To Clipboard - Use CTRL-V to paste to your program") Exit #endregion --- GuiBuilder generated code End --- 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