SRL Archive - Help

How to make Simba take screenshot?


joedeagan

2012-03-28 08:44:19

How do I make script that takes screenshot of the screen and save it in a folder? I want the script to take screen shot whenever it finds a color on at a certain area.

Can Simba copy and paste a text on FireFox browser and save it somewhere?

Thanks.

Home

2012-03-28 09:03:27

From: joedeagan
How do I make script that takes screenshot of the screen and save it in a folder? I want the script to take screen shot whenever it finds a color on at a certain area.

Can Simba copy and paste a text on FireFox browser and save it somewhere?

Thanks.


SaveScreenshot();


~Home

joedeagan

2012-03-28 09:12:20

From: Home
SaveScreenshot();


~Home

It said:
[Error] (33:23): Invalid number of parameters at line 32
Compiling failed.


Do I need to put anything in ()?

Thanks.

Valithor

2012-03-28 09:22:58

Yes you would need to put something in between the parenthesis. You need to specify the file name you want to save it to. You do that by writing it as a string.
SaveScreenshot('FileName');

joedeagan

2012-03-28 12:53:32

Ok thanks for the help. I guess it worked, it successfully compiled. But where is the screen shot saved to? Where is the folder?

at the top, i defined the variable between the (), which is the file name:
test: String;

and I put SaveScreenshot(test);

Now I don't know where the screenshot is located at. And also, can i take multiple screenshots, each with different names.

Thanks.

Abu

2012-03-28 12:56:30

Make a folder where you want the screenshot to be saved in.

Then put in that folder name….

:duh:

joedeagan

2012-03-28 14:02:30

From: abu_jwka
Make a folder where you want the screenshot to be saved in.

Then put in that folder name….

:duh:


How do i put in that folder name? Where is the default location of saved screenshots?


Can you write me a sample how I should put this? Thanks.

J J

2012-03-28 14:06:38

Make a new folder called Simba Screenshots right on your primary HDD.

C:\Simba Screenshots

Abu

2012-03-28 14:11:20

Oh my I'm guessing you don't know much about computers….

Oh well.

First, Go to 'My Computer'

Then in the address bar type in C:\Simba and hit Enter

Right-click the white background and click New -> Folder

Name this folder Screenshots.

Now in Simba, put in the function:
SaveScreenshot('C:\Simba\Screenshots);

Every time you take a screenshot, it will be saved in that folder you just made.

Abu

2012-03-28 14:19:43

You have to name where the Folder is located!!!

Go to your folder you just created, open it. Now look at the address bar, copy and paste that into the function.

And remember to put quotation marks '' around the folder when you paste it in the brackets.


EDIT: You clearly didn't follow the instructions I gave you in the above post :|


EDIT2: This is not a double-post, user deleted his comments

joedeagan

2012-03-28 14:23:08

From: abu_jwka
You have to name where the Folder is located!!!

Go to your folder you just created, open it. Now look at the address bar, copy and paste that into the function.

And remember to put quotation marks '' around the folder when you paste it in the brackets.


EDIT: You clearly didn't follow the instructions I gave you in the above post :|


EDIT2: This is not a double-post, user deleted his comments


Alright, so, I basically did what you said… I have a folder located in C:\Simba\Screenshots. The script compiled and it found the color at that area, then it moved the mouse there, but I still don't see any screenshots in that folder… here is the script:

program ClientDimensionsAndFindColorToleranceMoveMouseExample;

var
w, h, x, y: Integer;
Red: Integer;

begin

SetDesktopAsClient;

GetClientDimensions(w, h);

WriteLn('The Current Clients Dimensions are: ' + ToStr(w) + ', ' + ToStr(h));

Red := 16771541; // Used Simba's color picker to get a red color, this will be used below


(* FindColorTolerance, what this does is finds the color specified in specified box area (xs, ys, xe, ye)
if found it will return where the color was found in the x and y variables. Tolerance is, should this be
the exact same color or can it be slightly differet. 0 tolerance means it has to be the same exact color
anything above 0 means the color can be slightly different (different shades will be searched for)
if found, returns True *)


// So this will search the entire desktop for that color with tolerance 30 starting from the Top left point of the desktop to the bottom right point
// Then it will Move your mouse to that color found

if FindColorTolerance(x, y, Red, 480, 507, 1234, 541, 30) then
begin
WriteLn('Found Red color at: ' + ToStr(x) + ', ' + ToStr(y));
MoveMouse(x, y);
SaveScreenshot('C:\Simba\Screenshots');
end
else
begin
// If The color isn't found it will not be stored in variables x, and y meaning they will be still set to 0

WriteLn('x any y are unset: ' + ToStr(x) + ', ' + ToStr(y));
MoveMouse(x, y);
end;

end.

masterBB

2012-03-28 14:23:59

From: abu_jwka
EDIT2: This is not a double-post, user deleted his comments


A double post is a double post, no excuses ;)

