Page 2 of 2 <12
Topic Options
#157520 - 2006-03-01 02:33 PM Re: AD Explorer by Chris S.
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
your right, it is very loose, but I think if the line starts or ends with a @CRLF (one of the two) it fails - should fix that.
Top
#157521 - 2006-03-01 03:16 PM Re: AD Explorer by Chris S.
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
You guys are the business. It was "" between that long string at the end. All the icons are on show now. One thing though, the disabled account icon is not appearing.

A seperate thing, on the copy adsPath (LDAP://OU=Computers,OU=Site,DC=Domain,DC=com) is there any way to just copy the computer name or the name listed rather the path?

Top
#157522 - 2006-03-01 03:46 PM Re: AD Explorer by Chris S.
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
Found the solution to the adsPath. Using $item.Subitems(0).text instead $item.Subitems(0).tag.

Disabled icons are now showing.

I have a new query though. Is there a way to add a right click menu to the listview? I had it all worked out for the previous version using the $System.ContextMenu() method. Cannot work this one out though.


Edited by kirkside (2006-03-01 04:41 PM)

Top
#157523 - 2006-03-02 02:20 AM Re: AD Explorer by Chris S.
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
You should still be able to use the ContextMenu strategy, here is a little example:

Code:

Break on

$System = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.Size = 640,480

$MainMenu = $System.MainMenu()

$FileMenu = $MainMenu.MenuItems.Add("File")

$ExitMenu = $FileMenu.MenuItems.Add("Exit")
$ExitMenu.OnClick = "ExitClick()"

$Form.Menu = $MainMenu

$ListView = $Form.ListView()
$ListView.Dock = "Fill"
$ListView.SmallImageList = $System.BuiltinImageList
$ListView.HideSelection = 0

$Column = $ListView.Columns.Add("Item")

For $i = 0 to 5
$Item = $ListView.Items.Add("Item#$i",$i)
Next

$ListView.Columns(0).Width = -1
$ListView.Columns(0).Width = -2

$ContextMenu = $System.ContextMenu

$InsertItemMenu = $ContextMenu.MenuItems.Add("Insert")
$InsertItemMenu.OnClick = "InsertItemClick()"

$DeleteItemMenu = $ContextMenu.MenuItems.Add("Delete")
$DeleteItemMenu.OnClick = "DeleteItemClick()"

$ListView.ContextMenu = $ContextMenu

$Form.Center()
$Form.Show()

While $Form.Visible
$=Execute($Form.DoEvents())
Loop

Exit 1

Function ExitClick()
$Form.Hide
EndFunction

Function InsertItemClick()

If $ListView.SelectedItems.Count = 0
Return
Endif

$Item = $ListView.Items.Insert($ListView.SelectedIndex)
$Item.Text = "Item"

EndFunction


Function DeleteItemClick()

If $ListView.SelectedItems.Count = 0
Return
Endif

$ListView.Items.Remove($ListView.SelectedIndex)

EndFunction


Top
#157524 - 2006-03-02 04:04 PM Re: AD Explorer by Chris S.
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
I get the below error after adding the $contextMenu code to the ADBrowser code.

ERROR : undefined variable [contextmenu]!

Top
#157525 - 2006-03-02 04:08 PM Re: AD Explorer by Chris S.
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
If you set Option Explicit off

$=SetOption("Explicit","Off")

Does the error go away ?

Top
#157526 - 2006-03-02 04:12 PM Re: AD Explorer by Chris S.
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
Thank you for the quick response. The error does go away. Still cannot right click though.
Top
#157527 - 2006-03-02 04:19 PM Re: AD Explorer by Chris S.
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Well, to fix that last issue, set Option Explicit back on, and DIM your context menu like this:

Global $ContextMenu

Did the test script I posted work ?

-Shawn

Top
#157528 - 2006-03-02 04:26 PM Re: AD Explorer by Chris S.
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
OK, added the Global $ContextMenu bit, no errors but also no right clicks. Then amended the final line to look like this - $Form.ListView1.ContextMenu = $ContextMenu - and now it works. Shawn, you Rock! Thank you for your help. Now I just need to work out how to show a different menu based on if it is the computer or a users container selected.
Top
#157529 - 2006-03-02 04:49 PM Re: AD Explorer by Chris S.
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Cool, let us know if you need a hand.
Top
Page 2 of 2 <12


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 973 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.061 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org