Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 20, 2009, 09:46 AM   #1
satyam90
macrumors regular
 
Join Date: Jul 2007
Location: Bangalore, India
Send a message via Yahoo to satyam90
NSWorkSpace open File

I am using Cocoa with Obj C.
I am using the following method to open a file associated with a particular application.
Code:
[[NSWorkspace sharedWorkspace] openFile:<some file path>]
But if the file is associated with certain application, it is opening.

If the file is not associated with any application, I want the user to select the application also with which the file has to be opened. In the following code we have to tell which application it has to open.
Code:
[[NSWorkspace sharedWorkspace] openFile:< some file path> withApplication:@"TextEdit"]
But I want user to select the application at run time dynamically.

--Satya.
satyam90 is offline   0 Reply With Quote
Old Aug 20, 2009, 10:57 AM   #2
kainjow
Demi-God (Moderator emeritus)
 
kainjow's Avatar
 
Join Date: Jun 2000
You can probably use LSCopyApplicationURLsForURL() (or one of the other Launch Services functions) to determine if there already is a default app to open it. If that returns empty, use NSOpenPanel to let the user select an app.
kainjow is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
OS X Lion Opening Previously Opened Files US Marine Mac Basics and Help 3 Sep 28, 2011 08:35 PM
Is There an "Always Open With" feature to change default applications for 9.2.2 files In-Correct PowerPC Macs 2 Aug 8, 2011 10:24 AM
Annoying File Open Issue Super_Saxy Mac OS X 3 Jan 8, 2011 01:44 PM
Photoshop Help Please! "Cannot Open File Because File Is Empty ipodtouchy333 Mac Applications and Mac App Store 2 Mar 21, 2010 09:50 AM
Opening files in OSX - opens VMware Fusion dave1609 Mac Applications and Mac App Store 1 Oct 18, 2008 09:40 AM


All times are GMT -5. The time now is 04:06 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC