rrandom Posted October 27, 2010 Share Posted October 27, 2010 Hello all, I run into strange problems with that small script for taking screenshots: ---------------------------------------------------------------------------------------------------- #Include <Clipboard.au3> #Include <ScreenCapture.au3> Opt('MustDeclareVars', 1) Local $HBITMAP = _ScreenCapture_Capture("", $CmdLine[1], $CmdLine[2], $CmdLine[3], $CmdLine[4]) _ClipBoard_Open("") _ClipBoard_Empty() _ClipBoard_SetDataEx($HBITMAP, $CF_BITMAP) _ClipBoard_Close() ----------------------------------------------------------------------------------------------------- When I call it via "myapp.exe 102 500 1010 590" it fails, but if I write the parameters directly into the script, it works ( Local $HBITMAP = _ScreenCapture_Capture("", 102, 500, 1010, 590) ) Thank you for any ideas, solving that problem rRAndoM Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 27, 2010 Moderators Share Posted October 27, 2010 rrandom,This is a real SWAG*, but try using Number to get the coordinates into integer format when passing then to the function: Local $HBITMAP = _ScreenCapture_Capture("", Number($CmdLine[1]), Number($CmdLine[2]), Number($CmdLine[3]), Number($CmdLine[4]))M23* SWAG - Scientific Wild Ass Guess, better than a straight WAG, but not by much! 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...
rrandom Posted October 27, 2010 Author Share Posted October 27, 2010 (edited) Melba23, Your SWAG rulez! But some strangeness keeps alive: f.e. for 0 0 100 100 the screenshot will be 101 x 101 (and so on); the screenshot is always 1px larger in x and y; why? Thank You randdoM Edited October 27, 2010 by rrandom Link to comment Share on other sites More sharing options...
UEZ Posted October 27, 2010 Share Posted October 27, 2010 Because it is zero based and you have to count also the zero. 0, 1, 2, 3, 4, 5, 6 ,7, 8, 9, 10 -> 11 numbers and not 10 Br, UEZ 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 October 27, 2010 Moderators Share Posted October 27, 2010 rrandom,Told you it was scientific! The commandline array returns strings and as the UDF does some comparisons between the coordinates as it starts up, I had the feeling we might be in a type-mismatch situation - nice to see I was right. On these occasions you might wonder why AutoIt does not have strong typing for its variables - personally I find the freedom of the single "variant" type worth the odd line when you have to specify precisely. As to the sizing error, this bug was reported as Ticket #1614 and is marked as fixed for the next release. 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...
rrandom Posted October 27, 2010 Author Share Posted October 27, 2010 ScreenCapture.au3 says: Parameters ....: $sFileName - Full path and extension of the image file ; $iLeft - X coordinate of the upper left corner of the rectangle ; $iTop - Y coordinate of the upper left corner of the rectangle ... When I want to capture 0/0 to 100/100 I have to set 1 1 100 100; Thank You again, rrANdOm 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