Automated Web Browser To Perform Specific Tasks

Jul 14, 2014

I need to know how to automate a web browser (either Chrome, Firefox or Safari) to perform the following task.

Take a word from a .txt file housed on my hard drive,

1) put it into a search engine,
2) load the results,
3) click on/ open the first result,
4) open up an new tab and perform steps 1-3 again but with the next word from the .txt file. 4-5 second pauses are needed in between each step.

Additionally, I would like to automate the browser to close all the open tabs when a full stop is pulled from the .txt file.

I am using a macbook and 10.6.8 OS.

View Replies


ADVERTISEMENT

How To Perform Tasks Listed In Text File

Feb 12, 2015

This has three different classes in a package and the program itself is supposed to read and perform operations obtained from a txt file. However, I'm not even sure how to get it to perform the operations from the text file. I know that it can read the file as I was able to get the program to print the text found in the file when I ran the program with a test print to make sure that all content was being read. However, I am clueless when it comes to how to get the program to look at the text as commands.

Here is the piece of code that I am not sure where to go from as far as telling the program to read the text and perform the tasks listed.

public static void doTVoperations(){
File operations = new File("operations.txt");
if(operations.exists())
try{
Scanner n = new Scanner(operations);

[Code] ....

View Replies View Related

How To Get Program To Perform Tasks Listed In Text File

Feb 12, 2015

This has three different classes in a package and the program itself is supposed to read and perform operations obtained from a txt file. However, I'm not even sure how to get it to perform the operations from the text file. I know that it can read the file as I was able to get the program to print the text found in the file when I ran the program with a test print to make sure that all content was being read. However, I am clueless when it comes to how to get the program to look at the text as commands.

Here is the piece of code that I am not sure where to go from as far as telling the program to read the text and perform the tasks listed.

public static void doTVoperations(){
File operations = new File("operations.txt");
if(operations.exists())
try{
Scanner n = new Scanner(operations);
while(n.hasNext()){
String readOperations = n.nextLine();
String [] command = readOperations.split("[
]");
}
n.close();
}
catch (FileNotFoundException e){
System.out.print("Error...TV in need of repair!");
}

View Replies View Related

Read Text File And Perform Operation On Specific Columns

Dec 9, 2011

I am somewhat of a java newbie (learned it awhile back and just getting back to programming some again.) I have a text file of data much larger than this, but here are the first ten rows and first 10 columns.

39755320111041730140.633038085-2.117082366149.069997
39850320111041730150.633038085-2.117082511148.309997
39955320111041730160.633037998-2.117082293149.509997
40055320111041730170.633037945-2.117082351149.239997
.......

I can read and write all the data back out to files. But I am not sure about a few things.

First would it be best to use BufferedReader and OutputStream such as:

public static void main(String[] args) throws IOException {
BufferedReader bReader = new BufferedReader(new FileReader ("testdata.txt"));
BufferedOutputStream bytesOut = new BufferedOutputStream(new FileOutputStream ("outfile.txt"));

Second, I was then going to initialize an array but I might have 30 or more columns of data, of which I might perform and output only 10 columns to my output.txt file so is this a good way?

Third, I only want to perform operations (such as average the data, convert units or multiply two columns together) on 10 of the 30 plus columns and print out results to output.txt file. For example, In testdata.txt file above, I want to skip first seven columns. I then want to take column 8 and multiply by 100 then divide by 3 and output result to output file. I want to do same for column 9. Column 10 I want to multiply by different number (by 3.5).

View Replies View Related

Building Calendar With Automated Employee Vacation Planner?

Apr 4, 2014

Every year, she has to plan when her employee's can go on vacation for the summer holidays - MANUALLY. It takes weeks to solve the puzzle, because she has several kinds of employee's hired, with different skills. And at all days there must be X amount of employees with skill1 at work, plus Y amount of employees with skill2 etc, and they also need special "off-days" in comparison to when they last worked and so on. It's quite the math puzzle.

I've worked a little with C#, and built a prototype of a Support System (Ticket based), so I got the basics down of programming, and I know Java and C# are quite alike, so I don't think making the switch will bother me that much.

The program should be easy to use for her, so it needs a visual calender that can be interacted with, and it should also be easy to see which employee is at work at that date and so on.

Will it be hard for me to build this kind of Calender, that allows the interaction I want?

Any open-sourced projects, or libraries that will make my task easier?

I plan on using NetBeans IDE for this project.

View Replies View Related

Browser Automation / Embedding Into GUI / Attaching To Existing Browser Window

Aug 7, 2014

What best API or whatever you call for browser automation? I mean clicking links, filling forms, gathering sources and other info. I already tried selenium WebDriver. It have all needed functions but there is no feature like attaching code into already opened browser so even doing google search it opens new browser window (opening takes ~5-10secs). Also I believe that there is no way that I could embed that browser into GUI.

Also tried WebSpecs and old Watij but also didnt found any way to attach or embed browser into my GUI.

So what I need is that I could create GUI with embeded browser and bunch of buttons. I click buttons then embeded browser clicks links, gets info etc.

View Replies View Related

Write A Specific Byte Sequence To A Specific Memory Location On A Removable Storage Drive?

Jan 29, 2014

I am trying to write a specific byte sequence to a specific memory location on a removable storage drive. Does Java allow me a way to do this? I know the dangers in accessing memory, but the memory location of the data that will be written will never change.

how to assign a variable a memory location.

View Replies View Related

Swing/AWT/SWT :: Move Focus From Specific Jcombobox To Specific Jtextarea?

Nov 5, 2014

How do I move focus from a jcombobox to a specific component say a jtextarea.

My attempt below seems to be moving to a random component not the desired jtextarea.

takenByCombo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB ) {
e.consume();
dayJTArea.requestFocus(); // focust not moving dayJTArea
}
}
});

I applied the above logic to move focus from a specific jtextarea to another jtextarea as seen below and it works as desired.

dayJTArea.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB ) {
e.consume();
monthJTArea.requestFocus();
}
}
});

View Replies View Related

Changing Value In Specific Point Of Specific Line In TXT File

Feb 9, 2015

So here we go with my problem:

- from the main class will arrive three variable (String name_used, int level_choose, int level_result)

I have a .txt file with this kind of formatting:

mario 1 1 0 1 0 1
carlo 0 0 0 1 1 0
...

Where I use 1 and 0 in the main for write if the level (you see that the numbers are always sixr? are egual to six level existing) BEFORE is done correct or wrong

- when in the main a user make a level a feedback coming back from the class level saying if the user made the count correctly or wrong. and i wanna replace the value (1 or 0) in the txt file with the new level result.

So i have all what i need as parameters i think.

name_used to look for the correct line in .txt file with .indexOf
level_choosed to go throught the correct index of that line
level_result (1 or 2) to be replaced with the existing one

Java Code:

public void salvaRisultati(String name_used, int level_choosed, int result_of_level) throws FileNotFoundException{
}
} mh_sh_highlight_all('java');

View Replies View Related

Check Specific Value From A Specific Line From TXT File

Feb 8, 2015

I have some problem to understand the way to make this:

In my main class a user can save his name in a txt file (and the system initially will add 6 value equals to 0) than he can choose between 6 level and make it.

example of .txt file data:

mario 0 0 0 0 0 0
carl 0 0 0 0 0 0

AT THIS MOMENT i just made other class and they work, is this new one that is hard for me. I'm trying to make a class that:

1- (first method called verificaRisultati) take name_used and level_choosed from the main and go to check in the .txt file if that level before was done right(1) or wrong(0)

and return something like "before you made this level properly" or "before you made this level incorrectly" AND THEN let the user start with the level.

2- (second method called salvaRisultati) at the end of the level i wanna pass the result (correct/incorrect) to another method of this class that will save the value (1 or 0) associated to the user in the right position.

This is the class that i'm writing:

Java Code:

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
public class ResultUsers {

[Code] ....

I really need some hint and some code example because I'm stuck. How I can take exactly the line with the user name? How I can correctly split the line in an array and then read/modify the value for that level?

View Replies View Related

Swing/AWT/SWT :: JButton Does Not Do All Tasks

Aug 3, 2014

I have a jButton that when the action perform runs it only does part of the tasks some of the code doe not appear to run and i just can not figure out why i have tried wrapping parts of it in an if statement and it still do not run so here is the code behind the button:

in the code the parts that do not run are jTextField10.setText("Working Please Wait"); and jButton15.setVisible(false);

what i am expecting to happen is the text field has the words Working Please Wait placed in it , this does not happen and the button should be hidden to prevent it being clicked a second time again this does not happen

the rest of the code works as expected

InputStream inStream;
OutputStream outStream;
try {
File afile = new File("C://templates//amendments.xls");
File bfile = new File("C://amendments.xls");
inStream = new FileInputStream(afile);
outStream = new FileOutputStream(bfile);

[code]....

View Replies View Related

Throttling Submission Of Tasks To A ThreadPoolExecutor

Jun 4, 2014

I have a library that uses a ThreadPoolExecutor, backed by a bounded queue.

We submit a large number of tasks to this executor, constantly polling an external dependency for new work. However, this executor has a fixed size. When a ThreadPoolExecutor is busy, it queues up to the blocking queue's capacity tasks in its blocking queue, at which point it starts rejecting tasks.

What I'd rather do, instead of requesting more work, and then throwing it out, is to detect that we're totally busy and stop requesting work until a thread frees up.

Now, I know that one approach is to rewrite the workers such that they are infinite loops, who poll for work when they're finished. Due to the large number of consumers of this library, this is not an option.

I have come up with two other solutions.

1) This is one that I know will work, which is to use a semaphore or other concurrent counter to track how many tasks I have submitted, and stop requesting more work when that semaphore is out of permits. The processors release a permit when they complete (whether due to exception or success).

2) The other option, since I know this is a ThreadPoolExecutor, is way simpler, but also is something I'm not sure is reliable.

I can compare executor.getActiveThreads() + executor.getQueue.size() to the maximum number we can handle before rejecting (maxThreads + queueSize). This change is far simpler, but I'm not sure if those calls are a reliable way of counting the current work.

View Replies View Related

Servlets :: Offline Tasks In Java Web Application

Feb 11, 2014

I am on developing a web application (using struts). So most of my web application use cases are reading and presenting data to the users.

But i need to write the another set of programs to keep on reading the data from another data bases and update my database. I have list of timings at which i should read the data from each of other sites (i.e. i know when the other databases gets updated information). Its almost every 20 mins..

Now i want to design the app.

1. Should i include the data read programs as part of my Web application ( means runs in same server JVM) and make the threads as daemon threads..?
2. Should i write another application (offline application) runs out of server in another JVM ?

View Replies View Related

Open Source Java API For Creating Tasks To MS Outlook?

May 28, 2014

I am looking for pure java API to be able to create/read outlook tasks.

Any open source API's available for the same.

View Replies View Related

Prompt A User To Enter Three Tasks And Their Priorities In A Driver

Oct 31, 2014

My full instructions are to Design a Java interface called Priority that includes two methods and two constants. The methods are setPriority and getPriority. The constants are MIN_PRIORITY with value 1 and MAX_PRIORITY with value 6. The interface should define a way to establish numeric priority among a set of objects. Design and implement a class called Task that represents a task (such as on a to-do list) that implements the Priority interface. Assume that Task has two attributes (instance data): name and priority. Define the Task constructor to accept and initialize the name of the task. Each newly created Task should have priority equal to MIN_PRIORITY (the constructor should initialize priority to MIN_PRIORITY). Priorities can be changed using setPriority method. Create a driver class TaskDriver that should do the following: prompt the user to enter three tasks and their priorities, and then print the tasks in the order of decreasing priorities. If the user enters an invalid priority that is less than MIN_PRIORITY or greater than MAX_PRIORITY, then the user should be asked to enter priority again until a valid priority value is entered.

So far I have:

public interface Priority
{
public void setPriority(int level);
public int getPriority();

[Code].....

View Replies View Related

How To Perform Soft Delete

Feb 25, 2014

how to do soft delete?

View Replies View Related

While Loop To Perform Multiple Steps

Mar 20, 2014

Write a program that uses a while loop to perform the following steps: Comment by labelling each part: //Part A, //Part B, etc...

A.)Prompt the user to input 2 integers: firstNum and secondNum. Use 10 and 20.
B.)Output all odd numbers between firstNum and secondNum.
C.)Output the sum of all even numbers between firstNum and secondNum.
D.)Output the numbers and their square between 1 and 10.
E.)Output the sum of the square of odd numbers between firstNum and secondNum.
F.)Output all uppercase letters.

