What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [HELP] Browsing to save a file

[HELP] Browsing to save a file
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [HELP] Browsing to save a file
I don't understand those flags etc., but here's the code anyway:

code:
function BrowseFile(filter,title,file) { // these ARE specified
    var SaveFileName = Interop.Allocate(88);
    var filter;
    var s_filter;
    var file;
    var s_file;
    var s_title;
    var ret;
    var tdata;
    with(SaveFileName) {
        WriteDWORD(0,Size); // lStructSize
        WriteDWORD(4,0); // hwndOwner
        WriteDWORD(8,0); // hInstance
        filter;
        s_filter = Interop.Allocate(2 * (filter.length + 1));
        WriteMultiStringW(s_filter, filter);
        WriteDWORD(12,s_filter.DataPtr); // lpstrFilter
        WriteDWORD(16,0); // lpstrCustomFilter
        WriteDWORD(20,0); // nMaxCustomFilter
        WriteDWORD(24,1); // nFilterIndex
        file + Space(256);
        s_file = Interop.Allocate(2 * (file.length + 1));
        s_file.WriteString(0,file);
        WriteDWORD(28,s_file.DataPtr); // lpstrFile
        WriteDWORD(32,file.length); // nMaxFile
        WriteDWORD(36,0); // lpstrFileTitle
        WriteDWORD(40,0); // nMaxFileTitle
        WriteDWORD(44,0); // lpstrInitialDir
        title;
        s_title = Interop.Allocate(2 * (title.length + 1));
        s_title.WriteString(0,title);
        WriteDWORD(48,s_title.DataPtr); // lpstrTitle
        WriteDWORD(52,OFN_ENABLESIZING | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_PATHMUSTEXIST/* | OFN_FILEMUSTEXIST*/); // flags
        WriteWORD(56,0); // nFileOffset
        WriteWORD(58,0); // nFileExtension
        WriteDWORD(60,0); // lpstrDefExt
        WriteDWORD(64,0); // lCustData
        WriteDWORD(68,0); // lpfnHook
        WriteDWORD(72,0); // lpTemplateName
        WriteDWORD(76,0); // pvReserved
        WriteDWORD(80,0); // dwReserved
        WriteDWORD(84,0); // FlagsEx
    }
    with(SaveFileName) {
        Ret = Interop.Call("comdlg32.dll","GetSaveFileNameW",SaveFileName);
        if(ret == 0) {
            return "__none";
        } else {
            return Ret;
        }
    }
}

function WriteMultiStringW(datablock,string) {
    var pos = 0;
    datablock.WriteString(0,string);
    pos = string.indexOf("|",pos);
    while(pos != -1) {
        datablock.WriteWORD(2 * pos, 0);
        pos = string.indexOf("|",pos + 1);
    }
}

function Space(number) {
    var i;
    var s = "";
    for(i = 0; i < number; i++) {
        s += " ";
    }
    return s;
}

05-20-2008 07:44 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[HELP] Browsing to save a file - by SmokingCookie on 05-20-2008 at 02:56 PM
RE: [HELP] Browsing to save a file - by Matti on 05-20-2008 at 03:48 PM
RE: [HELP] Browsing to save a file - by SmokingCookie on 05-20-2008 at 04:04 PM
RE: [HELP] Browsing to save a file - by matty on 05-20-2008 at 07:41 PM
RE: [HELP] Browsing to save a file - by SmokingCookie on 05-20-2008 at 07:44 PM
RE: [HELP] Browsing to save a file - by roflmao456 on 05-20-2008 at 07:52 PM
RE: [HELP] Browsing to save a file - by Spunky on 05-20-2008 at 09:43 PM
RE: [HELP] Browsing to save a file - by matty on 05-21-2008 at 12:29 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On