Finder listview (arrange by: Kind & sort by: Name) MacOS Catalina

No quarrelling, unpleasantness, or personal attacks please, gentlemen. You both know the rules here.

Thanks. :slight_smile:

I don’t want that this script causes any trouble… :confused:

I ran the script and got this error:

English Log History:

-- Don't click [Open this Scriplet in your Editor:]

tell application "Script Editor"
	choose folder
		--> alias "macOS:Users:nelson:Downloads:"
end tell
tell current application
	current date
		--> date "Wednesday, 1. January 2020 at 23:47:27"
end tell
tell application "Finder"
	path to current application
		--> alias "macOS:System:Library:CoreServices:Finder.app:"
end tell
tell current application
	localized string "N224" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Kind"
	localized string "N220" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Name"
	localized string "FR11" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Sort By:"
	localized string "N169.39" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "iCloud Status"
	localized string "N169.30" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Date Modified"
	localized string "N169.31" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Date Created"
	localized string "N169.32" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Date Last Opened"
	localized string "N169.38" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Date Added"
	localized string "N169.33" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Size"
	localized string "N169.34" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Version"
	localized string "N169.36" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Comments"
	localized string "N169.37" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Tags"
	localized string "VO15" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Always open in list view"
	localized string "VO19" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Browse in list view"
	localized string "FV2" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Show Toolbar"
	localized string "FV6" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Show Status Bar"
	localized string "FV12" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Show Path Bar"
	localized string "FV13" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Show Sidebar"
	localized string "FV19" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Show Tab Bar"
	localized string "FV23" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Show Preview"
	localized string "6.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "6.title"
	localized string "974.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "974.title"
	localized string "493.ibExternalAccessibilityDescription" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "493.ibExternalAccessibilityDescription"
	localized string "52.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "52.title"
	localized string "54.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "54.title"
	localized string "65.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "65.title"
	localized string "41.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "41.title"
	path to library folder from system domain as text
		--> "macOS:System:Library:"
	localized string "AXButton:AXCloseButton" from table "RoleDescriptions" in bundle file "macOS:System:Library:Frameworks:ApplicationServices.framework:Versions:A:Frameworks:HIServices.framework:Versions:A:Resources:"
		--> "close button"
end tell
tell application "System Events"
	set frontmost of process "Finder" to true
	get every window of process "Finder"
		--> {window "FileManagerLib_stuff copy" of application process "Finder"}
	get subrole of window "FileManagerLib_stuff copy" of application process "Finder"
		--> "AXStandardWindow"
end tell
tell application "Finder"
	open file "macOS:Users:nelson:Downloads:FileManagerLib_stuff copy:"
	get current view of window 1
		--> list view
	set bounds of window 1 to {50, 50, 1100, 600}
		--> {50, 50, 1100, 600}
	get name of alias "macOS:Users:nelson:Downloads:FileManagerLib_stuff copy:"
		--> "FileManagerLib_stuff copy"
end tell
tell application "System Events"
	set frontmost of process "Finder" to true
	get name of every menu item of menu 1 of menu bar item 5 of menu bar 1 of process "Finder"
		--> {"as Icons", "as List", "as Columns", "as Gallery", missing value, "Use Groups", "Sort By", "Clean Up", "Clean Up Selection", "Clean Up By", missing value, "Hide Sidebar", "Show Preview", missing value, "Hide Toolbar", "Show All Tabs", "Show Tab Bar", missing value, "Customize Touch Bar…", "Customize Control Strip…", missing value, "Show Path Bar", "Hide Status Bar", missing value, "Customize Toolbar…", missing value, "Show View Options", "Show Preview Options", "Increase Icon Size", missing value, "Enter Full Screen"}
	keystroke "j" using {command down}
	get name of window 1 of process "Finder"
		--> "FileManagerLib_stuff copy"
	get subrole of window 1 of process "Finder"
		--> "AXSystemFloatingWindow"
	get value of checkbox "Always open in list view" of window 1 of process "Finder"
		--> 1
	get value of checkbox "Browse in list view" of window 1 of process "Finder"
		--> 1
	exists pop up button "Sort By:" of window 1 of process "Finder"
		--> true
	click pop up button "Sort By:" of window 1 of process "Finder"
		--> pop up button "Sort By:" of window "FileManagerLib_stuff copy" of application process "Finder"
	click menu item "Name" of menu 1 of pop up button "Sort By:" of window 1 of process "Finder"
		--> menu item "Name" of menu 1 of pop up button "Sort By:" of window "FileManagerLib_stuff copy" of application process "Finder"
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	exists pop up button "Arrange By:" of window 1 of process "Finder"
		--> false
	click pop up button "Arrange By:" of window 1 of process "Finder"
		--> error number -1728 from pop up button "Arrange By:" of window 1 of process "Finder"
Result:
error "System Events got an error: Can’t get pop up button \"Arrange By:\" of window 1 of process \"Finder\"." number -1728 from pop up button "Arrange By:" of window 1 of process "Finder"

German Log History:

-- Don't click [Open this Scriplet in your Editor:]

tell application "Script Editor"
    choose folder
        --> alias "macOS:Users:nelson:Downloads:"
end tell
tell current application
    current date
        --> date "Mittwoch, 1. Januar 2020 um 23:35:41"
end tell
tell application "Finder"
    path to current application
        --> alias "macOS:System:Library:CoreServices:Finder.app:"
end tell
tell current application
    localized string "N224" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Art"
    localized string "N220" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Name"
    localized string "FR11" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Sortiert nach:"
    localized string "N169.39" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "iCloud-Status"
    localized string "N169.30" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Änderungsdatum"
    localized string "N169.31" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Erstellungsdatum"
    localized string "N169.32" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Zuletzt geöffnet"
    localized string "N169.38" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Hinzugefügt am"
    localized string "N169.33" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Größe"
    localized string "N169.34" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Version"
    localized string "N169.36" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Kommentare"
    localized string "N169.37" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Tags"
    localized string "VO15" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Immer in Listendarstellung öffnen"
    localized string "VO19" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "In Listendarstellung blättern"
    localized string "FV2" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Symbolleiste einblenden"
    localized string "FV6" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Statusleiste einblenden"
    localized string "FV12" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Pfadleiste einblenden"
    localized string "FV13" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Seitenleiste einblenden"
    localized string "FV19" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Tableiste einblenden"
    localized string "FV23" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Vorschau einblenden"
    localized string "6.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Als Standard verwenden"
    localized string "974.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "974.title"
    localized string "493.ibExternalAccessibilityDescription" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Große Symbole"
    localized string "52.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Textgröße:"
    localized string "54.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Relatives Datum verwenden"
    localized string "65.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Alle Größen berechnen"
    localized string "41.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
        --> "Symbolvorschau einblenden"
    path to library folder from system domain as text
        --> "macOS:System:Library:"
    localized string "AXButton:AXCloseButton" from table "RoleDescriptions" in bundle file "macOS:System:Library:Frameworks:ApplicationServices.framework:Versions:A:Frameworks:HIServices.framework:Versions:A:Resources:"
        --> "Schließen-Taste"
end tell
tell application "System Events"
    set frontmost of process "Finder" to true
    get every window of process "Finder"
        --> {window "MesseHallen" of application process "Finder"}
    get subrole of window "MesseHallen" of application process "Finder"
        --> "AXStandardWindow"
end tell
tell application "Finder"
    open file "macOS:Users:nelson:Downloads:FileManagerLib_stuff copy:"
    get current view of window 1
        --> list view
    set bounds of window 1 to {50, 50, 1100, 600}
        --> {50, 50, 1100, 600}
    get name of alias "macOS:Users:nelson:Downloads:FileManagerLib_stuff copy:"
        --> "FileManagerLib_stuff copy"
end tell
tell application "System Events"
    set frontmost of process "Finder" to true
    get name of every menu item of menu 1 of menu bar item 5 of menu bar 1 of process "Finder"
        --> {"Als Symbole", "Als Liste", "Als Spalten", "als Galerie", missing value, "Gruppen verwenden", "Sortieren nach", "Aufräumen", "Auswahl aufräumen", "Aufräumen nach", missing value, "Seitenleiste ausblenden", "Vorschau einblenden", missing value, "Symbolleiste ausblenden", "Alle Tabs einblenden", "Tableiste einblenden", "Touch Bar anpassen …", "Control Strip anpassen …", "Pfadleiste einblenden", "Statusleiste ausblenden", missing value, "Symbolleiste anpassen …", missing value, "Darstellungsoptionen einblenden", "Vorschauoptionen einblenden", "Symbole vergrößern", missing value, "Vollbildmodus"}
    keystroke "j" using {command down}
    get name of window 1 of process "Finder"
        --> "FileManagerLib_stuff copy"
    get subrole of window 1 of process "Finder"
        --> "AXSystemFloatingWindow"
    get value of checkbox "Immer in Listendarstellung öffnen" of window 1 of process "Finder"
        --> 1
    get value of checkbox "In Listendarstellung blättern" of window 1 of process "Finder"
        --> 1
    exists pop up button "Sortiert nach:" of window 1 of process "Finder"
        --> true
    click pop up button "Sortiert nach:" of window 1 of process "Finder"
        --> pop up button "Sortiert nach:" of window "FileManagerLib_stuff copy" of application process "Finder"
    click menu item "Name" of menu 1 of pop up button "Sortiert nach:" of window 1 of process "Finder"
        --> menu item "Name" of menu 1 of pop up button "Sortiert nach:" of window "FileManagerLib_stuff copy" of application process "Finder"
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    exists pop up button "Arrange By:" of window 1 of process "Finder"
        --> false
    click pop up button "Arrange By:" of window 1 of process "Finder"
        --> error number -1728 from pop up button "Arrange By:" of window 1 of process "Finder"
