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.

    hi,
    try this
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    //obtengo la Key del FileName
    DynamicConfigurationKey keyF = DynamicConfigurationKey.getName();
    http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/DynamicConfigurationKey.html
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c89607-e4d9-2910-7280-f6746e964516
    /people/mohammed.zabiulla/blog/2008/03/26/have-you-ever-tried-to-determine-mail-cc-dynamically
    Hope it helps
    Thanks
    Rodrigo
    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.
    try{
         // Will check the user athentication for EP
                    IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
         IUser sapUser = wdClientUser.getSAPUser(); 
         com.sapportals.portal.security.usermanagement.IUser 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){
         e.getMessage();
    Once you get the InputStream everything else is possible....
    This will surely help you in reading the documents from KM.
    Regards,
    Rekha Malavathu

  • How to get the Next Material Document Number

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

    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
    CALL FUNCTION 'NUMBER_GET_NEXT'
          EXPORTING
            nr_range_nr             = '01' " here you have to give the number range number which you have defined in number range
            object                  = 'ZPRODLOG' " Number Range
          IMPORTING
            number                  = wa_prod_error_log-seqnr " sequence number generated,in your case material number field
          EXCEPTIONS
            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.
    Thanks,
    Tanmaya

  • How to get the number of files currently open?

    hi,
    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.
    thanks

    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):
    http://www.sysinternals.com/ntw2k/freeware/handle.shtml
    - 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

    All
    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.
    Regards
    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
    Thanks,
    Lesley Y.

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

    Hi, 
    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;
    clientContext.Load(web);
    clientContext.ExecuteQuery();
    clientContext.Load(web.CurrentUser);
    clientContext.ExecuteQuery();
    clientContext.Web.CurrentUser.LoginName;
    Below code gives a blank name when Anonymous Authentication is enabled, if Anonymous Authentication is disabled
    app prompts for credentials 
    HttpContext.Current.User.Identity.Name
    Thanks
    Ram

    Hi,
    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.
    then 
    Web web = clientContext.Web;
    clientContext.Load(web);
    clientContext.ExecuteQuery();
    clientContext.Load(web.CurrentUser);
    clientContext.ExecuteQuery();
    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 sharepoint.you should set this as Anonymous in case of provider hosted app.you can download the below sample which uses the AccessToken which has user name in it.https://code.msdn.microsoft.com/Working-provider-hosted-8fdf2d95
    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?

    Hi,
    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?
    Thanks,
    VSP

    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:
    http://sharepoint.com/sub1/sub2/sub3/documents/TestFile.docx
    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.
    Krishnasandeep

    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 = "http://sharepoint.com/sub1/sub2/sub3/documents/TestFile.docx";
    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 http://www.matdesmarais.com/

  • 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:
    try
    oracle.ifs.fdk.RemoteLoginManagerServiceLocator rlmsl =
    new oracle.ifs.fdk.RemoteLoginManagerServiceLocator();
    rlmsl.setMaintainSession(true);
    // initialize the RemoteLoginManager
    oracle.ifs.fdk.RemoteLoginManager s_RLM =
    rlmsl.getRemoteLoginManager(new java.net.URL("https://contentdev.nblenergy.com/content" + "/ws/RemoteLoginManager"));
    // establish a session
    oracle.ifs.fdk.NamedValue[] properties= s_RLM.login("kofax","xxxxxxxxxx", null, null);
    addAuditTrailEntry("properties",properties);
    catch(Throwable ex)
    {addAuditTrailEntry("Others",ex);                               
           ex.printStackTrace();                         
          }

    Did you every find how to accomplish this?
    Thanks,
    Steve

  • How to get the filename from URL

    Hi,
    I want get the file name from the url while downloading a file. here is my case follows:
    I have url like "http://www.myhost.com/dowloadFile.do?id=345546" . this will download "test.zip"; file from the browser.
    I want download the file from that url and save that as "test.zip";, how can we get the file name "test.zip"; from java. I am using ConnectionURL to download the file.
    waiting for the earliest responses.
    -Bhaskar

    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: [http://balusc.blogspot.com/2007/07/fileservlet.html].

Maybe you are looking for

  • Oracle 8.1.6 on Corel Linux

    Hello! Can`t install 8.1.6 on Corel Linux 1.0. The runInstaller can`t start. It terminates with an "Memory Access Failure". Do I have the wrong distribution? Monika

  • CS5 7.0.3 on Mac OS X 10.5.8 crashes on opening file

    A document which contains pages placed as images from other INDD documents crashes INDD on opening. Is there another way I can open this? Here's the crash report, if that helps. Thank you. Process:         Adobe InDesign CS5 [524] Path:            /A

  • Whats the difference between ABAP stack, ABAP+Java stack and Java stack

    Hello, I have a nagging doubt about the difference between the ABAP stack, ABAP+Java stack & the Java only stack. I believe that the method of applying the kernel for all the 3 types is different. Also can we apply the ABAP support packs through JSPM

  • Customer Master giving "Data is incomplete; check ;Message F2125" on saving

    While creating Customer master for a newly defined sales organisation, when i try to save the entry, the screen goes to Partner Function and it displays the error :- Data is incomplete; check Message no. F2125 What needs to be done Thanks amit

  • BSP page was terminated due

    Hello Experts, I have setup the solaris sever system monitoring (Solman with ECC).. I folled the simulator tool and configured sytstem monitoring.. Now when i click Operation- > System monitoring - >  receive an below eror message.. =================