KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Net Send GUI

 
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive
View previous topic :: View next topic  
Author Message
wvhetrick
KiXforms Novice
KiXforms Novice


Joined: 21 May 2003
Posts: 1
Location: USA, PA

PostPosted: Fri Oct 21, 2005 3:19 pm    Post subject: Net Send GUI Reply with quote

Here is a script I have been working on as a GUI to netsend. It finds the domain groups you are in and when you select a group, it list all the users in that group. This was my starter script to get back into programming since I have not been doing it for a while.
Code:


;Allows a break in the code without logging the user off
Break On 
;Requires all Variables to be declared
$ = SetOption("explicit", "on")
;Define the variables
Global $System,$form,$cmbGroups,$cmbName,$txtMessage,$cmdSend
Global $cmdinfo,$lbluser,$lbldate,$lbltime,$lbldomainn,$strAuthDistinguishedName
Global $lblGroup,$grpgroups,$grpmessage,$s,$error,$Ldap,$kixformsdir
; to set the kixforms directory in case it is not installed.
$kixformsdir="\\server\share\"               ; ***
; Register Kixforms if not already registered
:top
If VersionCompare(GetFileVersion("%windir%\system32\kixforms.dll"), "<", "2.3.0.41")
   Shell 'regsvr32 %windir%\system32\kixforms.dll /u'
   Copy "$kixformsdir\kixforms.dll" %windir%\system32
   Shell 'regsvr32 /s %windir%\system32\kixforms.dll'
EndIf
; Start of KixForms Main Form

$System = CreateObject("Kixtart.System")

;KD START

;************* Form **************
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.Height = 238
$Form.Left = 168
$Form.Text = "Message Center Version 1.0"
$Form.Top = 175
$Form.Width = 509
;**************************************

;************* cmbGroups **************
$cmbGroups = $Form.Controls.ComboBox()
$cmbGroups.DropDownWidth = 121
$cmbGroups.fontsize = 8
$cmbGroups.Height = 21
$cmbGroups.Left = 75
$cmbGroups.MaxLength = 50
$cmbGroups.Sorted = "True"
$cmbGroups.Text = ""
$cmbGroups.Top = 25
$cmbGroups.Width = 150
$cmbGroups.list = EnumGroups()
$cmbGroups.Listindex = 0
$cmbGroups.OnSelectedIndexChanged = "RefreshUsers()"
;**************************************

;************* cmbName **************
$cmbName = $Form.Controls.ComboBox()
$cmbName.DropDownWidth = 121
$cmbName.Height = 21
$cmbName.Left = 300
$cmbName.MaxLength = 50
$cmbName.Sorted = "True"
$cmbName.Top = 25
$cmbName.Width = 140
$cmbName.list = groupmembers(@domain,$cmbGroups.Text,1)
;**************************************

;************* txtMessage **************
$txtMessage = $Form.Controls.TextBox()
$txtMessage.Height = 52
$txtMessage.Left = 30
$txtMessage.MaxLength = 200
$txtMessage.Multiline = "True"
$txtMessage.Text = ""
$txtMessage.Top = 75
$txtMessage.Width = 458
;**************************************

;************* cmdSend **************
$cmdSend = $Form.Controls.Button()
$cmdSend.Height = 23
$cmdSend.Left = 195
$cmdSend.Text = "Send"
$cmdSend.Top = 145
$cmdSend.Width = 75
$cmdSend.OnClick = "cmdsend_click"
;**************************************

;************* lblUser **************
$lblUser = $Form.Controls.Label()
$lblUser.BackColor = 212,208,200
$lblUser.BorderStyle = 2
$lblUser.Height = 21
$lblUser.Left = 15
$lblUser.Text = "You are: " + @userid
$lblUser.Top = 180
$lblUser.Width = 324
;**************************************

;************* lblDate **************
$lblDate = $Form.Controls.Label()
$lblDate.BackColor = 212,208,200
$lblDate.BorderStyle = 2
$lblDate.Height = 21
$lblDate.Left = 345
$lblDate.Text = "@date"
$lblDate.Top = 180
$lblDate.Width = 71
;**************************************

;************* lblTime **************
$lblTime = $Form.Controls.Label()
$lblTime.BackColor = 212,208,200
$lblTime.BorderStyle = 2
$lblTime.Height = 21
$lblTime.Left = 420
$lblTime.Text = "@Time"
$lblTime.Top = 180
$lblTime.Width = 53
;**************************************

;************* lblDomainN **************
$lblDomainN = $Form.Controls.Label()
$lblDomainN.BackColor = 212,208,200
$lblDomainN.Height = 19
$lblDomainN.Left = 240
$lblDomainN.Text = "User ID:"
$lblDomainN.Top = 25
$lblDomainN.Width = 72
;**************************************

