Jump to content

Recommended Posts

Posted

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

  • Moderators
Posted

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! :)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (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 by rrandom
Posted

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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

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
×
×
  • Create New...