Loops through opened windows and re-position them (DASHBOARD)

Hello,

I want to look at all windows that are currently opened. Loop through all of them and those with a specific name they are to be reposition on the screen.

The idea is to create some kind of dashboard for people to execute their tasks. I am taking into account that people never worked with a MAC. Therefore do not know of to open/reposition/minimise/close a window.

The idea is when going through the loop if a window with a specific name appears, make it active and re-position it.

Here is what I’ve been trying to work with. At the moment the window name I am interested are : 101PNV01, SAUVEGARDE and MPEGfiles. The dashboard will be made of about 8 different windows.

  • One FileMaker Pro application window
  • Two SAFARI windows
  • Five FINDER windows

At the moment, for some reason all windows name are equal to “101PNV01”

tell application "System Events"
	set theProcesses to application processes whose visible is true
	repeat with theProcess from 1 to count theProcesses
		tell process theProcess
			repeat with x from 1 to (count windows)
				tell application "Finder"
					activate
					tell the front window to set toolbar visible to false
					if name of front window is equal to "101PNV01" then
						display dialog "101PNV01"
						set bounds of front window to {953, 23, 1280, 401}
					else if name of front window is equal to "SAUVEGARDE" then
						display dialog "SAUVEGARDE"
						set bounds of front window to {952, 401, 1280, 796}
					else if name of front window is equal to "MPEGfiles" then
						display dialog "MPEGfiles"
						set bounds of front window to {952, 301, 1280, 547} -- MPEGfiles
					end if
				end tell
			end repeat
		end tell
	end repeat
end tell

I get to see all opened windows when I run this command alone

tell application "System Events" to get the properties of every window of (every process whose visible is true)

Thanks!

Daniel

I have no help for you at the moment, but the code in your question actually provides useful insight into an unanswered question of mine, so thanks for that!

http://macscripter.net/viewtopic.php?id=45661

You may try :

tell application "System Events"
	set theProcesses to application processes whose visible is true
	repeat with theProcess from 1 to count theProcesses
		tell process theProcess
			repeat with x from 1 to (count windows)
				tell application "Finder"
					activate
					set windowX to window x
					tell windowX to set toolbar visible to false
					set nameX to name of windowX
					if nameX is equal to "101PNV01" then
						display dialog "101PNV01"
						set bounds of windowX to {953, 23, 1280, 401}
					else if nameX is equal to "SAUVEGARDE" then
						display dialog "SAUVEGARDE"
						set bounds of windowX to {952, 401, 1280, 796}
					else if nameX is equal to "MPEGfiles" then
						display dialog "MPEGfiles"
						set bounds of windowX to {952, 301, 1280, 547} -- MPEGfiles
					end if
				end tell
			end repeat
		end tell
	end repeat
end tell

In your original code we loop among the list of indexes but you grabbed always datas from the front window which doesn’t change in the loop.

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) mardi 1 aout 2017 20:07:54