jxa (javascript for automation) - get notification when user changes selection in Contacts - event-handling

I am using JXA to write scripts that basically copy data from one application to another.
Now I would like my script to get a notification whenever the user changes selection (eg in the Contacts Application).
I have gone through the docs and searchd the net but I cannot find one example pointing me in the right direction.
Is it possible at all? Thanks

Related

update calendar from email link

Obviously I'm not using the right keyword/phrases to find the information that I need. Any help in pointing me in the right direction would be greatly appreciated.
I've generated an ICS file. I put a link to this file in an email. What I would like to happen is that the recipient clicks the link and it updates their calendar (regardless of OS, platform). Currently the link simply downloads the ICS file but does not update any calendar.
Background: I belong to a non-profit organisation that runs several courses that members can subscribe to. This means that each members course list will be different therefore I can not simply send out a single list or have people subscribe to lots of different 'events' to have their calendars updated.
Is this doable or am I simply dreaming :-)
Jeff, what happens when some one clicks on an ics link depends on their device and the program that they are reading the email in, and how they have setup their defaults - eg what calednar app. EG: I have mine setuo to download ics files for testing purposes, and if i click on a downloaded one it opens in notepad++.
Of course most people will not have that. However, not that easy to make it happen automatically, have to tell users.
To have updates (ie syncing) happen, recipients need to subscribe to the link, not import the data. If they are not familiar with using multiple calendars, they can get confused.
instructions on google: https://support.google.com/calendar/answer/37100 on apple calendars https://support.apple.com/en-au/guide/calendar/subscribe-to-calendars-icl1022/mac. Rather annoyingly, iphones will offer a user who clicks on a normal http..ics url an option to import all events. To make the iphone offer the subscribe option one has to use the unofficial apple icalendar prefix webcal. So one ends up either showing both link options on a webpage, or doing device detection and showing webcal for macs.
hope that clarifies.

How to make a background macOS application?

I'm trying to develop a macOS app that performs operations on a file when the user chooses to do so. My goal is to let a user right-click a file, select my app from the list of services so that the app will pop open a UI with things like configuration options, etc.
A prime example would be Evernote's "Add to Evernote"; when a user clicks it, the Evernote app opens and saves the file there. In addition, I need to switch control to the UI, so that the user can input some settings, before performing any file operations.
The place where I'm stuck now is how to get the app/UI open when the user clicks it from the contextual menu, as well as keeping the UI hidden initially. From some googling, I think what I need to make is an agent? I'm not really sure.
Any help would be appreciated, thanks!

How to execute Google Script bound to Google Form on Form open

I am developing very first script for Google Forms. And of course I need help :)
Intro:
Script needs to collect external data (API), create drop down filled with fetched data and upon submission send all responses to another API.
So far I got:
1. Fetching external API - works;
2. Creating drop down filled with data - works partially;
3. Sending data - not yet started.
I have following specific questions:
For some reason data in drop down is not being refreshed (fetched) on form open. I have it in function onOpen() and created trigger to execute this function on open as well. However only way to get new data is to go to script editor and run it :( Which is not the point.
Drop down is currently at the bottom of the form. I saw that you can use index, but I can not get it working. Can someone give me working example of how to use https://developers.google.com/apps-script/reference/forms/form#moveitemitem-toindex properly?
Thanks!

OwnCloud enhance core features with App (eg. user registration)

I started looking into OwnCloud app development to add some capabilities I would like to my server. To me it seems like Apps can't modify anything like the Login page or User Management page. Is this the case?
I want to build a user registration app and would love to integrate it into the user management page (if not and it has to exist as its own app page not a big deal). The one big problem I see so far is not being able to add a "Register" link to the login page. I could just go in and add it to the source manually, but I would like to keep the App self contained so others can use it too.
If this is not possible to do in an App I may just need to modify the core application and then see if they will accept my feature addition in a pull request.
Thanks to anyone who can shed some light on this for me. I don't want to waste my time trying to figure out how to do it with an App on the platform if it wont be doable.
After a lot of digging around I did figure out a way to do this.
In the App's app.php file, you can force a script to be loaded if the plugin is enabled:
$api->addScript('script_name'); // without .js
In that script jQuery can be used to add the elements to the page where you need them.
This was a good solution for me since I only needed to add a single button to the login page. I can see this being a bad idea if you want to make vast modifications. At that point you might as well just create a separate page that you have full control over.

How did twitter implement new autocomplete feature in iPhone app?

Twitter has an awesome new way to enter "#" and "#" in the latest iPhone app.
http://blog.twitter.com/2011/03/twitter-for-iphone-ipad-even-better.html
When you type "#" or "#" and then type characters it instantly starts to autocomplete in a table below. How are they doing this? It feels native, but is it?
If it's native, how did they do it? UITextView with an active UITableView? It's really fast and smooth, so I'm guessing they load the phone with trending #'s and your #'s and it's fast because the data is local (it goes to just typing if it's not there).
But I'm wondering if there was a way to achieve this affect with data that is remote on a webserver using async calls.
Any thoughts on how to do this / get started?
If by 'native' you mean, build into the SDK, then I have to disappoint you, this is not a build-in SDK feature (there is something similar with the UISearchController/UISearchBar classes, but that's not what Twitter is leveraging).
This however, does not mean that you cannot build it yourself. I believe it would be quite simple. All you would have to do is monitor every time the user inputs text into the UITextView (this can easily be done using the UITextView delegate methods). You do a check on all the text, and if the user enters an '#' or a '#', or any other symbol you want to watch for, you create/show a UITableView beneath the text view (or wherever you want it).
As for the table view's datasource, it would have to be based on information you gather through search. When Twitter shows you a list of trending tags, etc. I would think it is something they have pulled down when you synced your feed, and then cached somewhere. If you were using a web server, you could do the same. When the user starts entering specific text, you could do a search on the server. If you do the network requests asynchronously, you can display a UIActivityIndicator in the table view, until you've gotten a response from the server. If the user enters more text before the server has 'replied' to you, simply cancel the old server request, and start a new one.
I haven't implemented something like this myself, and I have no knowledge of how it would perform in real-life, but if I was to implement something similar off the top of my head, this would be the aproach I would pursue. It might not suit your case perfectly, but hopefully, it will have given you some inspiration :)