← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #674758]: Focus on a app running as a java process from an IDE

 

Question #674758 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/674758

    Status: Open => Answered

RaiMan proposed the following answer:
I am mainly working and developing on Mac and have to admit, that until
now I did nor succeed either, to focus on something, that was started as
a new process from inside an IDE (I use IntelliJ IDEA CE).

A possible solution is to find out some AppleScript snippet (already now
used inside the App implementation partly), that does the job.

A track might be (SikuliX IDE started from inside IDEA)
set myapp to "Sikulix"
tell application "System Events"
	repeat with aProc in (processes)
		if visible of aProc then
			set dispname to displayed name of (get properties of aProc)
			if dispname is equal to myapp then
				log (dispname)
				#log ((get properties of aProc))
				set mywin to first item of windows of aProc
				set focused of mywin to true # this does not work
				delay 3
				log (get properties of mywin)
			end if
			#break
		end if
	end repeat
end tell

... but until now I did not yet find out, how to tell the process, to
come to front ;-)

How to run AppleScripts from inside a script:
https://sikulix-2014.readthedocs.io/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other
... the variant runScript(snippet)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.