Launch application using openwith on mouse click - objective-c

Can any one tell me about how to lanch a self-made application using the "openwith" feature of a mouse click event?

Your question is not very clear, but I understand it as "How do I tell the Finder that my application knows handle certain file types?". Once the Finder knows the link, it will suggest your application in the Open With submenu that appears when you ctrl/right-click on a file.
Have a look at the Apple documentation. Basically, you have to declare all the supported file types in Info.plist (or what you called it). The system is based on Universal Type Identifiers.

Related

How to create a file in a mac app

I am new to programming mac apps in Objective-C and need help with this. When I control click and drag to first responder from a button it brings up a box from which you can select some predefined functions that run when the button is clicked. On of the functions says newDocument. I was wondering if this means that it creates a new document (file) and if so how to actually make it create the file. I tried selecting newDocument but when I ran the app it said this: 2016-03-16 15:39:57.889 Test[26619:4382721] The (null) type doesn't map to any NSDocumentClass. My button is simply named create file and has no code attached to it, only the predefined function.
The method you are seeing, newDocument, is part of the Document Architecture. If you wish to use it you need to study the documentation, the particular function newDocument creates a "document" within your app along with an associated "window" rather than a "file" per se.
It sounds like you really need to read the Cocoa Event Handling Guide to learn how to handle a mouse event, and the File System Programming Guide to learn how to read & write files.
HTH

How do I add my own option to Finder's right click menu?

I have an app that basically takes a file path(s) and copies the data name and extension from it to be used in my app. I was wondering how to add on to the Finder right click menu (like Dropbox does) and do run some Objective-C code when clicked. (I need to get the path(s) of the selected file). Is there any way to do this? All the answers I've seen are very vague and unhelpful. I do not want to use mach_inject because my app might go onto the appstore, and I can probably get FinderSync API to work.
Take a look at the FinderSync API in Yosemite; I'm fairly sure you don't need to sync anything, but you can use the API to install a toolbar and sidebar item as well.

Add more one button on Attach menu of Whatsapp

I've an idea to develop a modification to WhatsApp, for example now when I click attachment symbol it shows only 6 I want to add one more option to it. If it's possible let me know. I want to add more one button on Attach menu.
It is not clear what exactly you are asking.
You have an option to launch other applications from your app.
If you want to change the way a certain app looks, or behaves you have to write something similar to it for people to use, but you cannot change the original app (no one will let you)
Here you go! it's possible, as #Jef said in comments.
using documentation interaction controller.
https://www.whatsapp.com/faq/iphone/23559013
you need to work on how to hook into attachment menu.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDocumentInteractionController_class/
There is an assumption in your question that these other apps are put there by the whatsApp developers, or by a third party who was somehow able to modify their code. I suspect that what is happening is that they (whatsApp) simply export a document/file of a certain type (UTI) If your application supports that same UTI it should appear here. So there is six buttons for you, on your phone, but another user might see a different number, it depends entirely what they have installed on their device.
CONCEPTUAL.. if you double click on a file on your computer then the file browser (OS) opens that file with some application or other. Perhaps it is a .doc file and the OS pushes that file to word or pages. Or it may be a .psd file and it gets pushed to photoshop. How does this happen? The OS has a registry (database) of applications for each file type, applications sign up on this when they install/update. If you right click on a file you see an 'open in..' option that lists all your applications which can handle that file type, this is the menu that you are wanting to get onto (for whatsApp's file type) imho.
So you need to
1 ascertain what file type (UTI) WhatsApp is exporting
2 declare support for that file type in your application (this is the bit which will be platform specific solution) (iOS docs https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html#//apple_ref/doc/uid/TP40010411-SW1 )
**edit/addition
3. add the code to actually handle the file when your app receives it. On iOs this is in the appDelegate in
-(void) application: openURL: sourceApplication:annotation:
If the Whatsapp people have published an API then thats where you want to look. Good luck

Mac OS X: Global Shortcut to get selected text/image in Application

I'm trying to build an app that get's selected text from other applications if a certain shortcut/hotkey is pressed. First I tried the Carbon Hotkey API, but then I couldn't get selected text from other applications. Second I've tried building a service that gets the selected text from other applications and is called with a global shortcut, but I wasn't able to use a custom shortcut. Somehow only CMD+SHIFT is allowed as a modifier in the plist and these kind of shortcut is already used in many applications so it's often not working. CTRL and a key would be a cool shortcut, because not many applications use this kind of shortcut, but I can't specify such a modifier.
Any Ideas how to solve this problem?
To answer your second question, you can manually edit the Services plist file. Find details here:
Set Custom KeyEquivalent in Services Menu

Modifying the file upload dialog of firefox

Is there any way to modify the file upload dialog in firefox with an extension (XUL or Javascript) ?
I'd like to give the user the possibility to encrypt the file(s) before uploading them to whereever (facebook, gmail, gmx, ...) and I thought the easiest way is to add a checkbox to the file upload dialog and check for that.
There is no native support for something like that.
So you have to find a workaround to provide this possiblity.
The easiest way would most likely be to simply add the checkbox near the file upload button instead of directly in the dialog that shows up. Most likely it would even be noticed better like this.
An other way would be to create your own file dialog using other technologies like a java applet or some flash content. The advantage of this way is clearly, that you can handle all operation that have to be done for the encryption directly inside that applet. Then your firefox plugin would only have to trigger the loading of your applet for each file upload dialog.
No. Internally nsIFilePicker interface is used to create this dialog - as you probably see there isn't a whole lot of configuration options. That's because Gecko will use the system's file selection dialog where available (Windows, Mac OS X) and changing this dialog is non-trivial to say the least. So even if you were creating this dialog yourself - you wouldn't be able to add a checkbox to it. You need to find some other solution.