MiraNoir Posted April 8, 2014 Share Posted April 8, 2014 I`m quite new to AutoIt, but from what I can tell, this should work, i`ve reworked something that was posted in these forums. $User = InputBox("Messenger", "Enter the name of the Computer to Send a message to.") If Not @error And $Computer Then ; Not error and $Computer nneds to be something to be valid $Time = InputBox("Messenger", "Enter the number of seconds you wish the message to display.") If Not @error And $Time Then ; Not error and $Time needs to be something to be valid $Message = InputBox("Messenger", "Please type your message now.") If Not @error Then ; Not error and no message can be valid? ;$msg = "C:\Windows\System32\msg.exe" RunWait('"' & @ComSpec & '" /c msg $User "/server:' & '" "/Time:' & $Time & '" "' & $Message & '"') EndIf EndIf EndIf This was the solution to the problem, except that i wanted to send to Users instead of computers, so I used $User and put it instead of the * for every user. For whatever reason its still not working. This was the original script posted which didn`t work either once I changed for $User expandcollapse popup;Changes to this part do the following: InputBoxes will time out after 2 minutes. If you press 'Cancel' or don't include a value then the message will ;not send. 30 is set as the default message duration Local $Computer = InputBox("Messenger", "Enter the name of the Computer to Send a message to.", "", Default, Default, Default, Default, Default, 120) If @error Or Not $Computer Then Exit Local $Time = InputBox("Messenger", "Enter the number of seconds you wish the message to display.", "30", Default, Default, Default, Default, Default, 120) If @error Or Not $Time Then Exit Local $Message = InputBox("Messenger", "Please type your message now.", "", Default, Default, Default, Default, Default, 120)) If @error Or Not $Message Then Exit ;Run the command, capturing any output from the program Local $msg_exe = "C:\Windows\System32\msg.exe" Local $Debug = RunGetText( @comspec & " /c " & $msg_exe & " * /server:" & $Computer & " /Time:" & $Time & " " & $Message, Default, @SW_HIDE, 60*3) ;Write any output to the console for debugging ConsoleWrite ($Debug) ;$command = full path to the exe ;$workingDir = full path of working directory ;$showFlag = passes value directly to Run() command, see Run() documentation ;$timeOut = time before expiring in seconds Func RunGetText ($command, $workingDir, $showFlag, $timeOut) $timeOut *= 1000 Local $pid = Run ($command, $workingDir, $showFlag, 0x8) Local $returnText For $i = 0 to 5 Local $startTime = TimerInit () While 1 Local $temp = StdoutRead ($pid) If @error Then ExitLoop $returnText &= $temp If TimerDiff ($startTime) > $timeOut Then StdioClose ($pid) $returnText = "" ExitLoop EndIf WEnd If $returnText Then ExitLoop Next Return $returnText EndFunc If someone could point out what i`m doing wrong, i`d be delighted. Have a nice day Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 8, 2014 Moderators Share Posted April 8, 2014 Instead of this: RunWait('"' & @ComSpec & '" /c msg $User "/server:' & '" "/Time:' & $Time & '" "' & $Message & '"') Try this: RunWait('"' & @ComSpec & '" /c msg ' & $User & '"/server:' & '" "/Time:' & $Time & '" "' & $Message & '"') "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MiraNoir Posted April 8, 2014 Author Share Posted April 8, 2014 $User = InputBox("Messenger", "Enter the name of the User to Send a message to.") If Not @error And $User Then ; Not error and $User needs to be something to be valid $Time = InputBox("Messenger", "Enter the number of seconds you wish the message to display.") If Not @error And $Time Then ; Not error and $Time needs to be something to be valid $Message = InputBox("Messenger", "Please type your message now.") If Not @error Then ; Not error and no message can be valid? ;$msg = "C:\Windows\System32\msg.exe" RunWait( @ComSpec & " /c " & " msg " & $User & $Message ) EndIf EndIf EndIf This is my latest try, it now pop up a command prompt and says Enter message to send; end message by pressing CTRL-Z on a new line, then ENTER Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 8, 2014 Moderators Share Posted April 8, 2014 Try changing the /c in your RunWait line to /k, so you can see what is being typed out. It sounds like you're missing a space between the $User and $Message. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MiraNoir Posted April 8, 2014 Author Share Posted April 8, 2014 Still says exactly the same thing, even with /k Trying bunch of stuff to no avail >.< Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 8, 2014 Moderators Share Posted April 8, 2014 Since you have to have Message special access permission, have you confirmed this works for you when you do it manually? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MiraNoir Posted April 8, 2014 Author Share Posted April 8, 2014 (edited) Yes im on Server 2008, it works perfectly (The Syntax does and rights not the script itself) syntax is usually ( msg administrator test ) This will popup the test msg for that account it also works straight from the RUN command in windows with the exact same syntax as above. Thanks a lot for all the help btw Edit: What I mean is that it doesn't work still, same issue as before Edited April 8, 2014 by MiraNoir Link to comment Share on other sites More sharing options...
Solution MiraNoir Posted April 8, 2014 Author Solution Share Posted April 8, 2014 $User = InputBox("Messenger", "Utilisateur: (Prenom.Nom) Domaine: (*)") If Not @error And $User Then ; Not error and $User needs to be something to be valid $Message = InputBox("Messenger", "Entrer Votre Message:") If Not @error Then ; Not error and no message can be valid? ;$msg = "C:\Windows\System32\msg.exe" RunWait( @ComSpec & " /c msg " & $User & " " & $Message ) EndIf EndIf This Fixed it, it was indeed a space needed, thus why it prompted that way. Thanks a lot for the help. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now