Ergebnis:
error "„System Events“ hat einen Fehler erhalten: „pop up button \"Arrange By:\" of window 1 of process \"Finder\"“ kann nicht gelesen werden." number -1728 from pop up button "Arrange By:" of window 1 of process "Finder"

I tried to understand…

Borrowed from message #27 by Flavour

 
# Don't click [Open this Scriplet in your ] this is a log history
# Running Catalina in English
  localized string "6.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "6.title"
   localized string "974.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "974.title"
   localized string "493.ibExternalAccessibilityDescription" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "493.ibExternalAccessibilityDescription"
   localized string "52.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "52.title"
   (*text size:*)
   localized string "191.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "191.title"
   (*text size:*)
   localized string "101.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "101.title"
   (*text size:*)
   localized string "396.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "396.title"
   (*text size:*)
   localized string "54.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "54.title"
   localized string "65.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "65.title"
   localized string "41.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "41.title"
   (*Show icon preview*)
   localized string "402.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "402.title"
   (*Show icon preview*)
   localized string "104.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "104.title"
   (*Show icon preview*)
   localized string "205.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "205.title"
   (*Show icon preview*)


Running Catalina in German

   localized string "6.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Als Standard verwenden"
   localized string "974.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "974.title"
   localized string "493.ibExternalAccessibilityDescription" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Große Symbole"
   localized string "52.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Textgröße:"
   (*Textgröße:*)
   localized string "191.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Textgröße:"
   (*Textgröße:*)
   localized string "101.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Textgröße:"
   (*Textgröße:*)
   localized string "396.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Textgröße:"
   (*Textgröße:*)
   localized string "54.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Relatives Datum verwenden"
   localized string "65.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Alle Größen berechnen"
   localized string "41.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Symbolvorschau einblenden"
   (*Symbolvorschau einblenden*)
   localized string "402.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Symbolvorschau einblenden"
   (*Symbolvorschau einblenden*)
   localized string "104.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Symbolvorschau einblenden"
   (*Symbolvorschau einblenden*)
   localized string "205.title" from table "ViewOptionsWindow" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
       --> "Symbolvorschau einblenden"
   (*Symbolvorschau einblenden*)

As you may see, the triggered keys exist and have no English value available.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 2 janvier 2020 09:28:50

I will help you little:

for English “6.title” (that is, Use as defaults) use German

click UI Element "Als Standard verwenden" of window 1 of application process "Finder"

for English 974.title (that is, Group by) use German

click menu item "Gruppen verwenden" of menu 1 of menu bar item "Darstellung" of menu bar 1 of application process "Finder"

for large icons size use universal

click radio button 2 of group 1 of window 1 of application process "Finder"

for English Use relative dates use German

click checkbox "Relatives Datum verwenden" of group 1 of window 1 of application process "Finder"

for Text size use universal

click pop up button 1 of group 1 of window 1 of application process "Finder"

for Calculate all sizes use universal

click checkbox 12 of group 1 of window 1 of application process "Finder"

Generally, all UI Elements of group 1 of window 1 of application process “Finder”:

– {static text “Symbolgröße:” of group 1 of window 1 of application process “Finder” of application “System Events”, button 1 of group 1 of window 1 of application process “Finder” of application “System Events”, button 2 of group 1 of window 1 of application process “Finder” of application “System Events”, radio button 1 of group 1 of window 1 of application process “Finder” of application “System Events”, radio button 2 of group 1 of window 1 of application process “Finder” of application “System Events”, static text “Textgröße:” of group 1 of window 1 of application process “Finder” of application “System Events”, pop up button “Textgröße:” of group 1 of window 1 of application process “Finder” of application “System Events”, static text “Spaltenanzeige:” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “iCloud-Status” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Änderungsdatum” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Erstellungsdatum” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Zuletzt geöffnet” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Hinzugefügt am” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Größe” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Art” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Version” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Kommentare” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Tags” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Relatives Datum verwenden” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Alle Größen berechnen” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Symbolvorschau einblenden” of group 1 of window 1 of application process “Finder” of application “System Events”, checkbox “Ordner „Library“ anzeigen” of group 1 of window 1 of application process “Finder” of application “System Events”}

As you can see, some UI Elements doesn’t have name at all. They doesn’t have even the properties:

{“Symbolgröße:”, missing value, missing value, missing value, missing value, “Textgröße:”, “Textgröße:”, “Spaltenanzeige:”, “iCloud-Status”, “Änderungsdatum”, “Erstellungsdatum”, “Zuletzt geöffnet”, “Hinzugefügt am”, “Größe”, “Art”, “Version”, “Kommentare”, “Tags”, “Relatives Datum verwenden”, “Alle Größen berechnen”, “Symbolvorschau einblenden”, “Ordner „Library“ anzeigen”}

Both posts are now deleted. Do NOT throw insults around on this forum or continue this personal quarrel.

In Finder’s resources, we may see:

in English.lproj High Sierra
InfoPlist.strings
Localizable.strings
ServicesMenu.strings
SimpleGrouping.strings
SlicesAttributeNameOverrides.strings
SlicesStrings.strings

in French.lproj High Sierra
AboutWindow.strings
AirDropCollectionView.strings
AirDropDiscoverableModePopoverView.strings
AirDropIconView.strings
AirDropInfoView.strings
AirDropLegacyModePopoverView.strings
AirDropNotAvailableView.strings
ArrangeByMenu.strings
BannerView.strings
BulkRenameWindow.strings
ClipWindow.strings
ColumnCellView.strings
ColumnPreview.strings
ColumnView.strings
DecryptionPasswordSheet.strings
FFKBrowserWindow.strings
FFKMenuBar.strings
GotoWindow.strings
GroupNameField.strings
ICloudNoDocumentsView.strings
iCloudQuotaBanner.strings
ICloudSetupView.strings
ICloudUpgradeView.strings
IconCollectionGroupHeaderView.strings

InfoPlist.strings
ListView.strings
Localizable.strings
NavChooseApp.strings
PreferencesWindow.strings
ProgressErrorView.strings
ProgressStatusView.strings
ProgressStatusView2Line.strings
SearchCriteriaSheet.strings
SearchForSlice.strings
SearchScopeSlice.strings

ServicesMenu.strings
SidebarView.strings
SimpleGrouping.strings
SlicesAttributeNameOverrides.strings
SlicesStrings.strings
StatusBar.strings
TagColumnTableView.strings
TagsPrefCellView.strings
Toolbar.strings
ViewOptionsWindow.strings

in en.lproj Catalina
InfoPlist.strings
Localizable.strings
ServicesMenu.strings
SimpleGrouping.strings
SlicesAttributeNameOverrides.strings
SlicesStrings.strings

in en_AU.lproj, en_GB, en.lpoj Catalina
AboutWindow.strings
AFPUserGroupSheet.strings
AirDropCollectionView.strings
AirDropDiscoverableModePopoverView.strings
AirDropIconView.strings
AirDropInfoView.strings
AirDropLegacyModePopoverView.strings
AirDropNotAvailableView.strings
AirDropProgressView.strings
ArrangeByMenu.strings
BackupVolumeBrowserWindow.strings
BannerView.strings
BulkRenameWindow.strings
Burn.strings
ChooseAppAccessoryView.strings
ClipWindow.strings
ColumnPreview.strings
ColumnView.strings
CompressionPasswordSheet.strings
ConnectToWindow.strings
DecryptionPasswordSheet.strings
EncryptionPasswordSheet.strings
GalleryCollectionView.strings
GotoWindow.strings
ICloudNoDocumentsView.strings
iCloudQuotaBanner.strings
ICloudSetupView.strings
ICloudUpgradeView.strings
IconCollectionGroupHeaderView.strings
IconCollectionView.strings

InfoPlist.strings
InfoWindowApplyToWindow.strings
InfoWindowBurningView.strings
InfoWindowCommentsView.strings
InfoWindowGeneralView.strings
InfoWindowMoreInfoView.strings
InfoWindowNameView.strings
InfoWindowOpenWithView.strings
InfoWindowPermissionsView.strings
InfoWindowPreviewView.strings
InfoWindowSimpleHeaderView.strings
InfoWindowTaggingHeaderView.strings
ListView.strings
LoadingView.strings

