The Finder 'cmd-alt-i' Info window

I know this

tell application "Finder" to open information window of theFilePath

but I can’t find the cmd alt i version of that as applescript.
Any idea’s?

Also Is there a way to check if it is already open, besides’ visually :wink: ?

Thank you very much

Maybe this script may help.

# Grabs the localized string whose English content is "Infos for ^1"
set IN1_V1_loc to localized string "IN1_V1" in bundle ((path to application "Finder") as «class furl»)
log result --> (*Infos sur ^1*)

set theFileAlias to choose file

# I hate the Finder but I must use it to get the list of its windows so I use it also to extract the file name
tell application "Finder"
	# Extract the file name
	set theFileName to name of theFileAlias
	log result --> (*4843400_6_1ab5_dessin-de-louison-realise-et-publie-sur-les_050834eb0a4d334701914a271bd7746b.jpg*)
	
	# Extract the list of windows belonging to the Finder
	set theWindows to name of windows
	log result --> (*Infos sur 4843400_6_1ab5_dessin-de-louison-realise-et-publie-sur-les_050834eb0a4d334701914a271bd7746b.jpg, Bureau, Téléchargements, Script Libraries*)
end tell
# Build the name of the infos window related to the selected file
set infosWindowName to my remplace(IN1_V1_loc, "^1", theFileName)
log result --> (*Infos sur 4843400_6_1ab5_dessin-de-louison-realise-et-publie-sur-les_050834eb0a4d334701914a271bd7746b.jpg*)
# If the infos window exists, close it
if theWindows contains infosWindowName then
	tell application "Finder" to close window infosWindowName
end if

#=====
(*
replaces every occurences of d1 by d2 in the text t
*)
on remplace(t, d1, d2)
	local oTIDs, l
	set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d1}
	set l to text items of t
	set AppleScript's text item delimiters to d2
	set t to l as text
	set AppleScript's text item delimiters to oTIDs
	return t
end remplace

#=====

Yvan KOENIG running El Capitan 10.11.3 in French (VALLAURIS, France) lundi 25 janvier 2016 22:03:57

Thank you, this script to find a finder info window is perfect.

But about the to open a summery “cmd alt info” finder window, any suggestions?

I didn’t wrote about cmd + alt + i because as far as I know, it does exactly the same thing than cmd + i.

If it may do something different I am interested to read what.

You may try this code :

# Grabs the localized string whose English content is "Infos for ^1"
set IN1_V1_loc to localized string "IN1_V1" in bundle ((path to application "Finder") as «class furl»)



# I hate the Finder but I must use it to get the list of its windows so I use it also to extract the file name
tell application "Finder"
	set theFileAlias to item 1 of (get selection) as alias
	
	# Extract the file name
	set theFileName to name of theFileAlias
	
	# Extract the list of windows belonging to the Finder
	set theWindows to name of windows
end tell
# Build the name of the infos window related to the selected file
set infosWindowName to my remplace(IN1_V1_loc, "^1", theFileName)

# If the infos window isn't available, open it.
if theWindows does not contain infosWindowName then
	tell application "System Events" to tell process "Finder"
		set frontmost to true
		keystroke "i" using {command down, option down}
	end tell
end if

#=====
(*
replaces every occurences of d1 by d2 in the text t
*)
on remplace(t, d1, d2)
	local oTIDs, l
	set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d1}
	set l to text items of t
	set AppleScript's text item delimiters to d2
	set t to l as text
	set AppleScript's text item delimiters to oTIDs
	return t
end remplace

#=====

Yvan KOENIG running El Capitan 10.11.3 in French (VALLAURIS, France) lundi 25 janvier 2016 23:23:16

tell application "System Events" to tell process "Finder"
       set frontmost to true
       keystroke "i" using {command down, option down}
   end tell

:smiley: Thank you so much.
I always ( want to ) forget the keystroke actions.

Why I need it:
I am busy with an app that search for certain documents, then it select it in the finder in the background.
With the first document, it will open this window, I move it at that moment where I want it. Then I could add some Tag’s in that info window.
If I use just the ‘cmd i’ info window sometimes it jump to another place, and this one stay’s where I want it.

What I really want it to create a app that opens the current TAG’s if any in a right column and on a left column all the TAG’s and a new tag field. But for now I am to slow to create that ( read less understanding ). :wink:

