• 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: Persisting Changes to Native MacOS Text Replacement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Persisting Changes to Native MacOS Text Replacement


  • Subject: Re: Persisting Changes to Native MacOS Text Replacement
  • From: John Garrigues via AppleScript-Users <email@hidden>
  • Date: Sun, 20 Jun 2021 05:37:31 -0700

It helps a ton! As is my new habit, I was updating my replacement this morning
and I thought, “wait, there is actually a 'save' button that I have to press
that’s not being addressed by my script.” Your correction takes care of that
button. Thanks a bunch, Axel! I’ll think about you every time I DON’T type in
today’s date! 😎

tell application id "com.apple.systemevents"
        tell application process "System Preferences"
                tell window "Keyboard"
                        tell tab group 1
                                tell scroll area 1
                                        tell table 1
                                                tell row 1
                                                        tell UI element 2
                                                                tell text field
1
                                                                        set
focused to true

keystroke today

keystroke return
                                                                end tell
                                                        end tell
                                                end tell
                                        end tell
                                end tell
                        end tell
                end tell
        end tell
end tell

Best,
John G


> On Jun 20, 2021, at 02:13, Axel Lüttgens via AppleScript-Users
> <email@hidden> wrote:
>
>
>> Le 20 juin 2021 à 05:20, John Garrigues a écrit :
>>
>> […]
>>
>> Can anyone suggest a way to "save" the System
>> Preferences/General/Keyboard/Text Replacement modification? Is there
>> something I’m missing in the AppleScript?
>
> Hello John,
>
> This slight modification to your code seems to do the trick, by trying to be
> closer to a user interaction:
>
>               […]
>               tell row 1
>                       select
>                       tell UI element 2
>                               tell text field 1
>                                       set focused to true
>                                       keystroke today
>                                       keystroke return
>                               end tell
>                       end tell
>               end tell
>               […]
>
> HTH,
> Axel
>
>
> _______________________________________________
> 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

 _______________________________________________
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

References: 
 >Persisting Changes to Native MacOS Text Replacement (From: John Garrigues via AppleScript-Users <email@hidden>)
 >Re: Persisting Changes to Native MacOS Text Replacement (From: Axel Lüttgens via AppleScript-Users <email@hidden>)

  • Prev by Date: Re: Persisting Changes to Native MacOS Text Replacement
  • Next by Date: AppleScript workaround for Numbers 11 copy-paste limitation
  • Previous by thread: Re: Persisting Changes to Native MacOS Text Replacement
  • Next by thread: AppleScript workaround for Numbers 11 copy-paste limitation
  • Index(es):
    • Date
    • Thread