;************* lblGroup **************
$lblGroup = $Form.Controls.Label()
$lblGroup.BackColor = 212,208,200
$lblGroup.Height = 22
$lblGroup.Left = 30
$lblGroup.Text = "Group:"
$lblGroup.Top = 25
$lblGroup.Width = 51
;**************************************

;************* grpGroups **************
$grpGroups = $Form.Controls.GroupBox()
$grpGroups.BackColor = 212,208,200
$grpGroups.Height = 45
$grpGroups.Left = 15
$grpGroups.Text = "@Domain Information:"
$grpGroups.Top = 10
$grpGroups.Width = 479
;**************************************

;************* grpMessage **************
$grpMessage = $Form.Controls.GroupBox()
$grpMessage.BackColor = 212,208,200
$grpMessage.Height = 81
$grpMessage.Left = 15
$grpMessage.Text = "Message"
$grpMessage.Top = 60
$grpMessage.Width = 477
;**************************************

;KD END
; Shows the form
$Form.Show
; Starts the Event Procedures
While $Form.Visible
   $s=Execute($Form.DoEvents())
Loop
Exit 1
;*********************Functions Section********************

Function cmdSend_Click()
   Dim $Msg,$Name
   $Name = $cmbName.text
   If $name = ""
      $error=MessageBox("Please choose a name","User ID Verification")
      Return
   EndIf
   $msg = $TxtMessage.text + ' - ' + @USERID
   $lblUser.Text = "Please wait, sending message to " + $Name
   Shell '%comspec% /c net send $name "$msg" >nul 2>nul'
   If @ERROR
      Beep
      $lblUser.Text = "An error occurred while sending a message to " + $Name
      $lblTime.Text = "@Time"
      $lblDate.Text = "@date"

   Else
      $txtmessage.text = ""
      $lblUser.Text = "The message was sucessfully sent to " + $Name
      $lblTime.Text = "@Time"
        $lblDate.Text = "@date"

   EndIf
   
EndFunction
;************************************************************************ 
Function VersionCompare($Ver1, $Comparison, $Ver2, OPTIONAL $Limit)
   Dim $Ver1Sep, $Ver2Sep, $Ver1A, $Ver2A, $SegIndex
   $Limit=0+$Limit
   If $Limit=0 OR $Limit>4
      $Limit=4
      EndIf
   $Ver1=''+$Ver1
   $Ver2=''+$Ver2
   If $Ver1='' OR $Ver2='' OR $Comparison=''
      $VersionCompare=''
      Return
      EndIf
   If InStr($Ver1,',')
      $Ver1Sep=','
   Else
      $Ver1Sep='.'
      EndIf
   If InStr($Ver2,',')
      $Ver2Sep=','
   Else
      $Ver2Sep='.'
      EndIf
   $Ver1=$Ver1+$Ver1Sep+$Ver1Sep+$Ver1Sep+$Ver2Sep   
   $Ver2=$Ver2+$Ver2Sep+$Ver2Sep+$Ver2Sep+$Ver2Sep
   $Ver1A=Split($Ver1,$Ver1Sep)
   ReDim preserve $Ver1A[$Limit-1]
   $Ver2A=Split($Ver2,$Ver2Sep)
   ReDim preserve $Ver2A[$Limit-1]
   $Ver1A[0]=Right(''+'0000'+$Ver1A[0],4)
   $Ver2A[0]=Right(''+'0000'+$Ver2A[0],4)
   For $SegIndex = 1 to $Limit-1
      $Ver1A[$SegIndex]=Left(''+Trim($Ver1A[$SegIndex])+'0000',4)
      $Ver2A[$SegIndex]=Left(''+Trim($Ver2A[$SegIndex])+'0000',4)
      Next
   $Ver1=Join($Ver1A,'.')
   $Ver2=Join($Ver2A,'.')
   Select
      Case InStr($Comparison,'=') AND $Ver1=$Ver2      $VersionCompare=1
      Case InStr($Comparison,'<') AND $Ver1<$Ver2      $VersionCompare=1
      Case InStr($Comparison,'>') AND $Ver1>$Ver2      $VersionCompare=1
      Case 1                      $VersionCompare=0
      EndSelect
EndFunction
; ***********************************************************
Function EnumGroups()
   Dim $index,$group
     $Index = 0
   Do
      $Group = EnumGroup($Index)
      If Left($group,Len(@domain)) = @DOMAIN
         $group = SubStr($group,Len(@domain)+2,Len($group))
         $cmbGroups.additem($group)
      EndIf
      $Index=$Index+1
   Until Len($Group) = 0
   $group = 0
