"Open With" On mac OS

Joined
Apr 8, 2009
Messages
4
Reaction score
0
Points
1
i have created a Mac OS application using XCode to Compile and Qt Frameword to develop

i am facing a major problem :( regarding the "open with" command on Mac OS

first of all , my application is supposed to support type files such as "djf" files



if i open my program and work on it for a while , the user has the option to save his work file as djf files

now if the user clicks back on the djf file , my application is supposed to open and load the djf file clicked by the user


the first problem that i am facing is that , the "open with" command on MAC OS is graying out my application so the user has to change the options on the top from "Recommended applications" to "all applications" so that the user will be able to click on my application and select it


the second problem that i have is that even though the user selects my application, my application opens a new instance of it self rather than loading the file being passed as an argument using the command line


i did few tests on my application and i found that my application never receives the file name as an argument in the main.cpp and that was the reason of why it doesnt load the file

i did few more tests using the command line of mac OS where a user can simply say:

open -a [application path/application.app] [argument "file name"]

i noticed that my application never receives [argument "file name"]

then i noticed that if you remove "open -a" from the command line and just keep [application path/application.app] [argument "file name"] while diving in to the application.app/Contents/MacOS/applicationName

this will certainly pass all the parameters needed and my application will load the saved work document to be edited once again

so i am pretty confused , why "open -a" is not passing the right arguments

please note: that open -a only passes two arguments to my application
1- the application path
2- a wierd argument which says "psn_0_xxxxxx"

but as soon as you type in the command line

application.app/Contents/MacOS/applicationName [filename]

this will pass the right arguments to my application

if some one can answer my question that would be great

thanks :[
 

Neo


Joined
Aug 14, 2007
Messages
557
Reaction score
25
Points
28
Your Mac's Specs
white MB 2.16GHz 3GB 320GB 10.6.1
What is your question?
 
OP
C
Joined
Apr 8, 2009
Messages
4
Reaction score
0
Points
1
the question is

how can you open a file type with a specific application

because its not working for me
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
I don't know much about OSX programming, but you may have to do something, perhaps a plist or something, that notifies the system that your program should be associated with those files.

Unfortunately, your question extends beyond the just open a file with a specific app, since you are able to do that but it is launching your program in a separate instance (which also might imply that you may have to identify if your program is already running and pass the handle to the existing instance of your app).

Unfortunately, your question is more suited to a developer forum rather then a users forum :( Have you given apples developer forums a try on your question? I know Apple has a set, and there are a few other forums out there for OSX developers (doing a quick google search on OSX Developer forum) - you might be able to get a more accurate response to your issue...
 
OP
C
Joined
Apr 8, 2009
Messages
4
Reaction score
0
Points
1
thanks a lot Nethfel I'll try that out

maybe the MacOS forum is the place where to post such question
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
This is something that has to be set programmatically (I think). I would also suggest going to a forum that talks specifically about Qt or a Qt mailing list. I'm sure Trolltech/Nokia has one.
 
OP
C
Joined
Apr 8, 2009
Messages
4
Reaction score
0
Points
1
i have done this already and i am going to let you know if i find a solution to benefit every one
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top