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

Tomorrow I will try to understand why “Arrange by” doesn’t work.
It’s curious because as far as I know, shortcuts aren’t localization dependent.

Here, it does the job.
Easy to check because I always use “Arranged by : None”

Maybe I will reactivate the original scheme in which I didn’t used the shortcut but the dedicated pop up menu. All the code is already available.

You may delete #26, #25, #23, # 20.

When it will be done, in fact tomorrow, I will delete some of my messages.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 31 décembre 2019 21:43:20

Happy new year to all of you.

I’m not sure to have access to a Catalina machine today.
May you the script below in English and post the Log History ?
With a bit of luck it will give useful infos.

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use script "FileManagerLib" version "2.3.3"

script o
	-- property showViewOptions_loc : ""
	property kind_loc : "" --> "Type"
	property name_loc : "" --> "Nom"
	property sortBy_loc : "" --> "Trier par :"
	property iCloudStatus_loc : "" --> "Statut iCloud"
	property dateModified_loc : "" --> "Date de modification"
	property dateCreated_loc : "" --> "Date de création"
	property dateLastOpened_loc : "" --> "Date de dernière ouverture"
	property dateAdded_loc : "" --> "Date de l’ajout"
	property size_loc : "" --> "Taille"
	property version_loc : "" --> "Version"
	property comments_loc : "" --> "Commentaires"
	property tags_loc : "" --> "Tags"
	property alwaysOpenInListView_loc : "" --> "Toujours présenter par liste"
	property browseInListView_loc : "" --> "Naviguer en présentation par listes"
	-- property hideToolbar_loc : "" --> "Masquer la barre d’outils" 	
	property showToolbar_loc : "" --> "Afficher la barre d’outils"
	-- property hideStatusBar_loc : "" --> "Masquer la barre d’état"
	property showStatusBar_loc : "" --> "Afficher la barre d’état"
	-- property hidePathBar_loc : "" --> "Masquer la barre du chemin d’accès"
	property showPathBar_loc : "" --> "Afficher la barre du chemin d’accès"
	property showSidebar_loc : "" --> "Afficher la barre latérale"
	-- property hideSidebar_loc : "" --> "Masquer la barre latérale"
	-- property hideTabBar_loc : "" --> "Masquer la barre d’onglets"
	property showTabBar_loc : "" --> "Afficher la barre d’onglets"
	--property hidePreview_loc : "" --> "Masqu l’aperçu"
	property showPreview_loc : "" --> "Afficher l’aperçu"
	property useAsDefaults_loc : "" --> "Utiliser comme valeurs par défaut"
	property arrangeBy_loc : "" --> "Organiser par :"
	-- property smallSizeIcons_loc : "" --> "icônes de petite taille"
	property largeSizeIcons_loc : "" --> "icônes de grande taille"
	property useRelativeDates_loc : "" --> "Utiliser les dates relatives"
	property calculateAllSizes_loc : "" --> "Calculer toutes les tailles"
	property showIconPreview_loc : "" --> "Utiliser un aperçu comme icône"
	property closeButton_loc : "" --> "Bouton de fermeture" 
	property textSize_loc : "" --> "Taille du texte :"
end script

Germaine()