Localizable.strings
MenuBar.strings
NavChooseApp.strings
NavSaveSearch.strings
PBFNewMediaWindow.strings
PreferencesWindow.strings
PreviewOptionsWindow.strings
ProgressErrorView.strings
ProgressStatusView.strings
ProgressStatusView2Line.strings
SearchCriteriaSheet.strings
SearchForSlice.strings
SearchScopeSlice.strings

ServicesMenu.strings
SidebarView.strings
SimpleGrouping.strings
SlicesAttributeNameOverrides.strings
SlicesStrings.strings
StatusBar.strings
TagColumnTableView.strings
TaggingPopoverContentView.strings
TagsPrefCellView.strings
TagSuggestionsView.strings
Toolbar.strings
ViewOptionsWindow.strings

The .strings files unavailable in the default English.lproj (High Sierra), en.lproj (Catalina) are italicized. They are numerous ones.
The needed ViewOptionsWindow.strings is bolded-italicized in both cases.

If somebody know where are defined the strings unavailable in the default English.lproj (High Sierra) or en.lproj (Catalina) I would be glad to get the info.

On the other hand, as we saw before, the organization of the UI may vary from one system to an other.
Here, radio buttons which where in a radio group of group 1 in High Sierra are directly in group 1 in Catalina.
Relying upon UI elements indexes is not guaranteed to be stable.
This is why I choose to trigger these elements by their name when they have one.
When they haven’t - radio buttons - I use the item description to be sure that I trigger the correct one.
Just matter of safety.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 2 janvier 2020 11:18:18

You don’t understand. Some UI Elements doesn’t have name at all. And they have not properties too, so you can’t use item description. So, like you or not you should use indexes for them. And, using the names instead of the indexes doesn’t increase the safety. For example, when the hierarchy of UI elements changes from system to system.

Instead, it is best to implement the maximum number of functions (that can be implemented) without GUI scripting.

You can set without GUI scripting:

  1. calculates folder sizes
  2. icon size
  3. show icon preview
  4. sort column
  5. text size
  6. uses relative dates

I will get you once again the starting point, without third-party software:


property pathList : {}

tell application "Finder" to set aFolders to (selection) as alias list
repeat with aFolder in aFolders
	my get_All_Folders_of_Folder(aFolder)
end repeat

tell application "Finder"
	activate
	repeat with aFolder in the pathList
		open aFolder
		tell container window of folder aFolder
			set current view to list view
			set statusbar visible to true
			tell its list view options
				set s to its properties
				set its calculates folder sizes to true
				set its icon size to large icon
				set its shows icon preview to true
				set its sort column to column id name column
				set sort direction of sort column to normal
				set width of sort column to 600
				set its text size to 12
				set its uses relative dates to true
			end tell
		end tell
		delay 5 -- only to see what we doing
		close window 1
	end repeat
end tell


on get_All_Folders_of_Folder(aFolder)
	tell application "System Events"
		--Check each of the files in this disk/folder
		set foldersList to every folder of aFolder
		set the end of pathList to (path of aFolder)
		if foldersList is not {} then
			repeat with aFolder in foldersList
				my get_All_Folders_of_Folder(aFolder)
			end repeat
		end if
	end tell
end get_All_Folders_of_Folder

Really simple.

In High Sierra, Arrange By: is defined in two resources:
Organiser par N148 Arrange By SSD 1000:System:Library:CoreServices:Finder.app:Contents:Resources:French.lproj:Localizable.strings
Organiser par : 974.title ENGLISH KEY UNAVAILABLE SSD 1000:System:Library:CoreServices:Finder.app:Contents:Resources:French.lproj:ViewOptionsWindow.strings

I used the key 974.title which appears to be unavailable in Catalina.
Happily, the key N148 is available but not in the en.lproj

You may check that with this script:

set theBundle to path to application "Finder" --> an alias

set aKey to "N148"
set arrangeBy_loc to localized string aKey in bundle theBundle
--> "Gruppieren nach"
--> "N148"
if arrangeBy_loc = aKey then set arrangeBy_loc to "Arrange By:"
log arrangeBy_loc
--> "Gruppieren nach"
--> "Arrange By"

set aKey to "974.title"
set arrangeBy_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
--> "974.title"
--> "974.title"
-- In English, the resource isn't available -> "974.title". Define it here.
if arrangeBy_loc = aKey then set arrangeBy_loc to "Arrange By:"
log arrangeBy_loc
--> "Arrange By:"
--> "Arrange By:"

The Key “N148” is usable in both systems.

Message #16 is modified accordingly.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 2 janvier 2020 12:58:36

Thanks to both of you!

Yvan can you tell me where and how to you find the localized strings?

I ran the script under HighSierra (Eng&Ger) and under Catalina (Eng & Ger).
In both systems I got the same error like in post #33

May I should activate Arrange by:kind manually with the keystrokes…
I can’t understand why it doesn’t work when none (german: ohne) is set.
It would be so great if the script does what we (in that case I) want.

But it is interesting to see how things work (or not) and to learn a lot in this forum.
Thanks for that! :slight_smile:

Having been looking at this myself this morning, I’ve found that neither Yvan’s or KniazidisR’s original scripts work on my Mojave system. Yvan’s tries to read the variable ‘byKind’, which hasn’t been set, and KniazidisR’s clicks a menu item called “Use Groups”, which doesn’t exist in that menu on my system.

Yvan’s Catalina-friendly version (post #6) does work on my machine, but uses more GUI Scripting than is strictly necessary (as I see KniazidisR’s now realised).

As chance would have it, Shane posted some handlers on the Late Night Software fora a day or two ago which do a fair job of translating strings for GUI Scripting. In particular, they work for the Finder term “Kind”. Here’s my entry into the fray. It uses Shane’s Library and two of the handlers I mentioned and uses Finder scripting to set the list view and sort column. GUI Scripting is only used for grouping. It seems to be slightly faster than Yvan’s post #6 script. Most of its bulk is the handler which translates “Kind” into the local language. :wink:

use AppleScript version "2.5" -- macOS 10.11 or later
use framework "Foundation"
use script "FileManagerLib"
use scripting additions

-- Get the local string for "Kind".
property dictCache : missing value -- we cache strings dictionaries here to speed multiple look-ups a bit
set byKind to my localizedStringForEnglish:"Kind" inBundle:(path to application "Finder")
-- The above handler returns missing value for "None" and "none" for "none" in Mojave. The following line's in case "Group by:" ever needs to be cancelled.
if ((byKind is missing value) or (byKind is "none")) then set byKind to 1

set theFolder to (choose folder)
set PosixPath to POSIX path of theFolder

set theFolders to objects of PosixPath result type files list with searching subfolders without include files and include invisible items -- Requires FileManagerLib.
set end of theFolders to theFolder

repeat with aFolder in theFolders
	tell application "Finder"
		set thisWindow to (make new Finder window to aFolder)
		tell thisWindow's list view options to set sort column to name column -- This won't take effect until the next time the window's opened.
		set thisWindow's current view to list view
	end tell
	tell application "System Events"
		tell application process "Finder"
			set frontmost to true
			keystroke "j" using {command down}
			repeat until (subrole of window 1 is "AXSystemFloatingWindow")
				delay 0.1
			end repeat
			tell pop up button 1 of window 1
				click
				repeat until menu 1 exists
					delay 0.1
				end repeat
				click menu item byKind of menu 1
			end tell
			keystroke "j" using {command down}
			--repeat while (subrole of window 1 is "AXSystemFloatingWindow")
			--	delay 0.1
			-- end repeat
		end tell
	end tell
	tell application "Finder" to close thisWindow
end repeat

-- Handlers by Shane Stanley <https://forum.latenightsw.com/t/localizing-gui-scripts/2246>:

-- use this if you have the English name and it is in the standard Localized.strings file
on localizedStringForEnglish:enString inBundle:fileOrNSURL
	set langID to current application's NSLocale's currentLocale()'s localeIdentifier()
	return my localizedStringFor:enString fromTable:"" inBundle:fileOrNSURL destLang:langID sourceLang:"en"
end localizedStringForEnglish:inBundle:
-- use this if you also want to specify a particular .strings file. A destLangCode of "" means the current locale, and a stringsFileName of "" means the default Localizable.strings file
on localizedStringFor:baseString fromTable:stringsFileName inBundle:fileOrNSURL destLang:destLangCode sourceLang:sourceLangCode
	if stringsFileName is "" then set stringsFileName to "Localizable"
	set theBundle to current application's NSBundle's bundleWithURL:fileOrNSURL
	set sourceLangString to current application's NSString's stringWithString:sourceLangCode
	-- make key to search for cached values
	set cacheKey to current application's NSString's stringWithFormat_("%@_%@_%@", theBundle's bundleIdentifier(), stringsFileName, sourceLangCode)
	if my dictCache is missing value then set my dictCache to current application's NSMutableDictionary's dictionary()
	-- get source strings values
	set sourceDict to dictCache's objectForKey:cacheKey
	if sourceDict = missing value then
		set sourceURL to theBundle's URLForResource:stringsFileName withExtension:"strings" subdirectory:"" localization:sourceLangString
		if sourceURL is missing value and (sourceLangString's containsString:"_") as boolean then
			-- try stripping off country-specific part
			set sourceLangString to sourceLangString's substringToIndex:2
			set sourceURL to theBundle's URLForResource:stringsFileName withExtension:"strings" subdirectory:"" localization:sourceLangString
		end if
		if sourceURL is missing value then
			-- try long name for localization
			set sourceLangString to (current application's NSLocale's localeWithLocaleIdentifier:"en")'s localizedStringForLocaleIdentifier:sourceLangString
			set sourceURL to theBundle's URLForResource:stringsFileName withExtension:"strings" subdirectory:"" localization:sourceLangString
		end if
		if sourceURL is missing value then error "No " & sourceLangCode & " localization found"
		set theData to current application's NSData's alloc()'s initWithContentsOfURL:sourceURL
		if theData is missing value then error "No " & sourceLangCode & " localization found"
		set sourceDict to (current application's NSPropertyListSerialization's propertyListWithData:theData options:0 format:0 |error|:(missing value))
		dictCache's setObject:sourceDict forKey:cacheKey
	end if
	-- make key to search for cached values
	set cacheKey to current application's NSString's stringWithFormat_("%@_%@_%@", theBundle's bundleIdentifier(), stringsFileName, destLangCode)
	-- get dest strings values
	set destDict to dictCache's objectForKey:cacheKey
	if destDict = missing value then
		if destLangCode is "" then
			set destLangString to current application's NSLocale's currentLocale()'s localeIdentifier()
		else
			set destLangString to current application's NSString's stringWithString:destLangCode
		end if
		set localURL to theBundle's URLForResource:stringsFileName withExtension:"strings" subdirectory:"" localization:destLangString
		if localURL is missing value and (destLangString's containsString:"_") as boolean then
			-- try stripping off country-specific part
			set destLangString to destLangString's substringToIndex:2
			set localURL to theBundle's URLForResource:stringsFileName withExtension:"strings" subdirectory:"" localization:destLangString
		end if
		if localURL is missing value then
			-- try long name for localization
			set destLangString to (current application's NSLocale's localeWithLocaleIdentifier:"en")'s localizedStringForLocaleIdentifier:destLangString
			set localURL to theBundle's URLForResource:stringsFileName withExtension:"strings" subdirectory:"" localization:destLangString
		end if
		if localURL is missing value then error "No " & destLangCode & " localization found"
		
		set theData to current application's NSData's alloc()'s initWithContentsOfURL:localURL
		if theData is missing value then error "No " & destLangCode & " localization found"
		set destDict to (current application's NSPropertyListSerialization's propertyListWithData:theData options:0 format:0 |error|:(missing value))
		dictCache's setObject:destDict forKey:cacheKey
	end if
	-- convert from source to dest
	set destValue to destDict's objectForKey:((sourceDict's allKeysForObject:baseString)'s firstObject())
	if destValue is not missing value then set destValue to destValue as text
	return destValue
end localizedStringFor:fromTable:inBundle:destLang:sourceLang:

Hello Nigel

I missed the fact that the key “N224” is not reachable from the English resources in Catalina.

I edited message #16 which contain now:

if (system attribute "sys2") < 14 then
		-- Here with High Sierra or older. Tested with 10.13.6
		set o's kind_loc to localized string "N224" in bundle theBundle
	else
		-- Here with Mojave or newer -- tested with Catalina
		set o's kind_loc to localized string "119.title" from table "ArrangeByMenu" in bundle theBundle
	end if

Would be glad to know if it’s Ok for Mojave.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 2 janvier 2020 16:15:10

Hi Yvan.

Both of those ‘localized string’ commands return “Kind” on my Mojave system. But I don’t know if that’s because both search locations are native to Mojave or because one of them wasn’t deleted during an upgrade from an earlier OS version.

My fault. I read too fast your previous message.

The problem wasn’t with “Kind” but with “Arrange By:”

if (system attribute "sys2") < 14 then
		-- Here with High Sierra or older systems
		set aKey to "974.title"
		set o's arrangeBy_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
		-- In English, the resource isn't available -> "974.title". Define it here.
		if o's arrangeBy_loc = aKey then set o's arrangeBy_loc to "Arrange By:"
		log o's arrangeBy_loc --> "Arrange By:"
	else
		-- Here under Mojave or newer (tested with Catalina)
		set aKey to "V026"
		set arrangeBy_loc to localized string aKey in bundle theBundle --> "Grouper par :" (Catalina)
	end if

Would be glad how it works under Mojave.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 2 janvier 2020 18:02:31

Hi Yvan.

The result is “V026” on my Mojave system.

If I change the first line to include Mojave systems too, the result is “Group By:”, which is the correct English label for the first pop-up menu in Mojave’s View Options window and for the equivalent button in Finder window toolbars.

On my El Capitan system, that label is “Arrange By:”. Your code returns the correct string there by virtue of the ‘if o’s arrangeBy_loc = aKey …’ line.

Thanks.

I will edit the test.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 2 janvier 2020 21:50:12

Sorry for the late reply!
On the earlier version (after post #42) the script did exactly what I wanted under Catalina.

That is so great. Thanks to all of YOU and a special thanks to Yvan.

Now I tested the script you posted a few hours ago.

  • Under HighSierra it works perfectly.
  • Under Catalina I get this error:

@ Flavour.

What gives the late version in message #16 ?

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 2 janvier 2020 23:52:07

I’m an ass, the key is not supposed to be V026 but VO26.

The message #16 is edited accordingly.

You may run this simple test:

set theBundle to path to application "Finder" --> an alias
script o
property arrangeBy_loc : ""
end

if (system attribute "sys2") < 14 then
	set aKey to "974.title"
	set o's arrangeBy_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "974.title". Define it here.
	if o's arrangeBy_loc = aKey then set o's arrangeBy_loc to "Arrange By:"
	log o's arrangeBy_loc --> "Arrange By:"
else
	set aKey to "VO26" -- with the letter "O", not the digit "0"
	set o's arrangeBy_loc to localized string aKey in bundle theBundle --> "Grouper par :" (Catalina)
	log o's arrangeBy_loc --> "Arrange By:"
end if


(*
table Localizable.string in en.lproj (English)
	<key>VO26</key>
	<string>Group By:</string>
table Localizable.string in de.lproj (German)
	<key>VO26</key>
	<string>Gruppieren nach:</string>
table Localizable.string in fr.lproj (French)
<key>VO26</key>
	<string>Grouper par :</string>
*)

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 3 janvier 2020 04:18:29

added the script objet named o

Thank you Yvan!

Now the script does exactly what I want under Catalina.
That is so great.

Now I have two questions:

  1. Where and how do you find the localized strings for the Finder-App?
    like: “VO26”, “6.title” or “N224” in
  1. If Apple decides to make some changes in future macOS versions like 10.16, 10.17, etc.
    may it will be necessary to make some changes in this script (for example: localized strings).
    Did I understand it right?

I ran the test and got this:

-- Don't click [Open this Scriplet in your Editor:]
tell application "Finder"
	path to current application
		--> error number -1708
	«event ascrgdut»
		--> error number -1708
	path to current application
		--> alias "macOS:System:Library:CoreServices:Finder.app:"
end tell
tell current application
	system attribute "sys2"
		--> 15
	localized string "VO26" in bundle alias "macOS:System:Library:CoreServices:Finder.app:"
		--> "Group By:"
Result:
error "The variable o is not defined." number -2753 from "o"

Oops I forgot the three instructions defining the script object.

message #49 is edited accordingly.

Some of these days, I will create a thread in which I will post the script which I use since I discovered that my good old friend EasyFind is unable to search in the resources files delivered by Apple.

I just wish to make some complementary tests because I found a case where it return a wrong result.

When I had access to my grand daughter Catalina macBook, I borrowed its folder “/System/Library/” so know I may also search in Catalina resources.
As I dislike wasting space, I am busy removing every files which aren’t relevant for this task.

Working upon your question was a good opportunity to check my script.
Now, I will be able to remove every code using GUI Scripting for tasks which may be achieved by plain Applescript code.

I already knew the cases wher the English resource related to a keyString is not reachable.
I already faced GUI changes introduced in 10.9, 10.10, 10.11, 10.12 and 10.13.
I assumed that change were introduced by 10.14 and 10.15 but I ignored which they are.

I would be glad if somebody is fair enough to send me a copy of the folder “/System/Library/” belonging to Mojave.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 3 janvier 2020 15:05:48