Home All Groups Group Topic Archive Search About

How Using the "Select Users, Computer, and Groups" CommonDialog Bo



Author
9 May 2005 3:59 PM
pushkin
Hello

I'm working on a HTA to add Users to the Active Directory. To do this, I
thought to use a Common Dialog like CreateObject("UserAccounts.CommonDialog")
but I want the "Select Users, Computers, an Groups" Dialog.

Does anybody know how to use this Dialog in Windows Script? It seems to be a
common Dialog, but I dont know how to bring it into my Scripts.

Thank you very much

pushkin

p.s. Sorry my bad english. I am not so execised.

Author
9 May 2005 8:36 PM
Jim Vierra
I believe those dialogs are all part of ADUC MMC snap-in and are not exposed.  o find out use the Object Browser from any Office 2002/3 VBA editor.

Use LDAP and build a dialog in HTA using windows.showModalDialog (DHTML). The link has a working example you can click and see it in action.

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_window.asp

MS Example - it's not the most elegant MS example but it gets the point across
<SCRIPT>
function fnRandom(iModifier){
   return parseInt(Math.random()*iModifier);
}
function fnSetValues(){
   var iHeight=oForm.oHeight.options[
      oForm.oHeight.selectedIndex].text;
   if(iHeight.indexOf("Random")>-1){
      iHeight=fnRandom(document.body.clientHeight);
   }
   var sFeatures="dialogHeight: " + iHeight + "px;";
   return sFeatures;
}
function fnOpen(){
   var sFeatures=fnSetValues();
   window.showModalDialog("showModalDialog_target.htm", "", sFeatures)
}
</SCRIPT>

<FORM NAME=oForm>
Dialog Height <SELECT NAME="oHeight">
   <OPTION>-- Random --
   <OPTION>150
   <OPTION>200
   <OPTION>250
   <OPTION>300
</SELECT>

Create Modal Dialog Box
<INPUT TYPE="button" VALUE="Push To Create"
   onclick="fnOpen()">
</FORM>

--
Jim Vierra

Show quote
"pushkin" <push***@discussions.microsoft.com> wrote in message news:B4894D56-5602-4521-BC40-B9AD358C3ACF@microsoft.com...
> Hello
>
> I'm working on a HTA to add Users to the Active Directory. To do this, I
> thought to use a Common Dialog like CreateObject("UserAccounts.CommonDialog")
> but I want the "Select Users, Computers, an Groups" Dialog.
>
> Does anybody know how to use this Dialog in Windows Script? It seems to be a
> common Dialog, but I dont know how to bring it into my Scripts.
>
> Thank you very much
>
> pushkin
>
> p.s. Sorry my bad english. I am not so execised.
>
Author
10 May 2005 10:02 AM
pushkin
Dear Jim

Thank you for the quick reply. It is a interesting solution to display a
Dialogbox within a HTA, but thats not exactly what I thougt. I mean, I could
reprogramm the whole Dialog, but that isnt what I want. I am talking about
that kind of common Dialog like the scripting Guys describes in 
http://www.microsoft.com/technet/scriptcenter/topics/htas/fileopen.mspx (for
HTA)
or in http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan05/hey0128.mspx (Simple Example for VBS)
The mentioned Dialog "Select Users, Compute, and Groups" isnt only a part of
the ADUC MMC snap-in. There are several ways to open that dialog:
     * In the "Security" Tab of File and Foldersettings (Right click on a
File), with the "Add..." button
     * In the Computer Management Console: "System Tools" - "Local Users an
Groups" - Groups - Edit a Groups and you'll find the "Add..." Button again
wich opens my desired dialog.
     * In a third party Software Called SystemScripter
(www.scritpinternals.de) is a function to generate Code. One has the option
to Search an AD-User with this mentioned Dialog and insert the scriptcode
automatically.
     * I think there are many other ways.

I looked around a bit with several tools. I observed the processes and
found, that the "activeds.tlb" is called when a application opens this
dialog.
I found another clue in the Scripting Guy column linked below, that it has
to be possible to open a dialog to select Users and Groups.

I think there has to be a way to open that dialog trough a script.

Thanks for your help

pushkin

Show quote
"Jim Vierra" wrote:

> I believe those dialogs are all part of ADUC MMC snap-in and are not exposed.  o find out use the Object Browser from any Office 2002/3 VBA editor.
>
> Use LDAP and build a dialog in HTA using windows.showModalDialog (DHTML). The link has a working example you can click and see it in action.
>
> http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_window.asp
>
> MS Example - it's not the most elegant MS example but it gets the point across
> <SCRIPT>
> function fnRandom(iModifier){
>    return parseInt(Math.random()*iModifier);
> }
> function fnSetValues(){
>    var iHeight=oForm.oHeight.options[
>       oForm.oHeight.selectedIndex].text;
>    if(iHeight.indexOf("Random")>-1){
>       iHeight=fnRandom(document.body.clientHeight);
>    }
>    var sFeatures="dialogHeight: " + iHeight + "px;";
>    return sFeatures;
> }
> function fnOpen(){
>    var sFeatures=fnSetValues();
>    window.showModalDialog("showModalDialog_target.htm", "", sFeatures)
> }
> </SCRIPT>
>
> <FORM NAME=oForm>
> Dialog Height <SELECT NAME="oHeight">
>    <OPTION>-- Random --
>    <OPTION>150
>    <OPTION>200
>    <OPTION>250
>    <OPTION>300
> </SELECT>
>
> Create Modal Dialog Box
> <INPUT TYPE="button" VALUE="Push To Create"
>    onclick="fnOpen()">
> </FORM>
>
> --
> Jim Vierra
>
> "pushkin" <push***@discussions.microsoft.com> wrote in message news:B4894D56-5602-4521-BC40-B9AD358C3ACF@microsoft.com...
> > Hello
> >
> > I'm working on a HTA to add Users to the Active Directory. To do this, I
> > thought to use a Common Dialog like CreateObject("UserAccounts.CommonDialog")
> > but I want the "Select Users, Computers, an Groups" Dialog.
> >
> > Does anybody know how to use this Dialog in Windows Script? It seems to be a
> > common Dialog, but I dont know how to bring it into my Scripts.
> >
> > Thank you very much
> >
> > pushkin
> >
> > p.s. Sorry my bad english. I am not so execised
Author
11 May 2005 5:29 PM
Al Dunbar [MS-MVP]
"pushkin" <push***@discussions.microsoft.com> wrote in message
news:AC7083EB-524B-424E-88B6-19F9B0B64BC5@microsoft.com...
> Dear Jim
>
> Thank you for the quick reply. It is a interesting solution to display a
> Dialogbox within a HTA, but thats not exactly what I thougt. I mean, I
could
> reprogramm the whole Dialog, but that isnt what I want. I am talking about
> that kind of common Dialog like the scripting Guys describes in
> http://www.microsoft.com/technet/scriptcenter/topics/htas/fileopen.mspx
(for
> HTA)
> or in
>
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan05/hey0128.mspx
(Simple Example for VBS)
Show quote
> The mentioned Dialog "Select Users, Compute, and Groups" isnt only a part
of
> the ADUC MMC snap-in. There are several ways to open that dialog:
>      * In the "Security" Tab of File and Foldersettings (Right click on a
> File), with the "Add..." button
>      * In the Computer Management Console: "System Tools" - "Local Users
an
> Groups" - Groups - Edit a Groups and you'll find the "Add..." Button again
> wich opens my desired dialog.
>      * In a third party Software Called SystemScripter
> (www.scritpinternals.de) is a function to generate Code. One has the
option
> to Search an AD-User with this mentioned Dialog and insert the scriptcode
> automatically.
>      * I think there are many other ways.
>
> I looked around a bit with several tools. I observed the processes and
> found, that the "activeds.tlb" is called when a application opens this
> dialog.
> I found another clue in the Scripting Guy column linked below, that it has
> to be possible to open a dialog to select Users and Groups.
>
> I think there has to be a way to open that dialog trough a script.

