Page 1 of 1

Determine Location Of Open Apps

Posted: Sun Oct 18, 2015 7:21 pm
by johnmiller1950
Good Afternoon All,

I would like to open an app with a very small window and then open a different app that is located very precisely next to the first one. Is there a way to determine the names of all open apps and their corresponding windows using liveCode. I have tried "openProcesses" with no success.

Thanks for your help.

John Miller

Re: Determine Location Of Open Apps

Posted: Sun Oct 18, 2015 8:03 pm
by Simon
Hi John,
Are these both liveCode apps?

Simon

Re: Determine Location Of Open Apps

Posted: Sun Oct 18, 2015 11:20 pm
by johnmiller1950
Simon,

Yes, right now I have two apps, both liveCode. In the future there will be several more, and I want to be able to tell which ones are open and the rect of each app window.
In programming mode I can use openprocesses or just refer to the stack, but once I compile them as stand alone apps, I don't seem to be able to do this.

John

Re: Determine Location Of Open Apps

Posted: Mon Oct 19, 2015 12:45 am
by Simon
Hi John,
And they must be standalones?
My thinking is you have one app and sub-stacks that open as separate standalone looking things. Then the control is easy.

I'm unsure how one would do it via shell.

Simon

Re: Determine Location Of Open Apps

Posted: Mon Oct 19, 2015 10:57 am
by johnmiller1950
In this situation, I need to keep them as separate stand alone applications. I was hoping there might be a way to read the openprocesses.

Re: Determine Location Of Open Apps

Posted: Mon Oct 19, 2015 6:31 pm
by SparkOut
Can you open one from the other, by calling a shell command to launch the second app from the first?
If so, to could pass the window id of the first to the second as an argument of the start shell command. Then the second can use that to line up.
You could also use a shared data area for each app to write its own rect into a file, and clean up the file when the app closes. Each app could use "the files" to see what apps have written a file (therefore open) and read the other apps' rects.

Re: Determine Location Of Open Apps

Posted: Mon Oct 19, 2015 8:38 pm
by FourthWorld
Which platform is this for?

Re: Determine Location Of Open Apps

Posted: Tue Oct 20, 2015 5:05 pm
by johnmiller1950
This needs to work on both Macs and Windows.

Re: Determine Location Of Open Apps

Posted: Tue Oct 20, 2015 5:08 pm
by johnmiller1950
Spark out,

Over the weekend I decided to do just what you suggested. When my app opens it writes its rect to a text file, and when it closes, it deletes the file.
Great minds (???) must think alike.

However, it sure seems that livecode should be able to know this info.

Thanks for you thoughts and suggestions.

John

Re: Determine Location Of Open Apps

Posted: Tue Oct 20, 2015 9:53 pm
by FourthWorld
johnmiller1950 wrote:However, it sure seems that livecode should be able to know this info.
You may be able to obtain that info using LC's shell function to call the respective command line tools on Windows and Mac for that.

But using files works, and not much harder to use sockets to communicate between LC instances too.