This is my first post, please let me know if I did not provide enough information for you all.
First a little background info. I am a TA for a Computer Information Systems course and I am attempting to automate the grading of a very basic Java application our students will be writing.
For the sake of this conversation, the Java program I want to grade is a simple calculator that will calculate the non-compounding interest with 2 inputs (Principle and Interest Rate) provided by the user from a command line interface. It is important to note that the Java program will prompt the user to input the Principle and Interest Rate independently, and it cannot be provided as Command Line Arguments. Below is a quick snippet of what the Usage of the Java application looks like.
Please enter the principal amount of the loan as a Decimal.
5 /User Input
Please the percentage rate for the loan as a Decimal.
5 /User Input
Total $: 5.25
I need this very basic PowerShell script to open the java application, wait for a prompt then input a integer, and then output the result to a text file.
At this point, my script will open the Java application, but it will not proceed to the next command until I complete the Java application. Below is the basic script I am using thus far.
add-type -AssemblyName System.Windows.Forms
java Interest
Start-Sleep -Milliseconds 500
[System.Windows.Forms.SendKeys]::SendWait("5")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
exit
Again, this script will open the Java application and wait for me to provide an input variable opposed to submitting the '5' from the code snippet above.
If anyone has a little bit of guidance that will allow me to interact with the Java application CLI once it has been executed, I would greatly appreciate.
Thank you all for being patient as I fumble through my first post and these formatting issues. I look forward to hearing from you.
-Aaron
(Edit: Thanks to RamPrakash for helping with some of my formatting!)