Again I am new to while loops and I am totally lost. I have just completed 8 other programs using if else statements and now trying to get the hang of loops.

import java.util.Scanner;
public class whileLoop {
public static void main(String[] args)

[code]...

View Replies View Related

Write A Method That Uses For-loop To Perform?

May 19, 2014

which when user enter a number then will display how many * in a line .Produce a line: ***** But my code only show 1 * there... what wrong with it ?

import java.util.Scanner;
public class display {
public static void main(String args[]) {
int i,n = 0 ;

[Code] ...

View Replies View Related

How To Get One JButton To Perform Sequential Actions

Aug 18, 2014

How to get my program to display a piece of text (upside down) on the first button press, and then display it right-side up on the second button press. I've looked all over the internet and I can't seem to find a example that fits my situation.

Here is the code:

package org.CIS407.Lab10;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JUpsideDown extends JFrame
implements ActionListener

[Code] ....

View Replies View Related

How To Perform Calculations Using Stacks Java

Nov 23, 2014

I am doing a calculator using stacks but when i try to calculate I getting the wrong data example stack contains 8 and user enter -3 stack should change to 5.

package comp10152.lab5;
import java.util.Scanner;
import java.util.Stack;

[Code].....

View Replies View Related

Perform Action Only If Certain Amount Of Time Has Passed

Sep 18, 2014

public static void main(String[] args) {
boolean t=false;
long cuTime = System.currentTimeMillis()
while(t==false) {
System.out.println(cuTime);
long g=cuTime+2000;

[Code] ....

I tried this and it includes a while loop as the whole program has to wait until this while loop executes. So the entire program slows down. Is there any way to do this without a while loop

View Replies View Related

How To Perform Action Only If Certain Amount Of Time Passed

Sep 18, 2014

public static void main(String[] args) {
boolean t=false; 
long cuTime = System.currentTimeMillis();
while(t==false) {
System.out.println(cuTime);
long g=cuTime+2000;

[Code] ....

I tried this and it includes a while loop. therefor the whole program has to wait until this while loop executes. So the entire program slows down. Is there any way to do this without a while loop...

View Replies View Related

How To Perform Row Operation - Store Data Into 2D Matrix

Sep 18, 2014

I am able to perform column operation but not able to perform row operation because i am not able to store data say a 2 matrix [][]. I need to store the data into a 2-D matrix. Here is my code:

Java Code:

import java.awt.List;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;
public class colRowRead {

[Code] ....

I tried something like that:

for(int i=0; i<rows; i++) {
for(int j=0; j<cols; j++){
matrix [i][j]=textFile.get(i).split(" ");
//System.out.println(matrix[i][j]);
}
}
*/ mh_sh_highlight_all('java');

File col.txt is like this:

Java Code:
5 9 7 1 5
3 6 8 6 8
4 6 7 8 9
9 8 3 5 7 mh_sh_highlight_all('java');

View Replies View Related

How To Perform Action Only If Certain Amount Of Time Has Passed

Sep 18, 2014

public static void main(String[] args)
{
boolean t=false;
long cuTime = System.currentTimeMillis();
while(t==false)
{
System.out.println(cuTime);

[code].....

I tried this and it includes a while loop as the whole program has to wait until this while loop executes. So the entire program slows down. Is there any way to do this without a while loop

View Replies View Related

Generate Conditions To Perform Calculations On Whole Numbers?

Dec 12, 2014

I have to ask the user to enter 4 whole numbers, and then the program will calculate:

> x numbers are positive and even
> x numbers are positive and odd
> x numbers are negative and even
> x numbers are negative and odd

but I have trouble with the conditions. How do I form the conditions to calculate this? My professor said I can do this with only four IFs (or ELSE IF). This is what I did:

import java.util.Scanner;
public class Calc{
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
 
int pe = 0, po = 0, ne = 0, no = 0;
/* four variables for each result
pe - positive even
po - positive odd
ne - negative even
no - negative odd

[Code[ ....

View Replies View Related

JavaFX 2.0 :: Perform Boolean Operations On 3D Primitives?

Nov 10, 2014

How to perform boolean operations (union, intersect and subtract) on 3D primitives in javafx 3D?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved