mIRC Home    About    Download    Register    News    Help

Print Thread
#29075 10/06/03 08:26 PM
Joined: Mar 2003
Posts: 50
C
Babel fish
OP Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
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
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
* Invalid parameters: $com (line 4, script21.mrc)

Thats what I get when I try that script.

#29077 10/06/03 09:18 PM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
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
Joined: Mar 2003
Posts: 50
C
Babel fish
OP Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
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,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
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
Joined: Mar 2003
Posts: 50
C
Babel fish
OP Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
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
Joined: Mar 2003
Posts: 50
C
Babel fish
OP Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
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,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
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
Joined: Mar 2003
Posts: 50
C
Babel fish
OP Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
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: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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?


-KingTomato
#29085 11/06/03 03:29 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
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
Joined: Mar 2003
Posts: 50
C
Babel fish
OP Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
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
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Wait, correction, when I went to close mIRC it then crashed smile


Link Copied to Clipboard