Jump to content

Slugsend


evod510
 Share

Recommended Posts

Greetings,

I've been using this script for almost a year and basically all my network users are using it.

I would to thank Cyberslug, he was the author of slugsend.

For those who which to use it, change the "CHECHBOX USERLIST NAME " with your own userlist

then change also the "CHECHBOX USERLIST NAME 2" with the actual name of your user pc.

Not much problem with this script, the only problem is, I dont know how to auto scroll any new message.

Again, I would like to say thanks to Cyberslug. Now my user dont need to use YM anymore.

Please feel free to comment

cheers

evod

ps- find the script attached below

slugsend.au3

Edited by evod510
Link to comment
Share on other sites

there is just 1 problem in the script

its using "net send" and you can't use it anymore if it's disabled

i did something like this using 1 or a couple of ini-files on a server, so the messages keep alive even if the pc is switched off. you can delete the ini-file if you want after the user gets his message

you can autoscroll you the output by replacing this line:

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, 0x50231904, 0x00000200)

with this one:

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, 0x50231904, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN)

ok its long but i don't want to look at the numbers

hope i could help you with that

Link to comment
Share on other sites

there is just 1 problem in the script

its using "net send" and you can't use it anymore if it's disabled

i did something like this using 1 or a couple of ini-files on a server, so the messages keep alive even if the pc is switched off. you can delete the ini-file if you want after the user gets his message

you can autoscroll you the output by replacing this line:

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, 0x50231904, 0x00000200)

with this one:

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, 0x50231904, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN)

ok its long but i don't want to look at the numbers

hope i could help you with that

somehow the code does not work, actually i cant read the message at all...... thanks anyway ;)
Link to comment
Share on other sites

ooops seen my mistake

replaced the wrong thing

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, 0x50231904, 0x00000200)

with this one:

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN)

sry just wrote a bit fast and didn't check

this should work

hope so ;)

Link to comment
Share on other sites

ooops seen my mistake

replaced the wrong thing

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, 0x50231904, 0x00000200)

with this one:

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN)

sry just wrote a bit fast and didn't check

this should work

hope so ;)

i tried it, still does not work.... maybe need to look at the actual script which write the message to the text

box......

Link to comment
Share on other sites

0) You should really upgrade to some of Larry's TCP/IP messanging....

1) I added the line ControlSend($MyGui,"",$txt_output,"^{End}") at two places.

2) You might want to look at arrays. My array modifications are not tested... It's now really easy to add a new button that can check or uncheck all of the checkboxes...

; Proof-of-Concept for a net-send-based messenger program
; CyberSlug:  Original code 3 July 2004
; Revised for new GUI syntax 10 December 2004
; Gui Recode to 3.1.1 15 August 2005
; Update with own code by evod510 2005
; Update by CyberSlug 12 Oct 2005:  autoscroll via ^{End} and using arrays....

#include <GuiConstants.au3>

RunWait("net start messenger","",@SW_HIDE);Make sure messenger service is running

Opt("WinWaitDelay", 10) ;speeds things up a little
$MyGui = GuiCreate("NetSend", 450,359,(@DesktopHeight-392)/2, (@DesktopHeight-359)/2 , 0x04CF0000)
;Controls might have word-wrap and/or read-only styles... maybe also styles to always show scroll bar...

$txt_output = GuiCtrlCreateEdit("", 10, 10, 433, 170, 0x50231904, 0x00000200)
;$txt_input = GuiCtrlCreateEdit("Message goes here.", 10, 230, 370, 70, 0x50231104)

$txt_input = GuiCtrlCreateEdit("Message goes here.", 10, 230, 370, 40, 0x50231104)

GuiCtrlSetState($txt_input, $GUI_FOCUS);default control with focus

$button_send = GUICtrlCreateButton("{Enter} == Send", 20, 300, 150, 30)

$checkbox_topmost = GuiCtrlCreateCheckbox("Always On Top", 210, 190, 150, 30, $BS_PUSHLIKE);looks like button....
GuiCtrlSetState($checkbox_topmost, $GUI_CHECKED);checkbox will be pushed in by default

$button_sendclear = GUICtrlCreateButton("Clear", 10, 190, 100, 30)

