Compile Crazy
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomePortalLatest imagesSearchRegisterLog in

 

 The TFLib now!

Go down 
AuthorMessage
The Fellow
Admin
The Fellow


Posts : 100
Join date : 2010-04-28
Age : 31
Location : In my head, dreaming up how to shake up the world

The TFLib now! Empty
PostSubject: The TFLib now!   The TFLib now! I_icon_minitimeTue Oct 26, 2010 7:57 pm

hello, if you read my first tutorial of Scar, you would noticed that I had put some functions in there that was from my library. I did not post up the library at the time because I was not ready to post it. With some of the bugs kinked out I have decided to put it up now, and will be writing some how to use for anyone who does not get the code. Feel free to post any suggestions for the next release here!

I am up for anything, just give me what you want to be able to do and I will try and code it. I mean that I am up for anything, I got some stuff planned already, but not many, so please give me some ideas!



Code:

{Creator: The Fellow}
{Date: 10/26/10}
{version: 1.0}

//enter a URL and it will go to it. Needs more testing.
//Pre condition: A string that is a adress to be sent to
//Post condition: returns nothing, but enters a url in a web browser
procedure enterURL(URL:String);
begin
    wait(300);
    ClickMouse(262, 65, true);//needs a better method
    wait(300);
    SendKeys(URL+chr(13));
    wait(300);
end;

//Presses multiple keys down, using an array of them
//Pre Condition: gets an amount of how many buttons to press, and an array of the bytes of the Keys to press
//post condition: Presses down all the keys
procedure multiDown(Amount:integer; Keys:Array of Byte);
var i: integer;
begin
  i:=0;
  while i < Amount do
    begin
          KeyDown(Keys[i]);
          wait(8);
          i:= i +1;
    end;
end;

//Releases multiple keys, using an array
//Pre condition: gets an amount of how many buttons to release, and an array of the bytes of the keys
//Post condition: releases all the buttons specified
procedure MultiUp(Amount:integer; Keys:Array of Byte);
var i: integer;
begin
  i:=0;
  while i < Amount do
    begin
          KeyUp(Keys[i]);
          wait(8);
          i:= i+1;
    end;
end;

//Presses and releases multiple keys for key combonations
//Pre condition: gets an amount of how many buttons, and an array of all the bytes
//Post condition: presses all the keys, and releases them
procedure Key(Amount:integer; Keys:Array of Byte);
begin
    SetArrayLength(Keys, Amount);
    MultiDown(Amount, Keys);
    wait(300);
    MultiUp(Amount, Keys);
end;

//Creates a new tab, then enters a url
//Pre condition: gets a url in form of a string. Must support tabs
//Post condition: creates a new tab, then inserts the URL into it.
procedure newTabURL(URL:String);
begin
    Key(2, [17, 84]);
    enterURL(URL);
end;

//Creates a new tab
//Pre condition: Must support tabs.
//Post condition: A new tab is created
procedure newTab;
begin
    Key(2, [17,84]);
end;

//Starts a program, or opens a folder
//Pre condition: the name of soemthing to open, in the form of a string, must be valid .exe
//Post condition: the program opens
procedure StartProg(ProgName:String);
begin
    Key(2, [92, 82]);
    SendKeys(ProgName + chr(13));
end;

//Switchs the window size based on what string you give it, no matter the case
//Pre condition: a valid window size
//Post condition: the window changes to that size
procedure windSize(switchTo:String);
begin
    Case lowercase(switchTo) of
    'max':
    begin
          Key(3, [18, 32, 88]);
    end;
    'min':
    begin
          Key(3, [18, 32, 78]);
    end;
    'restore':
    begin
          Key(3, [18, 32, 82]);
    end;
    else
        writeln('Please enter a correct size.');
    end;
end;

//changes the window to maximized
//Pre Condition: something to change is on focus
//Post condition: Maximized the window
procedure maxWind;
begin
    windSize('MAX');
end;

//changes the window to minimized
//Pre condition: Something to change is on focus
//Post condition: Minimized the window
procedure minWind;
begin
    windSize('MIN');
end;

//changes the window to restored
//Pre condition: something to change is on focus
//Post condition: restored the window
procedure restWind;
begin
    windSize('restore');
end;
   
//enters information in a certain area, used for logins and such.
//Pre condition: A X and Y position for the mouse, the information to be entered, must be a string
//Post condition: information to be entered in the place told.
procedure enterInfo(X, Y:integer; Info:String);
begin
    ClickMouse(X, Y, true);
    wait(300);
    SendKeys(Info);
end;

Take that code and paste it into your SCAR editor, save the file in the includes, include it into your programs and you can use all those procedures =3
Back to top Go down
https://compilecrazy.forumotion.net
 
The TFLib now!
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Compile Crazy :: Scripting :: Computer-based Scripting :: SCAR-
Jump to: