Log in

View Full Version : How to make Simba take screenshot?



joedeagan
03-28-2012, 12:44 PM
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
03-28-2012, 01:03 PM
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
03-28-2012, 01:12 PM
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
03-28-2012, 01:22 PM
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
03-28-2012, 04:53 PM
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
03-28-2012, 04:56 PM
Make a folder where you want the screenshot to be saved in.

Then put in that folder name....

:duh:

joedeagan
03-28-2012, 06:02 PM
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
03-28-2012, 06:06 PM
Make a new folder called Simba Screenshots right on your primary HDD.

C:\Simba Screenshots

Abu
03-28-2012, 06:11 PM
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
03-28-2012, 06:19 PM
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
03-28-2012, 06:23 PM
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 ClientDimensionsAndFindColorToleranceMoveMouseExam ple;

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
03-28-2012, 06:23 PM
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.jp g');

Abu
03-28-2012, 06:28 PM
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
03-28-2012, 06:32 PM
edit:
use SaveScreenshot('C:\Simba\Screenshots\screenshot.jp g');

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
03-28-2012, 06:37 PM
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
03-28-2012, 06:58 PM
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
03-28-2012, 07:04 PM
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
03-28-2012, 07:14 PM
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
03-28-2012, 07:21 PM
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
03-28-2012, 07:57 PM
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 ;)