on Germaine()
	
	-- Grab the localized version of several UI elements
	set theBundle to path to application "Finder" --> an alias
	-- set o's showViewOptions_loc to localized string "N35" in bundle theBundle
	set o's kind_loc to localized string "N224" in bundle theBundle
	set o's name_loc to localized string "N220" in bundle theBundle
	set o's sortBy_loc to localized string "FR11" in bundle theBundle
	set o's iCloudStatus_loc to localized string "N169.39" in bundle theBundle
	set o's dateModified_loc to localized string "N169.30" in bundle theBundle -- alt N221
	set o's dateCreated_loc to localized string "N169.31" in bundle theBundle -- alt N222
	set o's dateLastOpened_loc to localized string "N169.32" in bundle theBundle
	set o's dateAdded_loc to localized string "N169.38" in bundle theBundle -- alt N230
	set o's size_loc to localized string "N169.33" in bundle theBundle -- alt N223
	set o's version_loc to localized string "N169.34" in bundle theBundle -- alt N226
	set o's comments_loc to localized string "N169.36" in bundle theBundle -- alt N227
	set o's tags_loc to localized string "N169.37" in bundle theBundle -- alt N225
	set o's alwaysOpenInListView_loc to localized string "VO15" in bundle theBundle
	set o's browseInListView_loc to localized string "VO19" in bundle theBundle
	
	
	--set o's hideToolbar_loc to localized string "FV1" in bundle theBundle
	set o's showToolbar_loc to localized string "FV2" in bundle theBundle
	--set o's hideStatusBar_loc to localized string "FV5" in bundle theBundle
	set o's showStatusBar_loc to localized string "FV6" in bundle theBundle
	--set o's hidePathBar_loc to localized string "FV11" in bundle theBundle
	set o's showPathBar_loc to localized string "FV12" in bundle theBundle
	set o's showSidebar_loc to localized string "FV13" in bundle theBundle
	--set o's hideSidebar_loc to localized string "FV14" in bundle theBundle
	--set o's hideTabBar_loc to localized string "FV18" in bundle theBundle
	set o's showTabBar_loc to localized string "FV19" in bundle theBundle
	--set o's hidePreview_loc to localized string "FV22" in bundle theBundle
	set o's showPreview_loc to localized string "FV23" in bundle theBundle
	
	
	-- CAUTION, now, some strings whose English spelling isn't reachable in resources
	set aKey to "6.title"
	set o's useAsDefaults_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "6.title". Define it here.
	if o's useAsDefaults_loc = aKey then set o's useAsDefaults_loc to "Use as Defaults"
	
	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:"
	(*
	-- we no longer use it
	set aKey to "491.ibExternalAccessibilityDescription"
	set o's smallSizeIcons_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- with old systems, in English, the resource isn't available -> "491.ibExternalAccessibilityDescription". Define it here.
	if o's smallSizeIcons_loc = aKey then set o's smallSizeIcons_loc to "Small Size Icons"
	*)
	set aKey to "493.ibExternalAccessibilityDescription"
	set o's largeSizeIcons_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- with old systems, in English, the resource isn't available -> "493.ibExternalAccessibilityDescription". Define it here. 
	if o's largeSizeIcons_loc = aKey then set o's largeSizeIcons_loc to "Large Size Icons"
	
	set aKey to "52.title"
	set o's textSize_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "52.title". Define it here.
	if o's textSize_loc = aKey then set o's textSize_loc to "text size:" # À VÉRIFIER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	log o's textSize_loc
	
	set aKey to "191.title"
	set o's textSize_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "191.title". Define it here.
	if o's textSize_loc = aKey then set o's textSize_loc to "text size:" # À VÉRIFIER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	log o's textSize_loc
	
	set aKey to "101.title"
	set o's textSize_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "101.title". Define it here.
	if o's textSize_loc = aKey then set o's textSize_loc to "text size:" # À VÉRIFIER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	log o's textSize_loc
	
	set aKey to "396.title"
	set o's textSize_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "396.title". Define it here.
	if o's textSize_loc = aKey then set o's textSize_loc to "text size:" # À VÉRIFIER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	log o's textSize_loc
	
	
	set aKey to "54.title"
	set o's useRelativeDates_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "54.title". Define it here.
	if o's useRelativeDates_loc = aKey then set o's useRelativeDates_loc to "Use relative dates"
	
	set aKey to "65.title"
	set o's calculateAllSizes_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "65.title". Define it here.
	if o's calculateAllSizes_loc = aKey then set o's calculateAllSizes_loc to "Calculate all sizes"
	
	set aKey to "41.title"
	set o's showIconPreview_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "41.title". Define it here.
	if o's showIconPreview_loc = aKey then set o's showIconPreview_loc to "Show icon preview"
	log o's showIconPreview_loc
	
	set aKey to "402.title"
	set o's showIconPreview_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "402.title". Define it here.
	if o's showIconPreview_loc = aKey then set o's showIconPreview_loc to "Show icon preview"
	log o's showIconPreview_loc
	
	set aKey to "104.title"
	set o's showIconPreview_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "104.title". Define it here.
	if o's showIconPreview_loc = aKey then set o's showIconPreview_loc to "Show icon preview"
	log o's showIconPreview_loc
	
	set aKey to "205.title"
	set o's showIconPreview_loc to localized string aKey from table "ViewOptionsWindow" in bundle theBundle
	-- In English, the resource isn't available -> "205.title". Define it here.
	if o's showIconPreview_loc = aKey then set o's showIconPreview_loc to "Show icon preview"
	log o's showIconPreview_loc
	
	-- Thanks to Shane Stanley this path was edited to accomodate newsystems
	set theBundle to ((path to library folder from system domain as text) & "Frameworks:ApplicationServices.framework:Versions:Current:Frameworks:HIServices.framework:Versions:Current:Resources:") as «class furl»
	set o's closeButton_loc to localized string "AXButton:AXCloseButton" from table "RoleDescriptions" in bundle theBundle --> "Bouton de fermeture"
	
	
end Germaine

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 1 janvier 2020 09:51:20

Happy new year!

I ran the script:

English Log History:

-- 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
	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"
	(*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*)
	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
Result:
"close button"

German Log History: (if it helps you)

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

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:"
	(*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*)
	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
Ergebnis:
"Schließen-Taste"

Happy New Year to everybody!
The most difficult to debug code is redundant code, and difficult to port from one computer to another code. Therefore,

  1. Change hardcoded paths to relative paths,
  2. Putting localized string command into tell application “Finder”, changes default bundle’s value to Finder.app’s bundle. So, in bundle… no need.
  3. To check the correspondence of English names with others, it is better to use the records:

tell application "Finder"
	set kindString to localized string "N224"
	set nameString to localized string "N220"
	set sortByString to localized string "FR11"
	set iCloudStatusString to localized string "N169.39"
	set dateModifiedString to localized string "N169.30"
	set dateCreatedString to localized string "N169.31"
	set dateLastOpenedString to localized string "N169.32"
	set dateAddedString to localized string "N169.38"
	set sizeString to localized string "N169.33"
	set versionString to localized string "N169.34"
	set commentsString to localized string "N169.36"
	set tagsString to localized string "N169.37"
	set alwaysOpenInListViewString to localized string "VO15"
	set browseInListViewString to localized string "VO19"
	set showToolbarString to localized string "FV2"
	set showStatusBarString to localized string "FV6"
	set showPathBarString to localized string "FV12"
	set showSideBarString to localized string "FV13"
	set showTabBarString to localized string "FV19"
	set showPreviewString to localized string "FV23"
	set useAsDefaultsString to localized string "6.title" from table "ViewOptionsWindow"
	set groupByString to localized string "974.title" from table "ViewOptionsWindow"
	set largeIconSizeString to localized string ¬
		"493.ibExternalAccessibilityDescription" from table "ViewOptionsWindow"
	set textSizeString to localized string "52.title" from table "ViewOptionsWindow"
	-- set textSizeString to localized string "191.title" from table "ViewOptionsWindow"
	-- set textSizeString to localized string "101.title" from table "ViewOptionsWindow"
	-- set textSizeString to localized string "396.title" from table "ViewOptionsWindow"
	set useRelativeDatesString to localized string "54.title" from table "ViewOptionsWindow"
	set calculateAllSizesString to localized string "65.title" from table "ViewOptionsWindow"
	set showIconPreviewString to localized string "41.title" from table "ViewOptionsWindow"
	-- set showIconPreviewString to localized string "402.title" from table "ViewOptionsWindow"
	-- set showIconPreviewString to localized string "104.title" from table "ViewOptionsWindow"
	-- set showIconPreviewString to localized string "205.title" from table "ViewOptionsWindow"
end tell

set libraryFolder to path to library folder from system domain as text
set bundlePath to libraryFolder & "Frameworks:ApplicationServices.framework:Versions:A:"
set bundleAlias to alias (bundlePath & "Frameworks:HIServices.framework:Versions:A:Resources:")
set closeButtonString to localized string ¬
	"AXButton:AXCloseButton" from table "RoleDescriptions" in bundle bundleAlias


return {|kind|:kindString, |name|:nameString, |Sort By|:sortByString, |iCloud Status|:iCloudStatusString, |Date Modified|:dateModifiedString, |Date Created|:dateCreatedString, |Date Last Opened|:dateLastOpenedString, |Date Added|:dateAddedString, |Size|:sizeString, |Version|:versionString, |Comments|:commentsString, |Tags|:tagsString, |Always open in list view|:alwaysOpenInListViewString, |Browse in list view|:browseInListViewString, |Show Toolbar|:showToolbarString, |Show Status Bar|:showStatusBarString, |Show Path Bar|:showPathBarString, |Show SideBar|:showSideBarString, |Show Tab Bar|:showTabBarString, |Show Preview|:showPreviewString, |Use as Defaults|:useAsDefaultsString, |Group By|:groupByString, |large icon size|:largeIconSizeString, |Text size|:textSizeString, |Use relative dates|:useRelativeDatesString, |Calculate all sizes|:calculateAllSizesString, |Show icon preview|:showIconPreviewString, |close button|:closeButtonString}

@ KniazidisR

Thanks for your wishes.

Once again, no offense intended, but it seems that you didn’t read carefully Flavour’s message.

He carefully stated :

English Log History:

– Don’t click [Open this Scriplet in your Editor:]

What was posted was not supposed to be executable code, trying to do that would issue a compile error due to the two last lines.
It’s just the contents of the Log History returned by the script which I posted in message #30 asking explicitly for these reports.
My script is just a subset of a larger script, subset which contain instructions USEFUL in the complete script. I was just lazy enough to drop the properties embedded in a script object.

Neither Flavour nor myself are fool enough to write a script embedding the expanded path in every instruction.
It’s just what the Log History report.

On your side you may think that a record would be a better way to return the results but here it’s completely irrelevant. The main script would do nothing with your record.
You just wasted your time, Flavour’s one and mine too.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 1 janvier 2020 15:55:26

Thank you.
Both were useful, at least for somebody reading carefully;)

As I haven’t access to Catalina today, I choose to drop the shortcut cmd - ctrl + 2 and re-introduced the code triggering the pop up “Arrange By”.
The edited script is available in message #16

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 1 janvier 2020 16:08:34

Once again, no offense intended,
Your script at post #16 has all the same drawbacks as the last fragment that I tried to turn into real code.

But you have never accepted something better. And I do not hope so. I want to publish my comments for people who are able to perceive something. In the end, this site is not for sharing pleasantries about grandmothers, but for finding the best solution.

You can continue to debug your code for another 50 posts. I’m not interested in looking here anymore.

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