Nice work, you seem to be quite persistent.

The .TLB file would seem to contain a type library. What is actually invoked
would seem to be located elsewhere. If packaged as a COM object, the
solution would likely have already been found (and be a simple one). If
packaged in a .DLL, one would need a wrapper of some kind to expose it as a
COM object for use in script.

Not my area of expertise, though... Anyone else?

/Al

> Thanks for your help
>
> pushkin
>
> "Jim Vierra" wrote:
>
> > I believe those dialogs are all part of ADUC MMC snap-in and are not
exposed.  o find out use the Object Browser from any Office 2002/3 VBA
editor.
> >
> > Use LDAP and build a dialog in HTA using windows.showModalDialog
(DHTML). The link has a working example you can click and see it in action.
> >
> >
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_window.asp
Show quote
> >
> > MS Example - it's not the most elegant MS example but it gets the point
across
> > <SCRIPT>
> > function fnRandom(iModifier){
> >    return parseInt(Math.random()*iModifier);
> > }
> > function fnSetValues(){
> >    var iHeight=oForm.oHeight.options[
> >       oForm.oHeight.selectedIndex].text;
> >    if(iHeight.indexOf("Random")>-1){
> >       iHeight=fnRandom(document.body.clientHeight);
> >    }
> >    var sFeatures="dialogHeight: " + iHeight + "px;";
> >    return sFeatures;
> > }
> > function fnOpen(){
> >    var sFeatures=fnSetValues();
> >    window.showModalDialog("showModalDialog_target.htm", "", sFeatures)
> > }
> > </SCRIPT>
> >
> > <FORM NAME=oForm>
> > Dialog Height <SELECT NAME="oHeight">
> >    <OPTION>-- Random --
> >    <OPTION>150
> >    <OPTION>200
> >    <OPTION>250
> >    <OPTION>300
> > </SELECT>
> >
> > Create Modal Dialog Box
> > <INPUT TYPE="button" VALUE="Push To Create"
> >    onclick="fnOpen()">
> > </FORM>
> >
> > --
> > Jim Vierra
> >
> > "pushkin" <push***@discussions.microsoft.com> wrote in message
news:B4894D56-5602-4521-BC40-B9AD358C3ACF@microsoft.com...
> > > Hello
> > >
> > > I'm working on a HTA to add Users to the Active Directory. To do this,
I
> > > thought to use a Common Dialog like
CreateObject("UserAccounts.CommonDialog")
> > > but I want the "Select Users, Computers, an Groups" Dialog.
> > >
> > > Does anybody know how to use this Dialog in Windows Script? It seems
to be a
Show quote
> > > common Dialog, but I dont know how to bring it into my Scripts.
> > >
> > > Thank you very much
> > >
> > > pushkin
> > >
> > > p.s. Sorry my bad english. I am not so execised
Author
11 May 2005 8:18 PM
Jim Vierra
Al is correct.  If it doesn't show in references and the object browser in
VBA then, in my experience, it can't be used from scripting without writing
a COM wrapper.

--
Jim Vierra

