You can edit almost every page by Creating an account. Otherwise, see the FAQ.

Javauto

From EverybodyWiki Bios & Wiki


Javauto
Developer(s)Matthew Downey
Engine
    Operating systemMicrosoft Windows OS X Linux
    TypeScripting language Automation
    Websitehttp://javauto.org/

    Search Javauto on Amazon.

    Javauto is an automation language for Microsoft Windows, OS X and Linux, unique due to its ability to perform mouse clicks, simulate keyboard input, and perform pixel searches.

    It compiles to executable code that runs on the JVM (Java Virtual Machine), so any program you write will be cross platform.

    Usage[edit]

    Javauto is typically used to produce utility software for Microsoft Windows, OS X and Linux and to automate routine tasks, such as monitoring, maintenance, or software installation. It is usually used as an alternative platform to AutoIt on OS X and Linux. [1][2][3]

    Examples[edit]

    Hello world[edit]

    msgBox("Hello world, press okay.", "Hello World"); 
    mouseMove(0,0); // move the mouse to 0, 0
    print("All finished!");
    

    User Input[edit]

    String userResponse = input("Enter your name: ");
    String greeting = "Hello " + userResponse + ", it's nice to meet you.";
    print(greeting);
    
    userResponse = inputBox("Enter your name");
    greeting = "Hello " + userResponse + ", it's nice to meet you.";
    msgBox(greeting, "Hello There");
    

    User Defined Functions[edit]

    Define a function to move the mouse to random coordinates. This function is void, meaning it doesn't return any value.

    func void randomMouseMove() {
         int x = intGetRandom(0, SCREEN_WIDTH); // get a random int for x
         int y = intGetRandom(0, SCREEN_HEIGHT); // get a random int for y
         mouseMove(x,y); // move the mouse to these generated coordinates
    }
    
    msgBox("Moving the mouse to random coordinates...");
    randomMouseMove();
    

    Java Integration[edit]

    It is important to keep in mind that code can be written in regular Java at almost any time. The only two exceptions are user defined functions and class variables (writing these in Java will result in an error).

    This means that you can use Java classes and import Java libraries, in addition to using Java code. For example, the below sentences are valid

    System.out.println("Printing with Java");
    print("Printing with Javauto");
    
    import java.util.Date;
    
    Date date = new Date();
    // display time and date using toString()
    System.out.println(date.toString());
    

    Advanced Example[edit]

    This example shows a simple website-monitoring script.

    //Check program arguments.
    if(args.length  == 0){ 
         printHelp();	
    }
    
    if (!isFlagged(args, "-u") || !isFlagged(args, "-p") ) {
         printHelp();
    } 
    
    do { 
         notify(getFlaggedArg(args, "-u"));
         sleep(toInt(getFlaggedArg(args, "-p")));
    } while(true);
    
    // Print program help and exit.
    func void printHelp(){ 
         print("Usage: notifier.jar -u URL -p Time (Inserts a fixed delay between httpGet [milliseconds])");
         print("Example: java -jar notifier.jar -u http://www.javauto.org -p 1000 ");
         System.exit(0);
    }  
    
    func void notify(String url){
         String response = httpGet(url);
         if(response.isEmpty()){
    	print( "[ERROR] %s is not reachable! You may panic now." % (url) );
         } else { 
    	print( "[OK] %s is online" % (url));
         }
    }
    

    See also[edit]

    References[edit]

    1. File Upload Selenium IDE Stackoverflow, December 2014
    2. Mouse Click on Mac Stackoverflow, February 2014
    3. Simulate a mouse click without moving mouse

    External links[edit]


    This article "Javauto" is from Wikipedia. The list of its authors can be seen in its historical. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.