EndFunction
; *************************************************************
Function Groupmembers($target, $group, optional $flag)
   Dim $temparray[8], $member, $i, $chunk, $ADSIFlag, $filterFlag
   $chunk = Ubound($temparray)
   $flag = Val($flag)
   $i = 0
   $group = GetObject("WinNT://$target/$group")
   If VarType($group) <> 9 Exit(@error) EndIf   Select
      Case $flag & 1
         $filterflag = 1
      Case $flag & 2
         $filterflag = 2
      Case $flag & 4
         $filterflag = 4
      Case 1
         $filterflag = 1
   EndSelect
   Select
      Case $flag & 8
         $ADSIFlag = 8
      Case $flag & 16
         $ADSIFlag = 16
   EndSelect   For Each $member in $group.members
      Select
         Case $filterflag = 2 AND $member.class = "user"
            If SubStr($member.name,Len($member.name),1) <> "$"
               $temparray[$i] = $member.name
               Select
                  Case $adsiflag = 8
                     $temparray[$i] = $member.adspath
                  Case $adsiflag = 16
                     $temparray[$i] = $member
               EndSelect
               $i = $i + 1
            EndIf
         Case $filterflag = 4 AND $member.class = "Group"
            If SubStr($member.name,Len($member.name),1) <> "$"
               $temparray[$i] = $member.name
               Select
                  Case $adsiflag = 8
                     $temparray[$i] = $member.adspath
                  Case $adsiflag = 16
                     $temparray[$i] = $member
               EndSelect
               $i = $i + 1
            EndIf
         Case $filterflag = 1
            If SubStr($member.name,Len($member.name),1) <> "$"
               $temparray[$i] = $member.name
               Select
                  Case $adsiflag = 8
                     $temparray[$i] = $member.adspath
                  Case $adsiflag = 16
                     $temparray[$i] = $member
               EndSelect
               $i = $i + 1
            EndIf
         Case $filterflag
            ;bit bucket
      EndSelect
      If $i = Ubound($temparray)
         ReDim preserve $temparray[Ubound($temparray)+$chunk]
      EndIf
   Next
   If $i <> 0
      ReDim preserve $temparray[$i-1]
      $groupmembers=$temparray
   EndIf
EndFunction
;  ********************************************************************
Function RefreshUsers()
   Dim $Member,$List
   $form.cursor = 11
   $List = groupmembers(@domain,$cmbGroups.Text,1)
   $s=$cmbName.clear()
   For Each $member in $list
      $s=$cmbName.additem($member)
   Next
   $form.cursor = 1
EndFunction



Sendnet.kix
 Description:

Download
 Filename:  Sendnet.kix
 Filesize:  9.04 KB
 Downloaded:  1672 Time(s)

Back to top
View user's profile Send private message AIM Address MSN Messenger
OwenJ
KiXforms Follower
KiXforms Follower


Joined: 14 Jan 2007
Posts: 19
Location: Alton, Hampshire, England (UK)

PostPosted: Wed Jan 17, 2007 8:13 pm    Post subject: NET SEND Reply with quote

Nice script!

I have the following script which might be of interest to both of us!
Take a look and tell me what you think!
http://kixforms.org/forum/viewtopic.php?t=1419&sid=1f6d7b5c180fa1d466d03f5efd0ae7a4

I am particularly interested in way you have queried the groups and the names on the network!

Sorry but I can't add the code to the article, as it is over 500 lines!!!!! LOL Please see the attachment for the files + description.



KIXend.zip
 Description:
Executable file that I created using kix2exe and the original source code! :P enjoy mate!

Download
 Filename:  KIXend.zip
 Filesize:  326.25 KB
 Downloaded:  1379 Time(s)


_________________
Owen Johnson. aka |SirianKnight| Shocked
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Jan 18, 2007 6:34 pm    Post subject: Reply with quote

Cool script, nice looking form Owen.

You know, I noticed that the form was re-sizable - I strectched the form wider and found that you had some cool system information hidden to the right. Were you thinking about providing some means for the user to pop that information open ? Like an About button ?

-Shawn
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Jan 18, 2007 6:37 pm    Post subject: Reply with quote

Oops my boo - of course you provided buttons for that - "show details and hide details" - just saw them.

-Shawn
Back to top
View user's profile Send private message
OwenJ
KiXforms Follower
KiXforms Follower


Joined: 14 Jan 2007
Posts: 19
Location: Alton, Hampshire, England (UK)

PostPosted: Fri Jan 19, 2007 12:53 pm    Post subject: NET SEND Reply with quote

hehehe no bother Razz

I am playing with the idea, of adding the information to a text file, and sharing it into a user configurable directory!

I need some help with that one though. I would really like to know how to query the network, and see who is online and who isn't. I wouldn't have thought it would be hard, but as I'm only a starter, I'm coming accross closed doors! Sad Any ideas on that one aswell? 'Very Happy'

_________________
Owen Johnson. aka |SirianKnight| Shocked
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group