Show quote
"Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com> wrote in message
news:%23YwO67kVFHA.3544@TK2MSFTNGP12.phx.gbl...
>
> "pushkin" <push***@discussions.microsoft.com> wrote in message
> news:AC7083EB-524B-424E-88B6-19F9B0B64BC5@microsoft.com...
>> Dear Jim
>>
>> Thank you for the quick reply. It is a interesting solution to display a
>> Dialogbox within a HTA, but thats not exactly what I thougt. I mean, I
> could
>> reprogramm the whole Dialog, but that isnt what I want. I am talking
>> about
>> that kind of common Dialog like the scripting Guys describes in
>> http://www.microsoft.com/technet/scriptcenter/topics/htas/fileopen.mspx
> (for
>> HTA)
>> or in
>>
> http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan05/hey0128.mspx
> (Simple Example for VBS)
>> The mentioned Dialog "Select Users, Compute, and Groups" isnt only a part
> of
>> the ADUC MMC snap-in. There are several ways to open that dialog:
>>      * In the "Security" Tab of File and Foldersettings (Right click on a
>> File), with the "Add..." button
>>      * In the Computer Management Console: "System Tools" - "Local Users
> an
>> Groups" - Groups - Edit a Groups and you'll find the "Add..." Button
>> again
>> wich opens my desired dialog.
>>      * In a third party Software Called SystemScripter
>> (www.scritpinternals.de) is a function to generate Code. One has the
> option
>> to Search an AD-User with this mentioned Dialog and insert the scriptcode
>> automatically.
>>      * I think there are many other ways.
>>
>> I looked around a bit with several tools. I observed the processes and
>> found, that the "activeds.tlb" is called when a application opens this
>> dialog.
>> I found another clue in the Scripting Guy column linked below, that it
>> has
>> to be possible to open a dialog to select Users and Groups.
>>
>> I think there has to be a way to open that dialog trough a script.
>
> Nice work, you seem to be quite persistent.
>
> The .TLB file would seem to contain a type library. What is actually
> invoked
> would seem to be located elsewhere. If packaged as a COM object, the
> solution would likely have already been found (and be a simple one). If
> packaged in a .DLL, one would need a wrapper of some kind to expose it as
> a
> COM object for use in script.
>
> Not my area of expertise, though... Anyone else?
>
> /Al
>
>> Thanks for your help
>>
>> pushkin
>>
>> "Jim Vierra" wrote:
>>
>> > I believe those dialogs are all part of ADUC MMC snap-in and are not
> exposed.  o find out use the Object Browser from any Office 2002/3 VBA
> editor.
>> >
>> > Use LDAP and build a dialog in HTA using windows.showModalDialog
> (DHTML). The link has a working example you can click and see it in
> action.
>> >
>> >
> http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_window.asp
>> >
>> > MS Example - it's not the most elegant MS example but it gets the point
> across
>> > <SCRIPT>
>> > function fnRandom(iModifier){
>> >    return parseInt(Math.random()*iModifier);
>> > }
>> > function fnSetValues(){
>> >    var iHeight=oForm.oHeight.options[
>> >       oForm.oHeight.selectedIndex].text;
>> >    if(iHeight.indexOf("Random")>-1){
>> >       iHeight=fnRandom(document.body.clientHeight);
>> >    }
>> >    var sFeatures="dialogHeight: " + iHeight + "px;";
>> >    return sFeatures;
>> > }
>> > function fnOpen(){
>> >    var sFeatures=fnSetValues();
>> >    window.showModalDialog("showModalDialog_target.htm", "", sFeatures)
>> > }
>> > </SCRIPT>
>> >
>> > <FORM NAME=oForm>
>> > Dialog Height <SELECT NAME="oHeight">
>> >    <OPTION>-- Random --
>> >    <OPTION>150
>> >    <OPTION>200
>> >    <OPTION>250
>> >    <OPTION>300
>> > </SELECT>
>> >
>> > Create Modal Dialog Box
>> > <INPUT TYPE="button" VALUE="Push To Create"
>> >    onclick="fnOpen()">
>> > </FORM>
>> >
>> > --
>> > Jim Vierra
>> >
>> > "pushkin" <push***@discussions.microsoft.com> wrote in message
> news:B4894D56-5602-4521-BC40-B9AD358C3ACF@microsoft.com...
>> > > Hello
>> > >
>> > > I'm working on a HTA to add Users to the Active Directory. To do
>> > > this,
> I
>> > > thought to use a Common Dialog like
> CreateObject("UserAccounts.CommonDialog")
>> > > but I want the "Select Users, Computers, an Groups" Dialog.
>> > >
>> > > Does anybody know how to use this Dialog in Windows Script? It seems
> to be a
>> > > common Dialog, but I dont know how to bring it into my Scripts.
>> > >
>> > > Thank you very much
>> > >
>> > > pushkin
>> > >
>> > > p.s. Sorry my bad english. I am not so execised
>
>

AddThis Social Bookmark Button