Re: AppleScripting Numbers

12 views
Skip to first unread message

Jolly Roger

unread,
May 11, 2018, 6:07:48 PM5/11/18
to
On 2018-05-11, Chris Schram <chri...@me.com> wrote:
>
> Sorry for the crosspost, but there have been no messages in
> alt.comp.lang.applescript since last March.
>
> I am working on a Numbers spreadsheet that gets populated with data pasted in
> from a text file. Among that data is a column of dates in the "2018-05-11
> 13:00:00" format. I can ensure that Numbers recognizes them as dates with
> something like:
>
> set selection range to range ("E3:E146")
> set the format of selection range to date and time
>
> But I would like the dates to look more like "Fri, May 11, 2018 1:00 PM". This
> is very easily dome within Numbers; there are numerous date formats available. I
> just can't figure out the incantation within AppleScript that can perform that
> formatting.
>
> Ideas? Thanks.

Looking at the Numbers dictionary (Script Editor > Open Dictionary >
Numbers), it doesn't appear Numbers supports anything but setting the
cell format to "date and time" with AppleScript.

And looking at Xcode > Open Developer Tool > Accessibility Inspector, it
doesn't appear Numbers assigns labels to the date and time format pop-up
menus; so I'm not sure you'd be able to access them with accessibility
scripting either - though I could be wrong:

<https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/AutomatetheUserInterface.html>

That leaves "click at {x-coordinate, y-coordinate}" type scripting,
which leaves a *lot* to be desired and will be problematic for obvious
reasons unless you can ensure the window will always be open at the
exact same position and you won't be touching the mouse or keyboard
while the script executes.

Otherwise, you're stuck manually selecting the column and then applying
the change by clicking the mouse yourself.

--
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

Chris Schram

unread,
May 11, 2018, 6:50:29 PM5/11/18
to
Thanks JR. I was "sort of" able to get what I wanted with the "Watch Me
Do" feature of Automator. For some reason, it couldn't change the date,
but COULD get the time into AM/PM format. Before I give up completely,
I'll fire up UI Browser. But it's a real bitch scripting popups un that
environment.

--
chri...@me.com is a filtered spam magnet. Email replies may be lost.
You're better off replying to this newsgroup.
Reply all
Reply to author
Forward
0 new messages