How to get the filename of document that opened my app

Hope that makes sense. I'm relatively new to OS X programming and have built a small Cocoa app (not a document-based app). I've associated a file type (.myFileType) with my application. If I double-click a file with that file type, it opens my app automatically as expected. From within my app, how do I get the full pathname of the document that opened my app?

I know what you're saying. IB is made to seem easy, but when you start asking "What's this?", and "What does that do when the nib is loaded??", the pretty pictures suddenly aren't as clear as they seemed. Been there!
The File's Owner never causes the creation of an object. It's always a "proxy" (a stand-in) for an object that's created elsewhere. The actual object may be defined in another xib, or it may be created in code. In MainMenu.xib. the File's Owner is a proxy for the Application object. The Application object isn't created because of that nib, it's created by the startup code before the nib is loaded. But the "proxy" allows you to make connections to the Application object in the xib.
I know this is clear as mud so far, but it will start to make sense after you grok a few more pieces of the puzzle. A good place to start might be Anatomy of a Nib File in the +Resource Programming Guide+.
Nib proxies are actually easier to understand when building an iPhone app. In that case, the SDK makes it much easier to associate proxies with the objects they represent. The concept is still the same, but for example, bridging two iPhone xibs with a proxy only takes a couple mouse clicks in IB.
Hope that helps!
\- Ray

Similar Messages

  • How to get the filename from J2SE File adapter

    In our project scenario , we are using J2EE and J2SE engine both .J2EE for mapping  and J2SE for Deliveying the message .
    In one senario, routing will be based on the filename .
    J2SE Sender File adapter --- XI Adapter --- XI pipe line
    So the File reaching to XI pipelane via J2SE File adapter--> XI adapter.
    When we are using the dynamic configurator in the XI to get the filename
    we are not able to get the file name  becasue it is coming to XI via
    XI adapter.
    How to get the filename ????Hope I am clear about the problem.

    try this
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    //obtengo la Key del FileName
    DynamicConfigurationKey keyF = DynamicConfigurationKey.getName();
    Hope it helps
    Edited by: Rodrigo Pertierra on Apr 11, 2008 9:31 AM

  • How to get the list of documents

    Hi everyone
    Can anyone help me How to get the list of documents residing in a folder of KM repository of SAP Netweaver using a simple java program
    Thanks in ADV.
    Rupesh Khemka

    Hi Rupesh,
    I have written the code for you and it works with WebDynpro, no seperate java program is required.
    Just try to paste it in your application code and run it.
         // Will check the user athentication for EP
                    IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
         IUser sapUser = wdClientUser.getSAPUser();  ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
         ResourceContext context = new ResourceContext(ep5User);
                    // The path in which your folder resides
         RID rid1 =RID.getRID("/documents/Public Documents/SCAP/");
         IResourceFactory factory1 = ResourceFactory.getInstance();
         ICollection icollection = (ICollection)factory1.getResource(rid1, context);
         IResourceList resourcelist = icollection.getChildren();
         int size1 = resourcelist.size();
         for(int s=0; s<listOfDocuments.getLength(); s++){
              IResource resource = resourcelist.get(i);
              InputStream input = new InputStream();
              input = resource.getContent().getInputStream();
    }catch(Exception e){
    Once you get the InputStream everything else is possible....
    This will surely help you in reading the documents from KM.
    Rekha Malavathu

  • How to get the Next Material Document Number

    Please let me know How to get the next Material Document Number using Functional Module,
    Material Document number are  in MSEG table.

    Hi Ganesh,
    if you want the next matrial number then first of all you have to define it as a number range in transaction snro.After creating the number range you have to define the interval.
    now you can use your number range by calling the function module
            nr_range_nr             = '01' " here you have to give the number range number which you have defined in number range
            object                  = 'ZPRODLOG' " Number Range
            number                  = wa_prod_error_log-seqnr " sequence number generated,in your case material number field
            interval_not_found      = 1
            number_range_not_intern = 2
            object_not_found        = 3
            quantity_is_0           = 4
            quantity_is_not_1       = 5
            interval_overflow       = 6
            buffer_overflow         = 7
            OTHERS                  = 8.
    each and every time next number will get generated .
    i hope this will help you.

  • How to get the number of files currently open?

    does any one know how to get the number of files currently open in windows OS?
    e.g. lets say .txt files...
    any comment will be really appreciated.

    Assuming that you don't want to actually do this from within Java code (which would obviously require native code), here's a utility that will give you a list of which file handles are opened by which processes (on Windows):
    - K

  • Why do I get the following message when I open an APP. Connect to ITUNES to use push notifications. What do I need to do to resolve this issue.

    Why do I get the following message when I open an APP. Connect to ITUNES to use push notifications. What do I need to do to resolve this issue.

    I have had the same problem since the iOS 7 update, but with regards to the Find Friends app. uninstalling and reinstalling the app has not fixed the problem

  • How to get the filename of the active jsp page?

    how can i get the filename of the active jsp page?

    You could register the JSP [ages in the web.xml and then use the ServletConfig.getServletName.
    You could use the JspContex.getServletName which will return the registered name or the name of the servlet class.
    You could programmatically add a page context attribute that holds the jsp page name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to get the filename when parsing a file with d3l

    After some time have experience with interconnect, IStudio I need the following info. Is it possible to get the filename when parsing a flat file using a d3l? This is needed because we need to store the filename together with the data into the database.
    Any examples or directions to some documents are welcome.
    Olivier De Groef

    has anyone some info on this

  • Data aquisition board installation,how to get the operation system know that the board exsist and to give it a number?

    I'm a green hand on hardware. This question is maybe kind of a silly quetsion.
    I already have a data acquisition board installed (built-in) and there is the corresponding program to control it.
    Now I need to install another board to the computer, and make the necessary Vi to control the new board. I'm wondering what should be the procedure like? HOW to get the computer know the new board. Should there be any driving program coming along with the hardware. Or the operation system should get to know the existing of the new hardware once it's installed( i mean plug in). Thank you for your kind reply!

    Hi Fenny,
    What is the model number of the second board? If your existing driver has support for this board (which I'm assuming is a NI board, and it's plug and play), your OS (which I'm assuming is Windows) should recognize it when you start up your computer after installation. You can find out the driver support for your board and OS from the link below. If the installation was successful, you should be able to see the new board in the Measurement and Automation Explorer (MAX) under "Devices and Interfaces". If you can see the board in MAX, there will be a device number assigned to the board, which you can use in your VI to communicate with it.
    If any of the above assumptions is incorrect, please provide some details (i.e. hardware used, driver you currently have installed, OS, and the application you'd like to use this new board for), and we can work from there.
    Data Acquisition (DAQ) Installation/Configuration Troubleshooter
    Lesley Y.

  • How to get the current user name in Provider hosted app using appOnlyAccessToken

    Please help me, how to get the HostWeb UserName in Provider Hosted App
    i have Provider hosted App, and Anonymous Authentication is enabled on AppWeb, using appOnlyAccessToken
    Below code does not return current user who Log in in hostweb, it is returning
    SharePoint App (app@sharepoint)
    Web web = clientContext.Web;
    Below code gives a blank name when Anonymous Authentication is enabled, if Anonymous Authentication is disabled
    app prompts for credentials 

    Since you are using a provider Hosted app if you want to get the current logged in name than do not use AppOnlyAccessToken else use AccessToken which is App + user Context AccessToken.
    Web web = clientContext.Web;
    clientContext.Web.CurrentUser.LoginName;will return proper user Name.
    HttpContext.Current.User.Identity.Name will never return the user as this object is related to IIS server of your App Server not should set this as Anonymous in case of provider hosted can download the below sample which uses the AccessToken which has user name in it.
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • How to get the filename of the opened Illustrator document

    Hi All,
    I'm using Adobe Illustrator CS2, i have problem in getting the file name of the document opened. i have succesfully got the document reference(of opened document) but from that reference i'm not able to find the method which gives me the filename. Can you please help me out.

    Hello, I need to automatically enter the file name and date in a drawing using illustrator DC 2014, please can you help me understand how can I do?
    Thanks so much

  • How to get the filename of the current active document in InDesign CS4?

    If I open a document from File->Open, I can get the document's file name using IOpenedFileInfo->GetOpenedFilePath().
    But, if I create a new document and perform File->SaveAs, GetOpenedFilePath is returning invalid IDFile reference.
    What is the right way to get the active document's file name?

    You can try this:
         IDatabse * db = ::GetDatabase(theDoc);
         IDFile *  sysFile = db->GetSysFile();
         PMString docName = sysFile->GetFileName();
    Good luck

  • How to get the web of document from the URL

    Hi All,
    Need small help here,
    I have SharePoint doc URL as below:
    Here, TestFile existed in document library of Subsite i.e. sub3.
    If I give above URL as input, I should be able to get "sub3" web.
    How can achieve this programmatically. Overall we should get the leaf web from the URL.
    Thanks in advance.

    Hi Sanny521,
    The SPSite constructor does not care when you pass in the document library and filename as part of the url. you can use the following code:
    string myFileUrl = "";
    using (SPSite site = new SPSite(myFileUrl))
    using (SPWeb web = site.OpenWeb())
    SPFile file = web.GetFile(myFileUrl);
    string webUrl = web.ServerRelativeUrl;
    You pass the full url into the SPSIte constructor, it will retrieve the site collection, then the OpenWeb call will retrieve the proper web from the already passed full url, then you can retrieve the file and the url of the SPWeb.
    Mathieu Desmarais

  • Already connected with DB content. how to get the filename???

    Hi, i solved my problem changing the server.xml, so now i can connect OK to Oracle Content Database, using the last code from OTN.
    This BPEL Process starts when the user copies a file into a folder in content db..and i need to know that filename.
    Anyone knows how to get that file name after i am connected???
    The code i am using and works to connect is this:
    oracle.ifs.fdk.RemoteLoginManagerServiceLocator rlmsl =
    new oracle.ifs.fdk.RemoteLoginManagerServiceLocator();
    // initialize the RemoteLoginManager
    oracle.ifs.fdk.RemoteLoginManager s_RLM =
    rlmsl.getRemoteLoginManager(new"" + "/ws/RemoteLoginManager"));
    // establish a session
    oracle.ifs.fdk.NamedValue[] properties= s_RLM.login("kofax","xxxxxxxxxx", null, null);
    catch(Throwable ex)

    Did you every find how to accomplish this?

  • How to get the filename from URL

    I want get the file name from the url while downloading a file. here is my case follows:
    I have url like "" . this will download ""; file from the browser.
    I want download the file from that url and save that as "";, how can we get the file name ""; from java. I am using ConnectionURL to download the file.
    waiting for the earliest responses.

    Specify it in the content-disposition header.
    To get it to work in a certain webbrowser, you need to supply it as part of the URL either.
    Also see this example: [].

Maybe you are looking for