I have an AutoIt script that I call from my Java program that is using Selenium to load data through a web application. The script works to upload the file using the value from the file but only when the Java program runs in the foreground. Most more than likely this program will run in the background.
How can I set it up so that when running in the background the program will work?
Java:
Thread.sleep(2000); // wait for page load
Runtime.getRuntime().exec("C:\\Users\\Janet\\Documents\\uploadFile.exe " + uploadFile);
AutoIt:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\Users\Janet\Documents\uploadFile.exe
#AutoIt3Wrapper_Outfile_x64=C:\Users\Janet\Documents\uploadFile_x64a.Exe
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
ControlFocus("File Upload","","Edit1"); Name of the file upload window (Windows Popup Name: Open)
ControlSetText("File Upload","","Edit1",$CmdLineRaw); File name
Send("{ENTER}")