I found you can access the Shell.Application connection to then access the BrowseForFolder() method. The problem I have is not getting the Open Dialog to appear, but, the value it returns from the directory I choose is a numeric value. Heres what I mean:
alias open_dialog {
.comopen odlg Shell.Application
if ($comerr) { echo -a error | return }
var %dlg = $com(odlg,BrowseForFolder,3,0,Open File,0)
echo -a %dlg
}
this successfully opens a Open File dialog. Problem is when calling the BrowseForFolder method, the return value of %dlg is a interger similar to 654403. MSDN states that the BrowseForFolder method will create a new Folder object in which I can just use Folder.Title to get the name of the folder selected. Does anyone know how to do this using mirc since DISPATCH/UNKNOWN doesnt seem to work as it should? (maybe it does but I cant get it to)... thanks
* Invalid parameters: $com (line 4, script21.mrc)
Thats what I get when I try that script.
oooops, try this line instead:
$com(odlg,BrowseForFolder,3,int,0,string,Open Dialog,int,0)
sorry about that...
Not only you are asking this question... the help file is very unclear regarding dispatch/unknown. Please inform us if you get it to work.
not sure if I can, I've tried (in previous COM scripts) to use it in 100's of various ways without success, but I'll continue to try
Only thing Im getting close with is using $com(odlg).dispatch which lets me know there IS in fact a pointer in the $com() connection im trying to use. However .unknown is showing false, so my next objective is to see which item is in fact a pointer, and retrieve that so that the object is create successfully by BrowseForFolder()...I think I may be onto something...
Good luck
but don't be disappointed if there's no success. I hope the next version will reveal more.
Well, I managed to get it working, using dispatch, and it does create a new com object named folder which returns a value. However, if I close the com connection and then try to do it again mirc has some memory errors and crashes, try this out for size:
alias cdlg {
comopen odlg Shell.Application
if ($comerr) {
echo comopen failed
comclose odlg
halt
}
var %dlg = $com(odlg,BrowseForFolder,3,int,0,string,Testing,uint,BIF_BROWSEINCLUDEFILES,dispatch*vfolder,odlg)
echo -a $com(odlg,vfolder)
comclose odlg
}
Just run /cdlg, pick a folder, and click ok, vfolder will return the result. Then run it again, pick a folder, it ok and BOOM memory errors.
im not one to fool with com's but whouldn't u have a second $comerr check after the second open? maybe that would catch it before mirc gets the short end of the stick?
Well it didn't crash here (WinME), but it also didn't work. The first run I got the output of:
6128440
When I ran in the second time, after picking the folder I got:
* Invalid parameters: $com (line 8, script3.mrc)
Seems rather weird that mIRC had no problem with it the first time, then running it again it gives a syntax error...
ok I got it working but without crashing, and vfolder is now a usable object (that stores 6583xx) as a value...at least we're getting somewhere. Now to try and use its methods and properties. Try this on for size:
alias cdlg {
comopen odlg Shell.Application
if ($comerr) {
echo comopen failed
comclose odlg
halt
}
var %dlg = $com(odlg,BrowseForFolder,3,int,0,string,Testing,uint,BIF_BROWSEINCLUDEFILES)
var %test = $com(odlg,Folder,3,dispatch*vfolder,odlg)
echo -a $com(odlg,vfolder)
comclose odlg
}
Now vfolder is a usable $com() object. Now we need to use vfolder and call I believe its Folder.Title or maybe just title since its auto assumed to be a folder object.
Wait, correction, when I went to close mIRC it then crashed