tell application "System Events" to tell process "Finder"
	set frontmost to true
	keystroke "i" using {command down, option down}
	
	tell window 1 to tell first scroll area
		class of UI elements
		log result --> {image, static text, static text, static text, static text, scroll area, UI element, static text, static text, static text, static text, static text, static text, static text, static text, static text, static text, static text, static text, static text, checkbox, checkbox, checkbox, UI element, static text, static text, static text, UI element, static text, text field, checkbox, UI element, static text, scroll area, UI element, static text, UI element, static text, static text, scroll area, button, button, menu button, checkbox}
		tell first scroll area
			class of UI elements
			log result --> {text field}
			tell first text field
				--perform action "AXShowMenu"
				name of its attributes
				log result --> (*AXFocused, AXSelectedText, AXSharedFocusElements, AXInsertionPointLineNumber, AXPosition, AXNumberOfCharacters, AXEnabled, AXPlaceholderValue, AXSelectedTextRange, AXHelp, AXChildren, AXRole, AXParent, AXTopLevelUIElement, AXDescription, AXVisibleCharacterRange, AXValue, AXRoleDescription, AXSize, AXWindow, AXFrame, AXIdentifier*)
				value of its attributes
				log result --> 	(*false, missing value,, 0, 15, 108, 2, true, Ajouter des tags., 1, 0, missing value, text field 1 of text field 1 of scroll area 1 of scroll area 1 of window Infos sur tout quitter.app of application process Finder, text field 2 of text field 1 of scroll area 1 of scroll area 1 of window Infos sur tout quitter.app of application process Finder, AXTextField, scroll area 1 of scroll area 1 of window Infos sur tout quitter.app of application process Finder, missing value, éditeur de tag, 1, 2, , champ de texte, 390, 35, window Infos sur tout quitter.app of application process Finder, 15, 108, 405, 143, _NS:38*)
				set value of its attribute "AXFocused" to true
				class of UI elements
				log result --> {text field, text field}
				
				tell text field 1
					set theValue to its value
					log result --> "Orange"
					set thePosition to its position
					log result --> {17, 214}
				end tell
				click at thePosition
				delay 0.2
				class of UI elements
				log result --> {text field, text field, scroll area}
				tell first scroll area
					class of UI elements
					log result --> {table}
					tell table 1
						class of UI elements
						log result --> {row, row, row, row, row, column}
						tell row 2
							class of UI elements
							log result --> {UI element}
							tell first UI element
								its properties
								log result --> (*class:UI element, minimum value:missing value, orientation:missing value, position:14, 171, role description:cellule, accessibility description:missing value, focused:true, title:missing value, size:390, 19, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:AXCell, entire contents:, subrole:missing value, selected:false, name:Rouge, description:cellule*)
								name of its attributes
								log result --> (*AXRowIndexRange, AXEnabled, AXDescription, AXParent, AXChildren, AXSize, AXFocused, AXColumnIndexRange, AXRole, AXTitleUIElement, AXTopLevelUIElement, AXPosition, AXWindow, AXRoleDescription, AXSelected, AXFrame*)
								value of its attributes
								log result --> (*2, 2, true, missing value, row 2 of table 1 of scroll area 1 of text field 1 of scroll area 1 of scroll area 1 of window Infos sur tout quitter.app of application process Finder, image Rouge of UI element Rouge of row 2 of table 1 of scroll area 1 of text field 1 of scroll area 1 of scroll area 1 of window Infos sur tout quitter.app of application process Finder, static text Rouge of UI element Rouge of row 2 of table 1 of scroll area 1 of text field 1 of scroll area 1 of scroll area 1 of window Infos sur tout quitter.app of application process Finder, 390, 19, true, 1, 1, AXCell, static text Rouge of UI element Rouge of row 2 of table 1 of scroll area 1 of text field 1 of scroll area 1 of scroll area 1 of window Infos sur tout quitter.app of application process Finder, missing value, 14, 171, window Infos sur tout quitter.app of application process Finder, cellule, false, 14, 171, 404, 190*)
								class of UI elements
								log result --> (*image, static text*)
								tell first static text
									--name of its attributes
									--log result --> (*AXSelectedTextRange, AXNumberOfCharacters, AXEnabled, AXParent, AXSize, AXFocused, AXChildren, AXPlaceholderValue, AXRole, AXTopLevelUIElement, AXInsertionPointLineNumber, AXHelp, AXValue, AXPosition, AXWindow, AXRoleDescription, AXVisibleCharacterRange, AXSelectedText, AXFrame, AXIdentifier*)
									--value of its attributes
									--log result --> {{1, 0}, 5, true, UI element "Rouge" of row 2 of table 1 of scroll area 1 of text field 1 of scroll area 1 of scroll area 1 of window "Infos sur tout quitter.app" of application process "Finder" of application "System Events", {356, 17}, false, {}, missing value, "AXStaticText", missing value, 0, missing value, "Rouge", {40, 171}, window "Infos sur tout quitter.app" of application process "Finder" of application "System Events", "texte", {1, 5}, missing value, {40, 171, 396, 188}, "_NS:29"}
									
									set {x1, y1} to its position
									# I didn't found an other way to select a tag
									do shell script "/Users/admin/bin/cliclick c:" & x1 & "," & y1
								end tell
								--click at itsPosition -- seems to do nothing
							end tell
						end tell
					end tell
				end tell
				
			end tell
		end tell
	end tell
end tell

Yvan KOENIG running El Capitan 10.11.3 in French (VALLAURIS, France) mardi 26 janvier 2016 12:23:49

He, great. I did try it and did rename the app what will embed this, to “YvanTheTagger”. :wink:

Thank you.
It works with the ‘cmd i’, but not with the ‘cmd option i’
But i got the idea how it should work.

Thank you also for pointing to the cliclik shell app.
I did look before for an app or something like that, but google is really focused on selling stuff, in this case mouses :frowning:

Again thank you.

Curious, here it works with ‘cmd option i’

I’m not sure that it’s the best way to play with tags.
Shane Stanley wrote a dedicated library named FileTagsLib v1.0.0, available for free at :

http://www.macosxautomation.com/applescript/apps/Script_Libs.html

Yvan KOENIG running El Capitan 10.11.3 in French (VALLAURIS, France) mardi 26 janvier 2016 17:51:24