;;;;;;;;;;;;;;;;;;;;;;CHECHBOX USERLIST NAME START;;;;;;;;;;;;;;;;;;;;
Dim Const $NUM_PEOPLE = 10 ;define this constant so we can use it elsewhere in program
Dim $checkCN[$NUM_PEOPLE]
; Note that the array elements are indexed from 0 to $NUMPEOPLE-1
; If all the checkboxes were in a single column, we could initialize all these with a for loop....
; (assuming the names were stored in a separate array or something)
$checkCN[0] = GUICtrlCreateCheckbox ("jack", 280, 280, 100, 20)
$checkCN[1] = GUICtrlCreateCheckbox ("jerry", 385, 320, 100, 20)
$checkCN[2] = GUICtrlCreateCheckbox ("shelly", 385, 300, 100, 20)
$checkCN[3] = GUICtrlCreateCheckbox ("jones", 280, 300, 100, 20)
$checkCN[4] = GUICtrlCreateCheckbox ("noel", 385, 280, 100, 20)
$checkCN[5] = GUICtrlCreateCheckbox ("nick", 385, 240, 100, 20)
$checkCN[6] = GUICtrlCreateCheckbox ("lyan", 385, 340, 100, 20)
$checkCN[7] = GUICtrlCreateCheckbox ("betty", 280, 320, 100, 20)
$checkCN[8] = GUICtrlCreateCheckbox ("david", 280, 340, 100, 20)
$checkCN[9] = GUICtrlCreateCheckbox ("fisher", 385, 260, 100, 20)
;$MainCheck = GUICtrlCreateCheckbox("Select/Unselect", 390, 130, 120, 20)
;;;;;;;;;;;;;;;;;;;;;;CHECHBOX USERLIST NAME END;;;;;;;;;;;;;;;;;;;;;

GuiSetState(@SW_SHOW)

GUICtrlSendMsg($txt_input, 0xB1, 0, 99999);I want the sample text message to be highlighted upon start

WinSetOnTop($MyGui, "", 1);always on top by default...

;MAIN MESSAGE LOOP
While 1
   sleep(5);sleep to prevent maxing out the CPU
  ; I want to trap the Enter key (but only when this GUI is active) so that it causes
  ;   the message in the textbox to be send
   If WinActive($MyGui) Then
      HotKeySet("{Enter}", "EnterSends");register hotkey when our GUI messenger window is active
   Else
      HotKeySet("{Enter}");un-register hotkey otherwise
   EndIf
   
   
  ; Constantly poll to see if a Net Send Popup has appeared.  If so, grab its contents and close it.
   If WinExists("Messenger Service", "Message from") Then
      Local $i, $t = ""
      $text = StringSplit( StringReplace(WinGetText("Messenger Service","Message from"),@CRLF,@LF) , @LF)
      WinClose("Messenger Service", "Message from")
      
      $sender = StringMid($text[2], 14, StringInStr($text[2]," to ")-14 )
      $t = ""
      For $i = 4 to $text[0]
         $t = $t & $text[$i] & @CRLF
      Next
      $t = StringStripWS($t, 2);strip trailing whitespace
      
     ; Display contents from the Popup in the form '<TIME> SENDER: Message'
      
      GUICtrlSetData($txt_output, GUICtrlRead($txt_output) & "<" & @Hour & ":" & @Min & ":" & @Sec & "> " & $sender & ":  " & $t & @CRLF)
      
      ControlSend($MyGui,"",$txt_output,"^{End}")
      
     ;ControlFocus($MyGui, "", $txt_input);return focus back to the input field
      ControlFocus($MyGui, "", $txt_input)
      
      
      If WinActive ( "NetSend") Then
         TrayTip("clears any tray tip","",0)
      Else
         TrayTip("", "NetSend", 5)
         Sleep(1)
      EndIf
      
      
   EndIf
   
   $msg = GuiGetMsg() ; Get any GUI messag events
   
   Select
      Case $msg = $GUI_EVENT_CLOSE
         Exit
      Case $msg = $button_send
         EnterSends()
      Case $msg = $button_sendclear
         Enterclear()
      Case $msg = $checkbox_topmost
         If GUICtrlRead($checkbox_topmost) = 1 Then
            WinSetOnTop($MyGui, "", 1);checked for 'always on-top' window
         Else
            WinSetOnTop($MyGui, "", 0);unchecked for normal window
         EndIf
   EndSelect
WEnd
Exit

Func EnterSends()
   
   ControlFocus($MyGui, "", "Edit2")
   If StringStripWS(GUICtrlRead($txt_input), 3) = "" Then Return
   Local $message = """" & GUICtrlRead($txt_input) & """" ;wrap message in quotes
   Local $message2 = @ComputerName & " : " & GUICtrlRead($txt_input) ;wrap message in quotes
   
  ;;;;;;;;;;;;;;;;;;;;;;CHECHBOX USERLIST NAME 2 START;;;;;;;;
   
   For $index = 0 to $NUM_PEOPLE-1
      If GUICtrlRead($checkCN[$index]) = 1 Then ;check the checked state of each box
         $recipient = ControlGetText($MyGui,"",$checkCN[$index]);conveniently, the text of the checkbox is the recipient...
         Run('net send ' & $recipient & ' "' & $message & '"', '', @SW_HIDE)
      EndIf
   Next
   
  ;;;;;;;;;;;;;;;;;;;;;;CHECHBOX USERLIST NAME 2 END;;;;;;;;;
   
   GuiCtrlSetData($txt_output, GUICtrlRead($txt_output) & "<" & @Hour & ":" & @Min & ":" & @Sec & "> " & $message2 & @CRLF)
   GuiCtrlSetData($txt_input, '') ;clear contents of textbox
   ControlSend($MyGui,"",$txt_output,"^{End}")
