Finder Window Management in KM Like AppleScript Can Do


#1

Hi all,

I used to be able to control finder windows with AppleScript (inside KM) like this:

set width of column id name column of list view options of Finder window 1 to 750
set width of column id kind column of list view options of Finder window 1 to 153
set width of column id modification date column of list view options of Finder window 1 to 190
set width of column id size column of list view options of Finder window 1 to 99
set sidebar width of window 1 to 200


Q: I am wondering if we can do this type of window control just using KM functions?


#2

hi @dealtek

can you share your applescript for the above manipulations? (and also how you run them in KM macros?)

thx a lot in advance!

Z


#3

I'd love to get that applescript too. Thanks!


#4

See this macro by @ccstone:

Resize Columns in the Finder's List View Macro


#5

Hey @dealtek,

Nyet.

What version of macOS are you using?

-Chris


#6

Here is the OLD AppleScript

BTW: I just execute AppleScript with a key trigger and it would "clean up" any finder window that was selected on the desktop.

Ex: set the active window as icon view and sorted by name ascending and make window small and bottom right corner of what ever - then when you trigger the script it should clean things up.

Problem: not everything works as expected - because this is an old script and some AppleScript commands need updating. That is why I am hoping that KM can do much of this without AS.

Thanks
Dave

-- start AS --

-- otherFolder is just some secondary folder that you jump away from main to this one then back - that was a temp workaround to help activate the changes made on the primary folder

set otherFolder to alias ((path to library folder as text) & "Documentation:")

tell application "Finder"
	activate
	select Finder window 1
	set current view of Finder window 1 to list view
	set bounds of Finder window 1 to {50, 45, 1400, 900}
	set width of column id name column of list view options of Finder window 1 to 750
	set width of column id kind column of list view options of Finder window 1 to 153
	set width of column id modification date column of list view options of Finder window 1 to 190
	set width of column id size column of list view options of Finder window 1 to 99
	set sidebar width of window 1 to 200

-- new for mavericks (see how old this is!)

set frontWindowTarget to target of front window as alias
set sort column of list view options of Finder window 1 to modification date column
set sort direction of column id modification date column of list view options of Finder window 1 to reversed

-- this next step is needed to help activate the main window changes as described above

tell front window
	set its target to otherFolder
	set its target to frontWindowTarget
end tell

end tell

-- end AS --


#7

Currently on High Sierra


#8

Hey @dealtek,

Keyboard Maestro has no specific actions that can take the place of AppleScript in this case.

Apple broke this functionality long ago and has NEVER fixed it... (Bad Apple!)

It can still be made to work under sone circumstances, but you have to have your Finder windows set up just so.

-Chris