I was looking for an automated solution to do a repetitive search on the internet daily for a certain keyword to increase the hit count.
So, I created a java program which will connect to google and do search for me. And return some JSON data. Which one can format if wish to.
// Insert here : java - google search code - from home workspace.
Next step was to create a batch file which will create a scheduled task and will run this jar everyday at a certain time.
So found a link on how to schedule a task using batch file... http://support.microsoft.com/kb/814596
So I created my task using this one as,
schtasks /create /tn "TASKNAME" /tr "java -jar C:\YOURJARNAME.jar" /sc DAILY /st 17:00:00
But for end user to give batch file and asking them to execute was too much. They are happy to do double click and done thing ! So, I searched to convert a batch file into executable. And found good link.
http://www.computerhope.com/dutil.htm - This has a utility bat_to_exe which I used.
And that's it.
Then I distributed the jar and the exe to the end users and asked them to copy both files under C:\ and then click on .exe file. Which will create a scheduled task to execute this jar everyday at 5 pm.
Hope this helps someone !
//Hardik
So, I created a java program which will connect to google and do search for me. And return some JSON data. Which one can format if wish to.
// Insert here : java - google search code - from home workspace.
Next step was to create a batch file which will create a scheduled task and will run this jar everyday at a certain time.
So found a link on how to schedule a task using batch file... http://support.microsoft.com/kb/814596
So I created my task using this one as,
schtasks /create /tn "TASKNAME" /tr "java -jar C:\YOURJARNAME.jar" /sc DAILY /st 17:00:00
But for end user to give batch file and asking them to execute was too much. They are happy to do double click and done thing ! So, I searched to convert a batch file into executable. And found good link.
http://www.computerhope.com/dutil.htm - This has a utility bat_to_exe which I used.
And that's it.
Then I distributed the jar and the exe to the end users and asked them to copy both files under C:\ and then click on .exe file. Which will create a scheduled task to execute this jar everyday at 5 pm.
Hope this helps someone !
//Hardik
No comments:
Post a Comment