Hey Everyone,
Is it possible to get a list of all windows that are open on a users computer? Reason for this is I want to auto update my application but can't overwrite the application while it is still open. So I create a second executable called update_installer. So when the user selects they want to update the application I launch update_installer and close the main application. First thing I want to do in the update_installer app is check if the main application is still open and wait till it has been closed. Problem is that I can't seem to figure out if the window is open because I don't know how to access a list of all open windows.
Other thing is I need the solution to work on PC and MAC.
Any help would be great.
Get a list of non-livecode windows
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Get a list of non-livecode windows
Howdy CenturyMan!
Have a look at this forum thread... I think it might point you in the right general direction:
http://forums.runrev.com/viewtopic.php?f=7&t=13348
Regards,
Doc
Have a look at this forum thread... I think it might point you in the right general direction:
http://forums.runrev.com/viewtopic.php?f=7&t=13348
Regards,
Doc
-
- Posts: 86
- Joined: Tue May 15, 2012 5:56 pm
Re: Get a list of non-livecode windows
That is exactly what I was looking for. I did have to modify the code for the windows side since it would not display the whole service name for services that had a space in the name.
Here is the updated code,
Here is the updated code,
Code: Select all
function programs
if the platform is "MacOS" then -- only OSX!
put shell("ps -xcw") into myList
put offset("COMMAND",myList) into myColPos
repeat for each line myLine in myList
put char myColPos to -1 of myLine & cr after myNewList
end repeat
filter myNewList without "(*"
return line 2 to -1 of myNewList
else if the platform is "Win32" then
put line 4 to -1 of shell("tasklist /FO CSV") into myList
set the itemDelimiter to ","
repeat for each line myLine in myList
put char 2 to -2 of item 1 of myLine & cr after myNewList
end repeat
return line 1 to -2 of myNewList
else
return empty
end if
end programs