SRL Archive - OSR Help

TakeScreenshotEx problem(s)


Illkillutill

2010-05-11 03:26:56

Ok so i'm trying to take a picture of a single box within a client… and thought thats exactly what this was for… so i tried it like so…

program New;
{.include srl/srl.scar}
{.include srl/srl/misc/debug.scar}


procedure TakeShot;
begin
TakeScreenShotEx('C:\Users\Owner\Documents\pics', 208, 387, 266, 424);
end;


begin
SetupSRL;
TakeShot;
end.


it takes the picture and saves it, but when it does, it takes it at dimensions 0, 0, blah, blah instead of the dimensions in the function…

what's wrong?

cycrosism

2010-05-11 03:46:26

Just use printscreen and make a bitmap in paint?

Illkillutill

2010-05-11 03:50:02

Well if it was that simple i would :P

the thing is i want the script to take the picture on its own so i dont have to do that…

i need it to save the bmp, and send it to my email :P

Home

2010-05-11 07:01:20

Hmm, it should work :S Just remember that your must have a client selected. :)


~Home

cycrosism

2010-05-11 07:55:21

From: Home
Hmm, it should work :S Just remember that your must have a client selected. :)


~Home


I think its a problem in the actual procedure/function .. I just tested it out and it didn't work (with the newest scar + srl-opendev). I focused it on my backround and it took a screenshot from 0,0

Illkillutill

2010-05-11 11:27:12

Ugh lol

I'll look and see what might be wrong, but doubt I'd be able to fix anything…

Nava2

2010-05-11 11:52:25

I'm thinking someone messed up in SRL… Probably me, I'll take a look later.

Gu3st...

2010-05-11 15:43:36

TakeScreenShotEx('C:\Users\Owner\Documents\test12345.bmp', 208, 387, 266, 424);

Illkillutill

2010-05-12 18:29:26

Any luck? I have no idea what would be causing it…

Gu3st...

2010-05-12 19:12:49

Did you test what I wrote?

Illkillutill

2010-05-12 19:21:24

Not at the time, but I just did and it still isn't working… i don't know what would cause that.

Gu3st...

2010-05-13 05:57:01

Fixed it. Just edit the current one in SRL with this one:
procedure TakeScreenshotEx(Path: string; X1, Y1, X2, Y2: Integer);
var
BMP: Integer;
begin
{$ifdef Simba}
BMP := BitmapFromClient(X1,Y1,X2,Y2);
{$else}
BMP := BitmapFromString(X2 - X1, Y2 - Y1, '');
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp), X1, Y1, X2, Y2, 0, 0, X2 - X1, Y2 - Y1);
{$endif}
if (Pos('.bmp', Path) = 0) then
if (Path = '') then
Path := AppPath + TheDate(3) + ' - ' + MsToTime(GetTimeRunning, Time_Abbrev) + '.bmp'
else
Path := Path + '.bmp';
if (FileExists(Path)) then
begin
srl_Warn('TakeScreenShotEx', 'File "' + Path + '" already exists!', warn_AllVersions);
SetLength(Path, Length(Path) - 4);
Path := Path + ' ' + IntToStr(GetTimeRunning) + '.bmp';
srl_Warn('TakeScreenShotEx', 'Renamed screenshot file path to "' + Path + '"', warn_AllVersions);
end;
try
SaveBitmap(bmp, Path);
srl_Warn('TakeScreenShotEx', 'Screenshot saved successfully to ' + Path, warn_Debug);
except
srl_Warn('TakeScreenShotEx', 'Failed saving screenshot to ' + Path, warn_AllVersions);
finally
FreeBitmap(bmp);
end;
end;

i luffs yeww

2010-05-13 06:51:25

^ .diff, pl0x.

Gu3st...

2010-05-13 06:56:22

From: i luffs yeww
^ .diff, pl0x.


@@ -25,7 +25,7 @@
BMP := BitmapFromClient(X1,Y1,X2,Y2);
{$else}
BMP := BitmapFromString(X2 - X1, Y2 - Y1, '');
- SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp), 0, 0, X2 - X1, Y2 - Y1, 0, 0, X2 - X1, Y2 - Y1);
+ SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp), X1, Y1, X2, Y2, 0, 0, X2 - X1, Y2 - Y1);
{$endif}
if (Pos('.bmp', Path) = 0) then
if (Path = '') then

Illkillutill

2010-05-13 12:35:51

Yea, it still doesn't work, for me at least, not sure about anyone else. just continues to take a shot of the top left corner of any program… hmm

Gu3st...

2010-05-13 13:12:50

Worked for me…..

Illkillutill

2010-05-13 13:18:00

hmm… lol

maybe i didn't do something right, who knows, i could have forgot to save it before running it lol, i'll try again.

Illkillutill

2010-05-13 13:21:23

w00t w00t!

I just put it into the wrong debug file, i have multiple srl version because i have to manually do them and i just didn't get rid of the other one, thanks so much man :)

u da bomb

Gu3st...

2010-05-13 14:25:36

No problem :)