This is the code I used for Screenshot Sender 4
code:
function BrowseForFolder(sTitle){
var BrowseInfo = Interop.Allocate(32);
var foldertitle = Interop.Allocate((255+1) * 2);
BrowseInfo.WriteDWORD(8, foldertitle.DataPtr);
var pTitle = Interop.Allocate((sTitle.length+1) * 2);
pTitle.WriteString(0, sTitle, false);
BrowseInfo.WriteDWORD(12, pTitle.DataPtr);
BrowseInfo.WriteDWORD(16, 1);
var pidl = Interop.Call('shell32', 'SHBrowseForFolder', BrowseInfo);
var folderpath = Interop.Allocate((255+1) * 2);
Interop.Call('shell32', 'SHGetPathFromIDList', pidl, folderpath);
return folderpath.ReadString(0, false)+'\\';
}
//Usage
Debug.Trace(BrowseForFolder('Pick a Folder'));