Macro scheduler and Eclipse Java SWT window

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
DevEng
Newbie
Posts: 3
Joined: Mon Feb 12, 2018 3:23 pm

Macro scheduler and Eclipse Java SWT window

Post by DevEng » Mon Feb 12, 2018 4:10 pm

I develop using Eclipse [Mars, Java 8 JRE]. As you may know, Eclipse UI has some interface usability issues, and I needed some macros to make quality-of-life improvements. Attached is a snippet showing an issue with SetFocus and this style of window. I have worked with the Windows class and Visual Studio to work with GUI handles before, so I know that Java windows are not really Windows windows :shock: , so it's hard to execute Windows window commands on things that are not really Windows windows. But, I thought I should be able to at least set the focus to the Java window and be able to execute keyboard shortcuts against that window. Also, I tried using the mouse commands after setting the focus, and it would not let me run mouse commands against the Java window.

The following snippet should locate the Windows handle for the Java eclipse instance, focus it, get the screen resolution and move the mouse into the X on the top right-hand corner of the screen (and click it). This is a simple repro for the issue, I certainly would like to do more complicated eclipse shortcuts using macro scheduler. The following code does find the eclipse instance and bring it into the foreground, but the mouse command never executes.I substituted the mouse for a simple keyboard character, and that did not work either.

Code: Select all

Let>WIN_REGEX=1
Let>WIN_USEHANDLE=1
GetWindowHandle>(.*?-) Eclipse,hWnd
Assigned>hWnd,eclipse_found

IF>%eclipse_found%=TRUE
SetFocus>hWnd
WaitWindowFocused>hWnd
GetScreenRes>nWidth,nHeight
Sub>nWidth,10
MouseMove>nWidth,10
LClick
ENDIF
Edit: I decided to make a separate topic for this issue, but I have a suspicion that the reason quickbuttons doesn't work with eclipse is the same reason that macro scheduler is having an issue. So if we could solve one, we might solve two.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Macro scheduler and Eclipse Java SWT window

Post by Marcus Tettmar » Tue Feb 13, 2018 6:37 pm

Before we dive in, can we eliminate the obvious first. Is this app running as Admin? If so, and if Macro Scheduler is not running as admin, you're not going to be able to send keyboard or mouse events to it:

http://help.mjtnet.com/article/11-contr ... n-as-admin
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

DevEng
Newbie
Posts: 3
Joined: Mon Feb 12, 2018 3:23 pm

Re: Macro scheduler and Eclipse Java SWT window

Post by DevEng » Tue Feb 13, 2018 8:07 pm

:oops: That fixed it. Thank you.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts