[Project_owners] Opening files

Michael Buckley michael.buckley at hotmail.com
Wed Jul 26 19:19:12 EDT 2006


I have two questions that I can't seem to solve.

The first is how to select the path that the open file dialog opens
with?  What I am using looks like this.

openFileNow: function(){
    var openPath =
Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch)
        .getCharPref('extension.editor.folder.openSave')
    var openX = gStrings.getString('openX');
    const nsIFilePicker = Components.interfaces.nsIFilePicker;
    var fp =
Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
    fp.init(window, openX, nsIFilePicker.modeOpen);
    fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
    if (fp.show() == nsIFilePicker.returnOK) {
        var fileName = fp.file.leafName;
        var file = fp.file;
        var path = fp.file.path;
        var url = fp.fileURL.spec;

        mick_editor.openGeneral(file,path,fileName,url);
    }
},

openPath being the var that holds the path I want to open it with.

Also if your writing something for XULrunner how do you do something
with a file that the user has gone right-click -> Open With -> my app.
You know send it to a function or something.

_________________________________________________________________
New year, new job – there's more than 100,00 jobs at SEEK 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau&_t=752315885&_r=Jan05_tagline&_m=EXT



More information about the Project_owners mailing list