05-02-2017, 06:07 AM
Thank you. I tested with the Java Control Panel app. When clicked a button to open a dialog, DoDefaultAction opens the dialog, but then error, and Java accessible objects stop working. Cannot use DoDefaultAction until Java will fix it. Workaround:
Macro Macro2851
This script works when the Java window is not the active window. But its taskbar button becomes red...
Macro Macro2851
int w=win("Java Control Panel" "SunAwtFrame")
Acc a.Find(w "push button" "Network Settings..." "" 0x1001)
;a.DoDefaultAction ;;bad
;a.JavaAction("click") ;;bad
;workaround
a.Select(1)
;SendKeysToWindow w key(V) ;;if you have it. Else:
PostMessage w WM_KEYDOWN VK_SPACE 0x390001; 0.02
PostMessage w WM_KEYUP VK_SPACE 0xC0390001; 0.02
int w1=wait(1 WV win("Network Settings" "SunAwtDialog"))
Acc a1.Find(w1 "radio button" "Use proxy server" "" 0x1001)
a1.DoDefaultAction
0.5
int w2=win("Network Settings" "SunAwtDialog")
Acc a2.Find(w2 "push button" "Cancel" "" 0x1001)
a2.DoDefaultAction
Quote:rather than requiring to unlock the computerThe script probably will not work when computer is locked. Any similar script would not work. Then even cannot find windows.
This script works when the Java window is not the active window. But its taskbar button becomes red...