How are we supposed to help if he deletes his comments? nvm ;)

edit:
use
SaveScreenshot('C:\Simba\Screenshots\screenshot.jpg');

Abu

2012-03-28 14:28:59

From: masterBB
A double post is a double post, no excuses ;)

How are we supposed to help if he deletes his comments? nvm ;)



But that's not fair! He cheated :(

joedeagan

2012-03-28 14:32:53

From: masterBB

edit:
use
SaveScreenshot('C:\Simba\Screenshots\screenshot.jpg');


This worked!

but what if I want the script to take multiple screen shots. And I don't want it to overwrite the previous one. How do I take multiple screenshots?

Thanks.

masterBB

2012-03-28 14:37:31

From: joedeagan
This worked!

but what if I want the script to take multiple screen shots. And I don't want it to overwrite the previous one. How do I take multiple screenshots?

Thanks.


var
i:Integer;
begin
i := Length(GetFiles('C:\Simba\','jpg'));
SaveScreenshot('C:\Simba\Screenshots\screenshot_' + ToStr(i) + '.jpg');
// SaveScreenshot
end.

joedeagan

2012-03-28 14:58:08

From: masterBB
var
i:Integer;
begin
i := Length(GetFiles('C:\Simba\','jpg'));
SaveScreenshot('C:\Simba\Screenshots\screenshot_' + ToStr(i) + '.jpg');
// SaveScreenshot
end.


Thanks, this takes screenshot for one but it doesn't add numbers at the end though… it just overwrites the one image it creates. It creates the file "screenshot_0.jpg" in the folder: C:\Simba\Screenshots

Here is how implemented your script:

program new;
var
x, y: Integer;
i:Integer;

procedure findcolor;
begin
if FindColorTolerance(x, y, 16771541, 480, 507, 1234, 541, 30) then
begin
WriteLn('Found Red color at: ' + ToStr(x) + ', ' + ToStr(y));
MoveMouse(x, y);
i := Length(GetFiles('C:\Simba\','jpg'));
SaveScreenshot('C:\Simba\Screenshots\screenshot_' + ToStr(i) + '.jpg');
end
end;

begin

findcolor;

end.

What am i doing wrong, it doesn't append numbers so it doesn't overwrite the previous one.

Thanks.

masterBB

2012-03-28 15:04:02

program new;
var
x, y: Integer;
i:Integer;

procedure findcolor;
begin
if FindColorTolerance(x, y, 16771541, 480, 507, 1234, 541, 30) then
begin
WriteLn('Found Red color at: ' + ToStr(x) + ', ' + ToStr(y));
MoveMouse(x, y);
i := Length(GetFiles('C:\Simba\Screenshots\','jpg')); //forgot the map ;)
SaveScreenshot('C:\Simba\Screenshots\screenshot_' + ToStr(i) + '.jpg');
end
end;

begin

findcolor;

end.

joedeagan

2012-03-28 15:14:43

From: masterBB
program new;
var
x, y: Integer;
i:Integer;

procedure findcolor;
begin
if FindColorTolerance(x, y, 16771541, 480, 507, 1234, 541, 30) then
begin
WriteLn('Found Red color at: ' + ToStr(x) + ', ' + ToStr(y));
MoveMouse(x, y);
i := Length(GetFiles('C:\Simba\Screenshots\','jpg')); //forgot the map ;)
SaveScreenshot('C:\Simba\Screenshots\screenshot_' + ToStr(i) + '.jpg');
end
end;

begin

findcolor;

end.

OH you are the Master! it worked!!! thanks. I will ask more noob questions in the future lol.

thanks.

Abu

2012-03-28 15:21:35

From: joedeagan
I will ask more noob questions in the future lol.


Please don't. Try to work out things by yourself, if you need help with functions then do what I do.

Go here: http://docs.villavu.com/

masterBB

2012-03-28 15:57:58

From: joedeagan
OH you are the Master! it worked!!! thanks. I will ask more noob questions in the future lol.

thanks.


Glad it worked, looking towards your questions ;)