I'm trying to make an applescript that does the following:
1. check how many open finder windows there are (if any)
2. if there are finder windows open then cycle through them when the script is run.
3. if there aren't any open finder windows make a new one.
This is what I've come up with so far:
I've managed to get the Finder Windows to activate incrementally (window 1, then 2, then 3, etc.) as they should. But when it reaches the maximum limit of finder windows it resets the value of the last finder window to the first one, and then procedes to activate them in a decremental fashion. (first window 3, then 2, then 1). I would like to make them cycle again back to the first window and so on.
I could use some help with this,
Thank you in advance.
1. check how many open finder windows there are (if any)
2. if there are finder windows open then cycle through them when the script is run.
3. if there aren't any open finder windows make a new one.
This is what I've come up with so far:
Code:
property finderwindownumber : 1
tell application "Finder"
set TotalNumberOfFinderWindows to (count of (every window where visible is true))
if TotalNumberOfFinderWindows is greater than 0 then
tell application "Finder"
select window finderwindownumber
activate
set finderwindownumber to finderwindownumber + 1
if finderwindownumber is greater than TotalNumberOfFinderWindows then
set finderwindownumber to 1
end if
end tell
else
tell application "Finder" to open home
end if
end tell
I've managed to get the Finder Windows to activate incrementally (window 1, then 2, then 3, etc.) as they should. But when it reaches the maximum limit of finder windows it resets the value of the last finder window to the first one, and then procedes to activate them in a decremental fashion. (first window 3, then 2, then 1). I would like to make them cycle again back to the first window and so on.
I could use some help with this,
Thank you in advance.