• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing Localized File Menu String
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing Localized File Menu String


  • Subject: Re: Accessing Localized File Menu String
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 10 Jul 2009 11:36:09 +0200


Le 10 juil. 2009 à 10:33, Philip Aker a écrit :

On 2009-07-10, at 00:36:05, Philip Aker wrote:

However I see that:

plutil -convert xml1 -o edit.plist /Applications/TextEdit.app/Contents/Resources/French.lproj/Edit.nib/keyedobjects.nib

offers some hope because the association is with an action and that can be used as a fixed element. The resulting plist format is not exactly what one would call regular, however I think it might be possible to work with.

I wrote a code using the brute force.
With TextEdit, it works.
With Mail I was unable to identify the .nib item storing the menus descriptors.
With Keynote I thought that I have it but as it fails, I think that I was wrong.

--[SCRIPT]

--"Macintosh HD:Applications:TextEdit.app:Contents:Resources:French.lproj:Edit.nib:"
set theString to my getMenuName("TextEdit.app", "French.lproj/Edit.nib", 537, true)
display dialog theString
--"Macintosh HD:Applications:iWork '09:Numbers.app:Contents:Resources:French.lproj:Numbers.nib:"
set theString to my getMenuName("iWork '09/Keynote.app", "French.lproj/Keynote.nib", 123, false)

on getMenuName(a, f, n, tf)
local linefeed, balise, leFichier, textDatas, enliste, r
set linefeed to ASCII character (10)
set balise to "<key>CF$UID</key>" & linefeed & tab & tab & tab & tab & "<integer>" & n & "</integer>" & linefeed & tab & tab & tab & "</dict>" & linefeed & tab & tab & "</dict>" & linefeed & tab & tab & "<string>"


do shell script "plutil -convert xml1 -o edit.plist /Applications/" & a & "/Contents/Resources/" & f & "/keyedobjects.nib"
if tf then
set leFichier to (path to startup disk as text) & "edit.plist"
set textDatas to read file leFichier
set enliste to my decoupe(textDatas, balise)
if (count of enliste) = 2 then
set r to item 1 of my decoupe(item 2 of enliste, "</string>")
else
set r to false
end if
tell application "System Events" to delete file leFichier
return r
end if
end getMenuName

--=====

on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe

--=====
--/[SCRIPT]

The log report is:

do shell script "plutil -convert xml1 -o edit.plist /Applications/iWork '09/Keynote.app/Contents/Resources/French.lproj/Keynote.nib/keyedobjects.nib"
"sh: -c: line 1: unexpected EOF while looking for matching `''
sh: -c: line 2: syntax error: unexpected end of file"

Yvan KOENIG (from FRANCE vendredi 10 juillet 2009 11:36:07)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Accessing Localized File Menu String
      • From: Philip Aker <email@hidden>
    • Rép: Accessing Localized File Menu String
      • From: Yvan KOENIG <email@hidden>
References: 
 >Accessing Localized File Menu String (From: Ian was here <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Chris Page <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Philip Aker <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Chris Page <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Philip Aker <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: Accessing Localized File Menu String
  • Next by Date: Rép: Accessing Localized File Menu String
  • Previous by thread: Re: Accessing Localized File Menu String
  • Next by thread: Rép: Accessing Localized File Menu String
  • Index(es):
    • Date
    • Thread