Jump to content

Issue with ScreenCapture_Capture


 Share

Recommended Posts

Hi Everybody,

I'm facing a strange issue ( I guess it's a stupide mistake but can't found it).

I'm reading parameter from an .ini file. And one of the value is the cause of the problem ($right) so I don't have my output picture.

here is the code:

#Include <ScreenCapture.au3>

$iniFile="Win.ini"

if not FileExists($iniFile) Then

msgbox(0,"","The ini file could not be found at following location: " & $iniFile)

exit

EndIf

$top = IniRead($iniFile, "Win", "win_top", "No_value")

If $top = "No_value" Then

msgbox(0,"Error","Problem reading $top")

Exit 0

EndIf

$bottom = IniRead($iniFile, "Win", "win_bottom", "No_value")

If $bottom = "No_value" Then

msgbox(0,"Error","Problem reading $bottom")

Exit 0

EndIf

$left = IniRead($iniFile, "Win", "win_left", "No_value")

If $left = "No_value" Then

msgbox(0,"Error","Problem reading $left")

Exit 0

EndIf

$right = IniRead($iniFile, "Win", "win_right", "No_value")

If $right = "No_value" Then

msgbox(0,"Error","Problem reading $right")

Exit 0

EndIf

$checksum = PixelChecksum($left, $top, $right, $bottom, 1)

_ScreenCapture_Capture(@MyDocumentsDir & "\" & $checksum & ".bmp", $left, $top, $right, $bottom, False)

here is the .ini file

[Win]

win_top=127

win_bottom=147

win_left=980

win_right=1040

Some investigations I did.

if I put $right=1040 before the screencapture I have my picture. Just to be sure I put if $right <> 1040 then $right = 1050 same error no output

as the iniread is working fine.

second testif I reduce right and left by 100 (right became less than 1000) it's working fine too.

If you can help me

Thanks

Monky

Link to comment
Share on other sites

Original Code:

#Include <ScreenCapture.au3>

$iniFile="Win.ini"
  
if not FileExists($iniFile) Then  
    msgbox(0,"","The ini file could not be found at following location: " & $iniFile)  
    exit  
EndIf

$top = IniRead($iniFile, "Win", "win_top", "No_value")


If $top = "No_value" Then
    msgbox(0,"Error","Problem reading $top")  
    Exit 0
EndIf


$bottom = IniRead($iniFile, "Win", "win_bottom", "No_value")
If $bottom = "No_value" Then
    msgbox(0,"Error","Problem reading $bottom")  
    Exit 0
EndIf


$left = IniRead($iniFile, "Win", "win_left", "No_value")
If $left = "No_value" Then
    msgbox(0,"Error","Problem reading $left")  
    Exit 0
EndIf


$right = IniRead($iniFile, "Win", "win_right", "No_value")
If $right = "No_value" Then
    msgbox(0,"Error","Problem reading $right")  
    Exit 0
EndIf


$checksum = PixelChecksum($left, $top, $right, $bottom, 1)


_ScreenCapture_Capture(@MyDocumentsDir & "\" & $checksum & ".bmp", $left, $top, $right, $bottom, False)

Ini File:

[Win]
win_top=127
win_bottom=147
win_left=980
win_right=1040

Reformated with code tags

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

:( _ScreenCapture_Capture(@MyDocumentsDir & "\" & $checksum & ".bmp", Number($left), Number($top), Number($right), Number($bottom), True)

John whas faster :)

I think that Number is better than Int if you dont want to return integer of that number that is

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...