Determine Location Of Open Apps

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Determine Location Of Open Apps

Post by johnmiller1950 » Sun Oct 18, 2015 7:21 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Determine Location Of Open Apps

Post by Simon » Sun Oct 18, 2015 8:03 pm

Hi John,
Are these both liveCode apps?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Re: Determine Location Of Open Apps

Post by johnmiller1950 » Sun Oct 18, 2015 11:20 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Determine Location Of Open Apps

Post by Simon » Mon Oct 19, 2015 12:45 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Re: Determine Location Of Open Apps

Post by johnmiller1950 » Mon Oct 19, 2015 10:57 am

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.

SparkOut
Posts: 2949
Joined: Sun Sep 23, 2007 4:58 pm

Re: Determine Location Of Open Apps

Post by SparkOut » Mon Oct 19, 2015 6:31 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Determine Location Of Open Apps

Post by FourthWorld » Mon Oct 19, 2015 8:38 pm

Which platform is this for?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Re: Determine Location Of Open Apps

Post by johnmiller1950 » Tue Oct 20, 2015 5:05 pm

This needs to work on both Macs and Windows.

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Re: Determine Location Of Open Apps

Post by johnmiller1950 » Tue Oct 20, 2015 5:08 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Determine Location Of Open Apps

Post by FourthWorld » Tue Oct 20, 2015 9:53 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply