Launching applications and opening documents

Generally there are two ways to start an application and open a document:
1)double click on the application, us the menu to open the document.
2)double click on a document, application starts, application loads document.
In writing a program, how do I do #2. Specifically how does the application determine what document to open? Is it passed in argc or by an event callback?
Can it only happen using Cocoa and carbon, or can it be done through a command line utility/standard tool?

It sounds like what you want is create a small Cocoa application that includes the code I posted above and register it as owning the suffix of the dataset. Let's call the application Opener and the suffix .datz.
When someone double-clicks on a .datz file the Opener application will be invoked and you will get the filepath to the invoking file in the supplied filename. That would give you the path and the opportunity (if you want to get fancy) to ask the user for where to save the data or do any other GUI stuff you want to do. You could also set-up Opener so that when someone opens if by double-clicking the application it asks them to navigate to the dataset they want to open. These things are actually pretty easy to do - check out NSSavePanel and NSOpenPanel - because the Cocoa classes give you a lot of rich GUI all pre-rolled. Then your application could invoke the Unix application from the command line supplying the source path (escaped for Unix) and the even the save destination path if you want to get fancy.
The application can then Quit itself - possibly after displaying feedback from the Unix app if there is any. Unfortunately while I know this is possible and there are a bunch of Unix commands wrapped in GUI interfaces for OS X - this isn't my strong suit. I know it can be as simple as:
system("ls -al");
But it also gets more complicated quickly if you want to do more. Then you need something like NSTask I can't help you the you may need to appeal here for someone with CLI invocation experience.
http://www.cocoadev.com/index.pl?NSTask
http://www.borkware.com/quickies/one?topic=NSTask
This is actually quite do-able. You're diving into the Cocoa GUI a little headfirst because your app is essentially all GUI so there may be some head scratching but its well within the realm of possibility.
=Tod

Similar Messages

  • Auto Launch Application and perform some action

    Hello Friends,
    I am working on Autoback, want to launch application and perform some action to take backup.
    Can any one please update me what all the J2ME phone supports this kind of feature and basic needs to implement Autobackup, any sample code available please let me know
    Thanks,
    Kumar.M.R

    Something sketchy.
    I had the same message appear. It resized my window to the smallest possible size (not minimize!) and when I resized it larger, it had opened a new tab with that message. It was on "c510a1.minersaver1.com" which sounds like a related site. It tried to download "avmast_2004-4_mst5.exe"and I was going to try and refind this site on my Linux box, but forgot to save the exact URL (oops!).
    Running Firefox 4.0b11 on 64-bit Windows 7 Home Premium.
    EDIT: Found a LIVE link
    http://c510a1.minersaver1.com/defender/?44a=pccfjf&8d1ad=glslkkqpgl&eb45=gpqmpkkcmc&03f67=3

  • How do I change the preferred application to open documents from Libra office to Microsoft office?

    How do I change the preferred application to open documents from Libra office to Microsoft office?

    Select a document of that type in the Finder, choose Get Info from the File menu, click on Open With, select the desired application, and press the Change All button.
    (116411)

  • How to exit from a WebDynpro ABAP application and open another url

    Hi Friends,
    How to exit from a WebDynpro ABAP application and open another url like (www.yahoo.com) in the same window of the WD4 application on click of a Button?
    Regards,
    Xavier

    Hi,
    First of all you should create outbound plug in the window you are trying to exit with plufg type "Exit"
    Then create method handler in the view with this code
            data lo_view_cntr type ref to if_wd_view_controller.
            data lo_win_cntr type ref to if_wd_window_controller.
            data: l_parameter_list type wdr_event_parameter_list,
                  l_parameter type wdr_event_parameter,
                  l_val type ref to data,
                  l_val_url type REF TO data.
            field-symbols: <fs> type any,
                           <fs_url> type any.
            lo_view_cntr  = wd_this->wd_get_api( ).
            lo_win_cntr = lo_view_cntr->get_embedding_window_ctlr( ).
            CREATE DATA l_val type c.
            CREATE DATA l_val_url type string.
            ASSIGN l_val->* to <fs>.
            ASSIGN l_val_url->* to <fs_url>.
            <fs> = 'X'.
            <fs_url> = 'http://your-link.com'.     
            l_parameter-name = 'URL'.
            l_parameter-value = l_val_url.
            INSERT l_parameter INTO TABLE l_parameter_list.
            lo_win_cntr->if_wd_view_controller~fire_plug( EXPORTING plug_name = 'EXIT_PLUG'
                                                                    parameters = l_parameter_list ).
          You can easily change this logic to exit application instead of redirecting to the site
           just changing to
           l_parameter-name = 'CLOSE_WINDOW'.

  • Security Settings won't reset "Launching applications and unsafe files"

    Hi,
    I'm using Windows 8.1 update 1 with IE.
    I found a very strange problem,
    If I changed the setting of:
    Security tab-> Internet -> Custom level -> Miscellaneous -> Launching applications and unsafe file,
    for example, I changed the setting from default "Prompt" to
    "Enable",
    Then I tried to reset all setting to "Medium-high(default)" at "Reset custom settings",
    The setting I changed above never goes back to its default setting, it keeps the status "Enable".
    All other settings I changed would be reset normally but only this one refuse to be reset.
    B.T.W,  I noticed this because somehow my IE refused to allow me download any exe file, even though I tried to reset the security setting. The only way which could let me reset this is to click the reset button in "Advanced" tab.
    I don't know if this is intended or a bug or something wrong with my PC, but this is dangerous I think, because it made me believe that I have reset my security setting but actually not.
    I tried to scan my PC with windows defender and MalwareBytes and found no threat. Windows update is also in an up-to-date state. I also tried to launch IE as admin then reset the security setting and with no luck.
    I'm worrying about my PC is getting some kind of virus which caused this problem, so if any information will be appreciated.
    Thanks in advance!

    Hi,
    Reset button indeed can't change it as default. I also could reproduce this issue.
    Thanks for your feedback and I have already submitted to our development team.
    If you want to go back to "Prompt" status now, you need to uncheck "Enable" and check "Prompt" checkbox manually.
    Karen Hu
    TechNet Community Support

  • Getting "open recent" items and "open documents" from an application

    How do I ask Textedit (if running) for the list of documents currently open?
    How do I ask Textedit (if running ) for the list of "open recent" items?
    Thank you

    Thank you. This does the job for "opened documents" in TextEdit and other applications. I wish there were a similar method for "open recent" items. Each application (TextEdit, BBEdit etc) seems to handle the "open recent" items in its own way!
    Thank you again.

  • Open Sharepoint File Launches application to Open Dialog

    We are experiencing the following behavior on one machine in our group. The environment is SharePoint Online 2013, with libraries synchronized to the user PC. User PC is Windows 8.1 with Office 2013.
    When you double-click a SharePoint file to open it, it launches the appropriate Office program, but it launches to the "Open" dialog (open local file, use a template, etc.)
    If you close the program (Word, Excel, Visio, etc.) and double-click the file again to open it, it typically opens properly. On some occasions, it behaves as described above again.
    Once the file is successfully opened, it opens properly from there forward.
    When the file is actually opening, the splash screen indicates it is "downloading" the file, and there is a delay. The file is actually synchronized and has a local copy.
    If you open a true local copy of any MS file format (not in a synchronized folder), the files open properly.
    I suspect this is an issue with the office document cache or something, but I find no fix for this behavior.

    try these links:
    http://sharepoint.stackexchange.com/questions/122609/open-a-link-of-excel-with-the-dialog-popup-window-in-quick-launch-sharepoint-201
    http://blog.sharedove.com/adisjugo/index.php/2012/09/29/open-sharepoint-files-in-edit-mode-from-client-applications-and-not-read-only/
    Please mark as answer if you find it useful else vote for it if it is close to answer..happy sharepointing

  • Cannot launch application to open a file from jdev extension

    Hello:
    I use the following code to let my application to open a file:
    String[] cmd = new String[3];
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[2] = "myfile.pdf;
    Process p = Runtime.getRuntime().exec(cmd);
    p.waitFor();
    It worked fine if it was in a main method running in jdev. However, my application is a jdev client launched by clicking run/debug extension on project icon. When that part of code was executed, I didn't see the file got opened. No cmd.exe process got created either. I am wondering if I need to do something more to make it work. (I did enable "allow program input" in Tool Settings in Run/Debug/Profile of the project property).
    Anyone who knows this may offer some help/hint?
    Thanks.

    Hi there
    Perhaps this trick will help.
    Do the file browse thing where it appears to lock up.
    Press Alt+Spacebar and release both keys.
    Presss M. (selects the Move command)
    Press any arrow key.
    Wiggle the mouse around a little and see if the window pops into view.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Is there any way to use RUN button to deploy the application and open IE...

    Hi
    Thank you for reading my post
    i used to use Run button to compile / deploy and run (opening the browser to project context path) .
    i want to know is there any way to use RUN button to deploy an application to standalone OC4J and opening browser?
    I know that we can define ear or war deployment profiles and use them to deploy the application to stand alone server , but i want a single click solution.
    thanks

    Hello,
    Try disabling graphics hardware acceleration. Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches.
    You might need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    Then perform these steps:
    *Click the orange Firefox button at the top left, then select the "Options" button, or, if there is no Firefox button at the top, go to Tools > Options.
    *In the Firefox options window click the ''Advanced'' tab, then select "General".
    *In the settings list, you should find the ''Use hardware acceleration when available'' checkbox. Uncheck this checkbox.
    *Now, restart Firefox and see if the problems persist.
    Additionally, please check for updates for your graphics driver by following the steps mentioned in the following Knowledge base articles:
    * [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    * [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    Did this fix your problems? Please report back to us!
    Thank you.

  • Tabbing Through Apps AND Open Documents???????

    Hi all. Quick question.
    I live by the CMD + Tab shortcut for Mac OS, I love it, it saves me a lot of time. Heres my question:
    Is there a way to use the CMD + Tab shortcut to not only tab through applications but to also tab through open documents??
    For instance, If I have have multiple Microsoft Word (or any application with more than one document open) files up and I want to tab through them, what is the shortcut for that??
    Thanks for any input!

    Ferd gave you the keyboard shortcut you are looking for. Just to add another way, you can also easily navigate through open windows by clicking and holding on the app's icon in the Dock.
    -mj
    [email protected]

  • Difference between hyperlink and open document link

    Hi experts,
    Currently i am using sap bo 4.0
    when i see the both hyperlink and open doc link the options are same like link to web page and link to document.
    if there is no difference what is the exact use

    Hi Venkat,
    For linking 2 reports you need to go with hyperlink/document link which uses opendocument concept. please refer the URL for opendoc tutorial.
    IT Developer's World: OpenDoc URL's with SAP BI4.0

  • 2 AIR Questions: Launching applications and Viewing PDFs...

    I am thinking of purchasing Adobe Flex Builder 3 and planning to have the app run on multiple platforms.
    I have three major questions:
    1. In an AIR program, how do I go about opening/accessing Word documents and/or PDF files (whether by launching Acrobat Reader/Microsoft Word or opening it in AIR)?
    2. Is it true that an AIR application can not execute other applications? If so, do I need to add a plug-in for that (ie: Shu)?
    Regards,
    John M.

    I am thinking of purchasing Adobe Flex Builder 3 and planning to have the app run on multiple platforms.
    I have three major questions:
    1. In an AIR program, how do I go about opening/accessing Word documents and/or PDF files (whether by launching Acrobat Reader/Microsoft Word or opening it in AIR)?
    2. Is it true that an AIR application can not execute other applications? If so, do I need to add a plug-in for that (ie: Shu)?
    Regards,
    John M.

  • How do I get desktop icons to reflect the orignal associated application and open correctly?

    Product Name: HP Pavilion dv6 Notebook PC
    Product Number: A1U55AV#ABA
    Operating System: Windows 7 (x86)
    All desktop and start menu icons are identical.  As such, the incorrect application opens when clicked. 
    How do I restore (system restore hasn't worked) so the correct application is associated with the icon?
    HP Customer Support in India has been working on this for weeks and seems unwilling to escalate to someone, preferably US-based, more knowledgable in order to resolve the issue.

    Hi Meibach,
    this sounds like malware - I would recommend a full antivirus scan.
    However if yo uare having no other issues I found the following steps online:
    To Reset Icon cache follow the below mentioned steps –
    1. Right click on empty area of the desktop and click on Personalize.
    2. Click on the Display Properties link.
    3. Under Colors, select Medium (16-bit) and click on Apply.
    NOTE: If you already have Medium (16-bit) selected, then select Highest (32-bit) instead. Sometimes you will need to do a restart first, then proceed to step
    4. Try both ways.
        A) Click yes to confirm the new settings.
    5. Now, select Highest (32-bit) and click on OK.
    NOTE: If you already have Highest (32-bit) selected, then select Medium (16-bit) instead.
       A) Click on Yes to confirm the new settings.
    To Rebuild icon cache follow the below mentioned steps -
    1. Click Start, then control panel and in the search box write Folder options.
    2. Now click Folder Options to open and select (dot) Show hidden files and folders.
    3. Open a Windows Explorer window.
    4. Go to C:\Users\(User Name)\AppData\Local
    5. Right click on IconCache.db and click on Delete.
    6. Click on Yes to confirm the deletion.
    NOTE: This deletes the file to the Recycle Bin. It is safe to empty the Recycle Bin when finished.
    7. Close the window.
    8. Empty the Recycle Bin.
    9. Restart the computer.
    10. When you go back, you will notice the Size of the IconCache.db file is smaller, and the Date Modified is now the current date.
    NOTE: If for some reason IconCache.db is not there or the size has not changed much then you may just restart the computer again. You may need to restart a couple of times in some cases.
    11. The icon cache will get rebuilt.
    -Bryan
    I am an HP employee

  • Reconnecting Application and opening a new applications

    My issue is that using server 2012 R2, I have setup any connections that have been disconnected and try to reconnect. All the programs seems to work fine except our internal ERP software which reconnects then opens another instance of the software. Has
    anyone ran into the issue and have a fix?

    Is it web based? Could be the application crashes and causes IE to open a new window. The application developer may be able to shed some light on it.
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • I updated to the latest numbers on my iMac but now when I try and open documents it tells me I need the latest version to open?

    Can anyone help?

    Please look in the Applications for the most up-to-date version of Numbers. I suspect you got a free upgrade to OS X Mavericks and also updated your iWorks apps. If that is correct you have two versions of number on the computer, you cannot open a new file with the older version of Numbers, this is what I am guessing you are attempting.

Maybe you are looking for