Jump to content

Script Pauses when run in Java, but okay in Script Editor or cmd

Recommended Posts

I have a few questions:


I am using Oracle Application Testing Suite's OpenScript 13 (Eclipse IDE), Oracle Java 6, and AutoIt.

My goal is to access a given Internet Explorer browser window (`$ieTitle`), send the keystroke of "shift-control-s" for "Save As" functionality to be invoked, so that I can download a (PDF) file to a given location ($fileName).

The code within the script `DownloadPdfFile.au3` is

$ieTitle = $CmdLine[1]
$ieControl = "AVL_AVView31"
$fileName = $CmdLine[2]

ControlFocus($ieTitle, "", $ieControl)
ControlSend($ieTitle, "", $ieControl, "+^s")

; Save as dialog
$winTitle = "Save As"
; wait for Save As window
; activate Save As window
If Not WinActive($winTitle) Then WinActivate($winTitle)
Exit 0

So I compiled it with SciTE-Lite (32-bit Version 4.4.6 , creating `DownloadPdfFile.exe`, and so within my Java code, I have

String command = autoItExePath + " " + scriptPath + " \"" + winTitle + "\" "  + directoryPath.toFile().toString() + "\\Form9Report" + sdf_ddmmmyyyy.format(new Date()) + ".pdf";
try {
    Process process = Runtime.getRuntime().exec(command);
} catch (Exception e) {
    logger.error("Exception " + e.getMessage(), e);

The output would be like `C:\Program Files (x86)\AutoIt3\AutoIt3.exe C:\...\AutoItScripts\DownloadPdfFile.au3 "https://****.com/****.exe?temp_id=**** - Internet Explorer" C:\...\Report05Apr2022.pdf"` which does run without the $cmdLine successfully. 

When executed by Java, I see in the taskbar an icon, which I right-click has "[Check] Script Paused" and "Exit".


(1) How do I unpause the script?

(2) How do I avoid having the script paused?

Any help is appreciated.

Link to comment
Share on other sites

Link to comment
Share on other sites

25 minutes ago, Nine said:

You can remove all together the autoIt icon with #NoTrayIcon.

There is a few Opt() related to Tray Icon (eg. TrayAutoPause).  See help file for more details.


There isn't any icon in the taskbar, but the script itself, is still not fully executing. I cannot see the "Save As" functionality happen.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...