Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.system > #135565

Re: AppleScript Question(s)

From Jolly Roger <jollyroger@pobox.com>
Newsgroups comp.sys.mac.system
Subject Re: AppleScript Question(s)
Date 2020-12-01 17:22 +0000
Organization People for the Ethical Treatment of Pirates
Message-ID <i2ncfeF4b57U1@mid.individual.net> (permalink)
References <rq2689$6gp$1@dont-email.me> <rq27rt$e8n$1@dont-email.me> <rq48b8$d0c$1@dont-email.me>

Show all headers | View raw


On 2020-12-01, gtr <xxx@yyy.zzz> wrote:
> On 2020-11-30 07:43:57 +0000, Krzysztof Mitko said:
>> gtr wrote:
>>> 
>>> Great stuff, thanks!
>>> 
>>> From your first example, Optima Regular, size 20 will do it.  But
>>> I'm curious about the "system events" example.  It pops up the font
>>> selector, seemingly the second button. Is there no way to access the
>>> "styles" button?
>> 
>> Yes, with following code:
>> 
>> tell application "System Events" to tell process "TextEdit"
>> 	click menu button 1 of group 1 of front window
>> 	click menu item 9 of menu 1 of menu button 1 of group 1 of front window
>> end tell
>
> Worked perfectly. Many thanks.

Yes, but it's a bad idea. Again, user interface scripting should be a
*last resort*.  TextEdit has built-in AppleScript commands for adjusting
text properties.

With user interface scripting, if the user happens to move the mouse,
open an app or document, or anything else while the script is running,
the script can click the wrong thing or modify the wrong data. That
cannot happen when you use built-in AppleScript commands instead.

-- 
E-mail sent to this address may be devoured by my ravenous SPAM filter.
I often ignore posts from Google. Use a real news client instead.

JR

Back to comp.sys.mac.system | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-11-29 17:41 -0800
  Re: AppleScript Question(s) Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> - 2020-11-30 05:20 +0000
    Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-11-29 23:16 -0800
      Re: AppleScript Question(s) Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> - 2020-11-30 07:43 +0000
        Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-11-30 18:04 -0800
          Re: AppleScript Question(s) Jolly Roger <jollyroger@pobox.com> - 2020-12-01 17:22 +0000
            Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-01 16:30 -0800
              Re: AppleScript Question(s) Lewis <g.kreme@kreme.dont-email.me> - 2020-12-02 02:00 +0000
                Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-01 18:57 -0800
                Re: AppleScript Question(s) Alan Baker <notonyourlife@no.no.no.no> - 2020-12-01 21:35 -0800
                Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-01 22:00 -0800
                Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-01 22:01 -0800
        Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-05 11:04 -0800
          Re: AppleScript Question(s) Krzysztof Mitko <invalid@kmitko.at.list.dot.pl> - 2020-12-05 19:31 +0000
            Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-05 22:23 -0800
            Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-06 09:55 -0800
              Re: AppleScript Question(s) Jolly Roger <jollyroger@pobox.com> - 2020-12-06 18:39 +0000
                Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-06 12:18 -0800
                Re: AppleScript Question(s) Jolly Roger <jollyroger@pobox.com> - 2020-12-07 17:16 +0000
                Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-07 10:14 -0800
          Re: AppleScript Question(s) Lewis <g.kreme@kreme.dont-email.me> - 2020-12-06 00:21 +0000
            Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-05 22:24 -0800
            Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-06 09:44 -0800
              Re: AppleScript Question(s) Lewis <g.kreme@kreme.dont-email.me> - 2020-12-06 21:13 +0000
                Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-06 19:09 -0800
                Re: AppleScript Question(s) Lewis <g.kreme@kreme.dont-email.me> - 2020-12-07 04:57 +0000
                Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-06 22:09 -0800
                Re: AppleScript Question(s) Lewis <g.kreme@kreme.dont-email.me> - 2020-12-07 06:54 +0000
                Re: AppleScript Question(s) Jolly Roger <jollyroger@pobox.com> - 2020-12-07 17:24 +0000
                Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-12-07 10:16 -0800
      Re: AppleScript Question(s) Lewis <g.kreme@kreme.dont-email.me> - 2020-11-30 13:28 +0000
        Re: AppleScript Question(s) Alan Baker <notonyourlife@no.no.no.no> - 2020-11-30 12:56 -0800
          Re: AppleScript Question(s) Lewis <g.kreme@kreme.dont-email.me> - 2020-11-30 22:42 +0000
            Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-11-30 18:05 -0800
        Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-11-30 17:59 -0800
  Re: AppleScript Question(s) Jolly Roger <jollyroger@pobox.com> - 2020-11-30 17:37 +0000
    Re: AppleScript Question(s) gtr <xxx@yyy.zzz> - 2020-11-30 18:05 -0800

csiph-web