EndFunc  ;==>EnterSends

Func Enterclear()
   GuiCtrlSetData($txt_output, '') ;clear contents of textbox Message Typed and Received, you dont anybody else to read your message!!
EndFunc  ;==>Enterclear

Something else that might have worked is dim const $EM_SCROLL = 0xB5;

GUICtrlSendMsg ( $txt_output, $EM_SCROLL, 3, 0)

FYI, the GuiCtrlSetData causes the edit box to scroll back to the top so just changing the STYLE of the edit control probably won't work. By the way, styles should be BitOR'ed toether instead of addded.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

@CyberSlug

this line doesn't work on my Win Xp

RunWait("net start messenger","",@SW_HIDE);Make sure messenger service is running

any suggestions?

I have to run Services then chose messenger then turn it on

of course it is done in programing... but not hidden

thx

8)

if you are running xp with sp2, you need te enable the messenger service and all dde services,

(winxp sp2 disable it)

hope that help

Link to comment
Share on other sites

I tried your posted script and then i ran mine

the reason i know yours did not work was because mine has this error checking... remember i am a hobbyist so... i get there in a round-about-way

$runvar =RunWait(@comspec & " /c net send " & $CPUID & $un & " says:   " & $msg1,"",@sw_hide)
;MsgBox(0,"",$runvar)
    If $runvar > 0 Then
        MsgBox(64,"Send Error 3"," Your Message   *Could Not Be Sent*       " & @CRLF & @CRLF & " Please press the  *Set-Up*  Button    "  & @CRLF & @CRLF & "and press  *Set-Up*  on " & $CPUID & "  " )
        ContinueLoop
    EndIf

i also have to check both computers because the error does not tell me which computer messenger service is not on

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

I tried your posted script and then i ran mine

the reason i know yours did not work was because mine has this error checking... remember i am a hobbyist so... i get there in a round-about-way

$runvar =RunWait(@comspec & " /c net send " & $CPUID & $un & " says:   " & $msg1,"",@sw_hide)
;MsgBox(0,"",$runvar)
    If $runvar > 0 Then
        MsgBox(64,"Send Error 3"," Your Message   *Could Not Be Sent*      " & @CRLF & @CRLF & " Please press the  *Set-Up*  Button "  & @CRLF & @CRLF & "and press  *Set-Up*  on " & $CPUID & "  " )
        ContinueLoop
    EndIf

i also have to check both computers because the error does not tell me which computer messenger service is not on

8)

maybe you can add your code to the script......
Link to comment
Share on other sites

  • 5 months later...

Greetings,

Just wanna add someother features in the slugsend

i am trying to add smilies, unfortunately when i changed it it will overlap with the previous smiley...

here is some of the scripts i added....

if $t = "Happy" Then

GuiCtrlCreatePic("C:\Documents and Settings\user\My Documents\gif\1.gif",260, 280, 18, 17)

EndIf

if $t = "Mad" Then

GuiCtrlCreatePic("C:\Documents and Settings\user\My Documents\gif\2.gif",255, 280, 15, 15)

EndIf

Any idea?

I'm planning to put the smilies next to the user name. So lets say for example Jim send "Happy"

smiliey to Jack, Jack Slugsend should change Jim smiliey to "Happy". Any idea on how to do this.....

Thats all, Thanks in advance.

Link to comment
Share on other sites

Found it......

It goes something like this

$1 = GuiCtrlCreatePic("C:\Documents and Settings\user\My Documents\gif\blank.gif",260, 280, 1, 1)

if $t = "Happy" Then

GUICtrlDelete($1)

$1 = GuiCtrlCreatePic("C:\Documents and Settings\user\My Documents\gif\1.gif",260, 280, 18, 17)

EndIf

if $t = "Mad" Then

GUICtrlDelete($1)

$1 = GuiCtrlCreatePic("C:\Documents and Settings\user\My Documents\gif\2.gif",255, 280, 15, 15)

EndIf

next step how to assign smily to users....... :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...