Is this possible? Condition/s in Numbers doc triggers actions in macOS

Hello, I’m a beginner, occasional-scripter. At this stage I JUST want to establish if the following functionality is possible. I am open to suggestions for alternatives that achieve the same result.

Desired Functionality:
Multiple Numbers documents created in macOS, hosted on a Mac Mini used as a server and shared ‘live’ via iCloud with colleagues. The intention is colleagues will open one file at a time and modify the content (Checkboxes etc). When [conditions are met] say, all the Checkboxes are checked in a file, Applescript will notice and execute an action. - Either move the file or send an email etc.

I’m not expecting an instant execution/action to result as soon as the Numbers doc meets particular conditions as this might cause admin problems for us and I believe it’s not possible anyway. If the files were all scanned just once a day, then ‘actioned’ where applicable, that would be perfect.

  1. Is this possible?

and

  1. If it’s possible, would this functionality require each Numbers doc to be opened for this process to work, or can they be ‘read’ / ‘scanned’ / ‘assessed’ while closed?

I will really appreciate your advice on the feasibility of this function.

Model: iMac (21.5-inch, Late 2012)
AppleScript: 0.0.0
Browser: Safari 604.5.6
Operating System: Mac OS X (10.11.6)

The way the title is phrased - “Condition/s in Numbers doc triggers actions in macOS,” I don’t know about.

But from the description, it doesn’t sound like that’s actually the functionality you need. It sounds like you want to scan the document once a day, and if certain conditions are met, you want to execute more code.

That’s certainly possible. Run an Applescript on a schedule, and it opens the Numbers doc, checks the status of the checkboxes, and if their status meets whatever logic you want, then do whatever outer actions you want to perform.

You can certainly run an Applescript on a schedule, and the script can certainly open a Numbers document, retrieve the status of some checkboxes, and perform some basic logic regarding those statuses.

Great! Thank you so much @t.spoon. I really appreciate your confirming that for me. Now to start this endeavour!

Hey t.spoon, I still need to ascertain if there is a way to have the content of the Numbers docs scanned/verified without them having to be opened.

If someone jumps on the server while Applescript is in control of the computer it will mess with its ability to execute, right? - I’m keen to avoid this which is why I’d like to ascertain if this process can be run in the background / without opening the documents.

Is this possible?

Is this where shell scripts come in handy?

Bump!

I didn’t know this was running on a server that people would need to be using the UI on while it’s running the Applescripts.

I don’t script Numbers much, I don’t know to what extent it can do this in the background.

Getting information out of Numbers documents without opening them in Numbers sounds difficult to me.

If you’re using checkboxes, you probably can’t keep the documents as CSV’s. CSV’s would be good, because those could be read into Applescript without opening them in Numbers.

One possibly over-complicated solution would be if you could script the save process - don’t have the users just click “save,” have them save by running a script, that saves out the checkbox statuses in some file/way that your script can access them without using the UI, like in a CSV or JSON document, parallel to the Numbers document.

Or perhaps if you can create a second user account on the machine that the script runs under, and keep both account logged in at once via Fast User Switching, with the account not running the scripts in the foreground for users. The second account could handle the task in the background without bothering the current user. I’m just guessing about that, I’ve never tried a scheduled Applescript running under the not-currently-active user opening documents in applications, I don’t know if that’s possible.

I’m afraid I don’t know a great answer for you, it sounds like a complicated project and I don’t know nearly enough about it to know how I’d approach it. Can’t the documents simply be accessible from a server where you don’t have to worry about someone needing to manually access the UI?

It sounds like the documents are on a shared drive or something, if multiple users are accessing them. Is there no computer with access to them that can perform the task at some time you know is safe from user UI interaction?

Hi t.spoon,

Thanks for sharing your thoughts and ideas further on this matter.

The Mac Mini Server is used as both a network drive and as a server for our (small) company’s CRM database. No one works directly on it as it has no peripherals or screen connected, but my concern was that if I automated the scanning and handling of these Numbers documents on the server itself then there was some chance that someone might remotely access it (via screen sharing) and interfere with the process.

I had considered making my office desktop (iMac) do the work because I wouldn’t forget or interrupt such a process seeing as I’m creating it! - I think this is the most sure way of doing it without interruption.

More info: The Numbers docs are going to be saved in the iCloud folder on the Mac Mini Server so they can be shared via iCloud to enable remote workers to manipulate them on the iCloud.com website using various platforms, including Windows laptops and various smartphones. The changes they make will be analysed by this automation and the files handled accordingly.

Thanks for your help. Now I need to establish the scope of automations needed, the variables involved and either study enough to do it myself or determine if it’s viable to get someone to do it for us. =)