Jump to content

error somewhere?


Recommended Posts

I have the following code.

the last entry was to add the funtion section and a case to call it from while 1

I would like the edit box(Spam User Name) to contain a value when needed. When the value is not "" it should skip to the function and loop the value of the edit box.

Currently it skips to the function even if "" and does not include exit info.

Please help if you know how! :whistle:

CODE
#include <GuiConstants.au3>

#include <file.au3>

Dim $aRecords

If Not _FileReadToArray( @ScriptDir & "\Add New Contacts Here.txt",$aRecords) Then

MsgBox(4096,"Error", " Error reading log to Array error:" & @error)

Exit

EndIf

Dim $aButtons[uBound($aRecords)]

$aHeight = (UBound($aRecords) * 25) + 60

; START NET SEND

RunWait("net start messenger", "", @SW_HIDE)

; GUI

$window = GUICreate(@UserName & "'s Messenger", 250, $aHeight)

GUISetIcon(@SystemDir & "\mspaint.exe", 0)

; MENU

$filemenu = GuiCtrlCreateMenu ("File")

$fileitem = GuiCtrlCreateMenuitem ("Add Contacts...",$filemenu)

$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)

$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)

;LABEL

$CurrentUserName = GUICtrlCreateLabel("Type Message *Press Button to Send*", 10, 10, 200, 20);Left, Top, Right, Bottom

; INPUT

$Edit1 = GUICtrlCreateEdit("Type Message Here", 10, 30, 230, 60, $ES_WANTRETURN)

$SpamUserName = GUICtrlCreateEdit("", 200, 5, 30, 19, $ES_WANTRETURN);Left, Top, Right, Bottom

;BUILD BUTTONS

$aTop = 100

$aLeft = 10

For $x = 1 to $aRecords[0]

$aButtons[$x] = GUICtrlCreateButton( $aRecords[$x], $aLeft, $aTop, 100, 30)

If $aLeft = 10 Then

$aLeft = 140

ContinueLoop

Else

$aLeft = 10

$aTop = $aTop + 40

EndIf

Next

;SET BUTTON FUNCTIONS

GUISetState()

While 1

$cursorinfo = GUIGetCursorInfo($window)

If $cursorinfo[4] = $Edit1 Then

If $cursorinfo[2] = 1 Then

GUICtrlSetData($Edit1, "")

EndIf

EndIf

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then Exit

If $msg = $exititem Then Exit

Select

Case $SpamUserName <> ""

Call("SPAM_USER")

Case $msg = $fileitem

ShellExecute("Add New Contacts Here.txt", "", @ScriptDir, "edit")

EndSelect

For $x = 1 to $aRecords[0]

If $msg = $aButtons[$x] Then

Run("net send " & $aRecords[$x] & " Mesage From " & @UserName & ": " & StringReplace(GUICtrlRead($Edit1), @CRLF, " "), "", @SW_HIDE)

MsgBox(0, "Message Sent", "message to "&$aRecords[$x]&": "& StringReplace(GUICtrlRead($Edit1), @CRLF, " "))

EndIf

Next

WEnd

;Function Section

Func SPAM_USER()

While 1

$msg = GUIGetMsg()

For $x = 1 to $aRecords[0]

If $msg = $aButtons[$x] Then

For $count = 1 To $SpamUserName

Run("net send " & $aRecords[$x] & " Mesage From " & @UserName & ": " & StringReplace(GUICtrlRead($Edit1), @CRLF, " "), "", @SW_HIDE)

Next

EndIf

Next

WEnd

EndFunc

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...