How to make a background macOS application? - swift

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!

Related

Copy and pasting selected text from the current, from a Mac sandboxed application

I am trying, from a sandboxed menubar application, to get the selected (highlighted) text in the current application.
I was using accessibility before and traversing the main menu of the application until finding the copy item but unfortunately, I need to sandbox the application and this is no more a valid approach.
I would like to simulate the ⌘ + C keyboard shortcut but so far all my attempts failed.
so far all my attempts failed
There is a reason for that...
A core purpose of the sandbox is to provide isolation between applications, to prevent one application from accessing the data of another. So what you are asking is how to break out of the sandbox...
If you are writing accessibility software take a look at How to use Accessibility with sandboxed app? for maybe the smallest glimmer of a hope.
Otherwise your current path is a (hopefully, its a sandbox) dead-end, security has a price, sorry.

K2: How may I open a file in a new window unless I already have such a window open?

I have a K2 Smartform that displays a list of file names. When the user clicks a file name, the program opens that file (all of them are PDFs) in a new tab in the browser (IE). This is good so far. If you click on a second file from the list, it opens in a third tab. That is not what the user wants.
They want the second file selection to open in the same window as the first file.
This is the process I can see:
Click on the file in the list.
Open in a tab.
Click on a second file in the list.
If there is already a tab open with a file from the list, open this file there. Otherwise, open a new tab for the file.
I suppose automatically closing the first tab when they click on the second file would accomplish the same thing.
How can this be done?
When you deal with opening links, first of all, what you can do is limited. Indeed, browsers (IE, Chrome, etc...) can be configured by the users to open links in new tabs, windows, etc... and you as form developer cannot change that.
I have made a jsfiddle to reproduce your situation and propose a solution you can test. I don´t guaranty it will work as I use a Mac but I also describe a better solution below.
You can find it here:
https://jsfiddle.net/chevdor/45k40npv/
I guess the first example (#1) is what happens for you at the moment.
Using the 'target' attribute, I tried to implement a solution that may work for you. Click on #2 and #3 and check whether this work.
I cannot test that since I use a Mac.
You can read more about the target attribute here:
http://www.w3schools.com/tags/att_a_target.asp
Another solution that would give you more control is to use an iFrame control. I think it comes in standard with SmartForms now. If not, you can for sure get it from the community site. I recommend you create a new View with this iFrame and define one parameter (string) called "url".
Let´s speak in K2 rules languages :)
"When the parameter changed", "and the parameters is defined", if you 'Transfer data' passing your URL to the iFrame control, it will display your doc. If the user clicks another document, it will update the SAME iFrame. With this solution, no tab will ever be involved.
Please note that it will work great for any document supported by your browser. Some types may require a plugin. Other documents (ie zip, etc..) will NOT appear but be downloaded instead.
I hope this helps.
Best regards,
-chevdor

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.

Cannot find custom application

This is going to sound like a really dumb question, but we had a developer who created a Facebook web application for us.
He has left the company and is not being very co operative. We have the log in details of the account he used to created the app, but when we log in and try to view the app, it does not appear in our list of custom apps.
In the graph explorer, when trying to debug the key and URL, the app does appear in the drop down though, but we need to change some other custom settings.
Can anyone direct me in which direction I need to go to look for this?
Thanks
Finally. got him to let us log in and that is where it was. All that time wasted for nothing.

Where should I open initial dialogs in an Eclipse application?

I have an Eclipse RCP application. When the application is started I want to immediately present the user with a login dialog. Where is the best place to do this?
I've tried to use various hooks in the WorkbenchAdvisor and WorkbenchWindowAdvisor, but all of these open a dialog before the application had a task bar icon. In this case the dialog can easily be moved behind other windows and there will be no visual indication that the application is open, and the user might open several instances of the application by mistake.
I could force the dialog to be on top, but that's not a good solution. I want a proper modal dialog. A good example of such a dialog is Firefox's "save page as" dialog. When this dialog is present it is always in front of the main browser window; you must complete or close the dialog before you can effectively resume browsing the web. However, this "save page as" dialog doesn't force itself to be on top of every window, just the browser.
You can make a splash screen your login dialog: see an example here.
First: Is it allowed to have multiple instances open? If not, you have to implement independent from the Login-Dialog-Problem something that prevents opening several instance. Take a look here (btw: I made good experiences with the server-socket thing).
Second: If you overwrite #postWindowOpen in your ApplicationWorkbenchWindowAdvisor the application is up and running (including task-item). The only drawback is that your views are already opened, you have to reload them after a successful login.