Results 1 to 19 of 19

Thread: TakeScreenshotEx problem(s)

  1. #1
    Join Date
    Jul 2007
    Location
    Missouri
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default TakeScreenshotEx problem(s)

    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...

    SCAR Code:
    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?

  2. #2
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    Just use printscreen and make a bitmap in paint?
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  3. #3
    Join Date
    Jul 2007
    Location
    Missouri
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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

  4. #4
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

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


    ~Home

  5. #5
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by Home View Post
    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
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  6. #6
    Join Date
    Jul 2007
    Location
    Missouri
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ugh lol

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

  7. #7
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    I'm thinking someone messed up in SRL... Probably me, I'll take a look later.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  8. #8
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

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

  9. #9
    Join Date
    Jul 2007
    Location
    Missouri
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

  10. #10
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Did you test what I wrote?

  11. #11
    Join Date
    Jul 2007
    Location
    Missouri
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

  12. #12
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Fixed it. Just edit the current one in SRL with this one:
    SCAR Code:
    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;

  13. #13
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    ^ .diff, pl0x.

  14. #14
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    ^ .diff, pl0x.
    Code:
    @@ -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

  15. #15
    Join Date
    Jul 2007
    Location
    Missouri
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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

  16. #16
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Worked for me.....

  17. #17
    Join Date
    Jul 2007
    Location
    Missouri
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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.

  18. #18
    Join Date
    Jul 2007
    Location
    Missouri
    Posts
    318
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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

  19. #19
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    No problem

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •