Is it me or is Finder scripting broken?


John Stewart
 

Thanks Chris, that’s mostly a winner, at least I can now get and set the property. Hopefully I can eventually get the Finder to respond to the changes. For now I’ll just abort the script and set the preference manually.

JBS


On November 26, 2017 at 8:46:19 PM, Christopher Stone (listmeister@...) wrote:

On 11/26/2017, at 17:09, John Stewart <psamech@...> wrote:
I’m looking at the desktop not just any random Finder window.  I have a script that cleans my desktop by moving file/icons around, it won’t work if the Desktop isn’t set to snap top grid.


Hey John,

Try this:

----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/11/26 19:40
# dMod: 2017/11/26 19:44
# Appl: Finder
# Task: Get Arrangement of Window of Desktop
# Libs: None
# Osax: None
# Tags: @ccstone, @Applescript, @Script, @Finder, @Arrangement, @Window, @Desktop
----------------------------------------------------------------

tell application "Finder"
    tell desktop
        tell its window
            if its current view = icon view then
                tell its icon view options
                    its arrangement
                end tell
            end if
        end tell
    end tell
end tell

----------------------------------------------------------------

--
Best Regards,
Chris


Christopher Stone
 

On 11/26/2017, at 17:09, John Stewart <psamech@...> wrote:
I’m looking at the desktop not just any random Finder window.  I have a script that cleans my desktop by moving file/icons around, it won’t work if the Desktop isn’t set to snap top grid.


Hey John,

Try this:

----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/11/26 19:40
# dMod: 2017/11/26 19:44
# Appl: Finder
# Task: Get Arrangement of Window of Desktop
# Libs: None
# Osax: None
# Tags: @ccstone, @Applescript, @Script, @Finder, @Arrangement, @Window, @Desktop
----------------------------------------------------------------

tell application "Finder"
    tell desktop
        tell its window
            if its current view = icon view then
                tell its icon view options
                    its arrangement
                end tell
            end if
        end tell
    end tell
end tell

----------------------------------------------------------------

--
Best Regards,
Chris


John Stewart
 

Thanks Bob,

That works but doesn’t solve my problems. I’m looking at the desktop not just any random Finder window.  I have a script that cleans my desktop by moving file/icons around, it won’t work if the Desktop isn’t set to snap top grid.

JBS


On November 26, 2017 at 4:01:16 PM, Robert Poland (rpoland@...) wrote:

tell application "Finder"
activate
if ((current view of window index 1) = list view) then
set wdw to window 1
select wdw -- in case the window was not selected
tell wdw to tell its list view options
set m to width of column id modification date column
set width of column id modification date column to m + 1
set m to width of column id modification date column
set s to width of column id size column
set width of column id size column to s + 1
set s to width of column id size column
end tell
end if
end tell


Robert Poland
 



On Nov 26, 2017, at 8:42 AM, John Stewart <psamech@...> wrote:

Can't get or set list, column or icon view properties:

tell
application id "com.apple.finder" -- Finder

get properties of Finder preferences

(* comment out next line to see all properties *)

get icon view options of result (* it's currently set to "snap to grid" but returns missing value *)

--get folders spring open of result (* this works, it's currently set to true *)

end tell


Maybe the following will be of some help;

tell application "Finder"
activate
if ((current view of window index 1) = list view) then
set wdw to window 1
select wdw -- in case the window was not selected
tell wdw to tell its list view options
set m to width of column id modification date column
set width of column id modification date column to m + 1
set m to width of column id modification date column
set s to width of column id size column
set width of column id size column to s + 1
set s to width of column id size column
end tell
end if
end tell

Robert Poland
Fort Collins, CO


John Stewart
 

Can't get or set list, column or icon view properties:

tell
application id "com.apple.finder" -- Finder

get properties of Finder preferences

(* comment out next line to see all properties *)

get icon view options of result (* it's currently set to "snap to grid" but returns missing value *)

--get folders spring open of result (* this works, it's currently set to true *)

end tell