mIRC Home    About    Download    Register    News    Help

Print Thread
#29075 10/06/03 08:26 PM
C
coolspot
coolspot
C
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

#29076 10/06/03 08:52 PM
C
codemastr
codemastr
C
* Invalid parameters: $com (line 4, script21.mrc)

Thats what I get when I try that script.

#29077 10/06/03 09:18 PM
P
Poltergeist
Poltergeist
P
Quote:
* Invalid parameters: $com (line 4, script21.mrc)

Thats what I get when I try that script.


same here...

#29078 10/06/03 09:33 PM
C
coolspot
coolspot
C
oooops, try this line instead:

$com(odlg,BrowseForFolder,3,int,0,string,Open Dialog,int,0)

sorry about that...

#29079 11/06/03 12:56 AM
Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
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.

#29080 11/06/03 01:59 AM
C
coolspot
coolspot
C
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 smile

#29081 11/06/03 02:33 AM
C
coolspot
coolspot
C
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...

#29082 11/06/03 02:38 AM
Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
Good luck smile but don't be disappointed if there's no success. I hope the next version will reveal more.

#29083 11/06/03 03:01 AM
C
coolspot
coolspot
C
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.

Last edited by coolspot; 11/06/03 03:19 AM.
#29084 11/06/03 03:27 AM
Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
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?

#29085 11/06/03 03:29 AM
C
codemastr
codemastr
C
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...

#29086 11/06/03 03:31 AM
C
coolspot
coolspot
C
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.

Last edited by coolspot; 11/06/03 03:32 AM.
#29087 11/06/03 03:32 AM
C
codemastr
codemastr
C
Wait, correction, when I went to close mIRC it then crashed smile


Link Copied to Clipboard