Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Jolly Roger Newsgroups: comp.sys.mac.system Subject: Re: AppleScript Question(s) Date: 1 Dec 2020 17:22:54 GMT Organization: People for the Ethical Treatment of Pirates Lines: 34 Message-ID: References: X-Trace: individual.net Ac5paPCnPCW9UzccpyTP4QgEhFSkOXaavpk1+rhY/1qk0fue/e Cancel-Lock: sha1:eSrQCmgmLMPj0ts9g2GwTsNF+80= X-No-Archive: Yes MMail-Copies-To: nobody X-Face: _.g>n!a$f3/H3jA]>9pN55*5<`}Tud57>1Y%b|b-Y~()~\t,LZ3e up1/bO{=-) User-Agent: slrn/1.0.3 (Darwin) Xref: csiph.com comp.sys.mac.system:135565 On 2020-12-01, gtr 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