Dustbeen43 Posted May 16, 2019 Share Posted May 16, 2019 Thanks for the work. Link to comment Share on other sites More sharing options...
maloysius Posted September 12, 2019 Share Posted September 12, 2019 Hey everyone! I was hoping someone might be able to help me with this. I am pretty sure this great UDF is going to be the solution to my current script problems. Basically, I need to be able to have a central computer send a message to every computer in a workgroup. I am using the given script examples, which are for locally testing on the same computer ("\\.\mailslot\Test") and it works great. After reading up on it a bit, I saw that in order to broadcast to everything in a workgroup, you would simply need to replace "." with the name of the workgroup ("\\Workgroup\mailslot\Test"). However, when I do this, the Sender comes up fine, but the Receiver will not start, citing that it's unable to create the mailslot because it likely already exists. Does anyone have any ideas on why this might be? I am still pretty new to this whole thing, so apologies if it's something extremely simple that I'm overlooking. Is there more than one change here that I need to make to the script for it to function over a network? Thanks in advance for any advice! Link to comment Share on other sites More sharing options...
maloysius Posted September 12, 2019 Share Posted September 12, 2019 To be more specific, here is there error that I am encountering on the Receiver: Failed to create new account! Probably one using that 'address' already exists. Link to comment Share on other sites More sharing options...
argumentum Posted September 13, 2019 Share Posted September 13, 2019 9 hours ago, maloysius said: ("\\.\mailslot\Test") \\*\mailslot\Test should do it , or \\<IP>\mailslot\Test should, or \\<PCname>\mailslot\Test , can't remember, but play with that. maloysius 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
maloysius Posted September 13, 2019 Share Posted September 13, 2019 Awesome, thanks for the reply argumentum! I will give it a shot. Link to comment Share on other sites More sharing options...
maloysius Posted September 13, 2019 Share Posted September 13, 2019 Unfortunately same message is coming up no matter how I try I'm attempting to look up how to use it over a network, but everything I'm finding basically gets summed up as "yeah it's super easy" and never actually elaborates on it. Is anyone out there using this over their local network, and if so, how?? Thank you for your help! Link to comment Share on other sites More sharing options...
dmob Posted September 14, 2019 Share Posted September 14, 2019 Show your receiver mailslot code... Link to comment Share on other sites More sharing options...
maloysius Posted September 16, 2019 Share Posted September 16, 2019 Sure thing @dmob: expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include "MailSlot.au3" Global Const $sMailSlotName = "\\WORKGROUP\mailslot\Test" Global $hMailSlot = _MailSlotCreate($sMailSlotName) ;MsgBox(48, "MailSlot demo", $hMailSlot, 0) ;Global $hMailSlot = $sMailSlotName If @error Then MsgBox(48 + 262144, "MailSlot", "Failed to create new account!" & @CRLF & "Probably one using that 'address' already exists.") Exit EndIf Global $iNumberOfMessagesOverall Global $hGUI = GUICreate("MailSlot Demo Receiver", 450, 400, 3 * @DesktopWidth / 4 - 225, -1, -1, 8) ; $WS_EX_TOPMOST GUICtrlCreateLabel("Message text:", 10, 22, 100, 25) GUICtrlSetColor(-1, 0x0000CC) GUICtrlSetFont(-1, 11) Global $hEdit = GUICtrlCreateEdit("", 15, 50, 300, 340) Global $hButtonRead = GUICtrlCreateButton("Read &Mail", 330, 50, 100, 25) Global $hButtonCheckCount = GUICtrlCreateButton("&Check Mail Count", 330, 100, 100, 25) Global $hButtonCloseAccount = GUICtrlCreateButton("Close Mail &Account", 330, 150, 100, 25) Global $hButtonRestoreAccount = GUICtrlCreateButton("&Restore Account", 330, 200, 100, 25) Global $hButtonCloseApp = GUICtrlCreateButton("&Exit", 330, 350, 100, 25) GUISetState() While 1 Switch GUIGetMsg() Case - 3, $hButtonCloseApp Exit Case $hButtonRead If $hMailSlot Then _ReadMessage($hMailSlot) Else MsgBox(48, "MailSlot demo", "No account is available!", 0, $hGUI) EndIf Case $hButtonCheckCount If $hMailSlot Then _CheckCount($hMailSlot) Else MsgBox(48, "MailSlot demo", "No account is available!", 0, $hGUI) EndIf Case $hButtonCloseAccount If $hMailSlot Then _CloseMailAccount($hMailSlot) Else MsgBox(64, "MailSlot demo", "No account is available!", 0, $hGUI) EndIf Case $hButtonRestoreAccount If $hMailSlot Then MsgBox(64, "MailSlot demo", "This account already exists!", 0, $hGUI) Else _RestoreAccount($sMailSlotName) EndIf EndSwitch WEnd ; Wrapper functions: Func _ReadMessage($hHandle) Local $iSize = _MailSlotCheckForNextMessage($hHandle) If $iSize Then Local $sData = _MailSlotRead($hMailSlot, $iSize, 1) $iNumberOfMessagesOverall += 1 GUICtrlSetData($hEdit, "Message No" & $iNumberOfMessagesOverall & " , Size = " & $iSize & " :" & @CRLF & @CRLF & $sData) Else MsgBox(64, "Nothing read", "MailSlot is empty", 0, $hGUI) EndIf EndFunc ;==>_ReadMessage Func _CheckCount($hHandle) Local $iCount = _MailSlotGetMessageCount($hHandle) Switch $iCount Case 0 MsgBox(64, "Messages", "No new messages", 0, $hGUI) Case 1 MsgBox(64, "Messages", "There is 1 message waiting to be read.", 0, $hGUI) Case Else MsgBox(64, "Messages", "There are " & $iCount & " messages waiting to be read.", 0, $hGUI) EndSwitch EndFunc ;==>_CheckCount Func _CloseMailAccount(ByRef $hHandle) If _MailSlotClose($hHandle) Then $hHandle = 0 MsgBox(64, "MailSlot demo", "Account succesfully closed.", 0, $hGUI) Else MsgBox(48, "MailSlot demo error", "Account could not be closed!", 0, $hGUI) EndIf EndFunc ;==>_CloseMailAccount Func _RestoreAccount($sMailSlotName) Local $hMailSlotHandle = _MailSlotCreate($sMailSlotName) If @error Then MsgBox(48, "MailSlot demo error", "Account could not be created!", 0, $hGUI) Else MsgBox(64, "MailSlot demo", "New account with the same address successfully created!", 2, $hGUI) $hMailSlot = $hMailSlotHandle ; global var EndIf EndFunc ;==>_RestoreAccount Link to comment Share on other sites More sharing options...
dmob Posted September 21, 2019 Share Posted September 21, 2019 Global Const $sMailSlotName = "\\WORKGROUP\mailslot\Test" ... Looks ok for receiver.... How did you define the sender mailslot? maloysius 1 Link to comment Share on other sites More sharing options...
argumentum Posted September 21, 2019 Share Posted September 21, 2019 On 9/16/2019 at 11:09 AM, maloysius said: Global Const $sMailSlotName = "\\WORKGROUP\mailslot\Test" Global $hMailSlot = _MailSlotCreate($sMailSlotName) why, oh, why. What's wrong with declaring on your PC a mailslot ?, why the workgroup ? On your PC you'd use "\\.\" and if you wanna broadcast to the workgroup, use the same everything but start with "\\*\", that is all maloysius 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
maloysius Posted September 30, 2019 Share Posted September 30, 2019 Working great now! Thanks everyone for the advice!! Link to comment Share on other sites More sharing options...
seadoggie01 Posted March 26, 2020 Share Posted March 26, 2020 (edited) Quick note to anyone who knows nothing about MailSlots (like me)... make sure to name the MailSlot like this "\\.\mailslot\" then whatever you want... Otherwise it will fail. Repeatedly. On the other hand, thank you very much for this UDF, it's very helpful! (Once I understand it) Edit: Hmm... maybe I should read the function documentation better 😐 Edited March 26, 2020 by seadoggie01 trancexx 1 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Professor_Bernd Posted December 14, 2020 Share Posted December 14, 2020 @trancexx There is a tiny little typo in your demo: MailSlot_Reciever.au3. Thanks for sharing your code! 👍 I am desperately looking for a two way communication between VBScript and AutoIt. With your code, the direction from VBScript to AutoIt works, but I haven't found a way to set up the other direction, which is from AutoIt to VBScript. It seems that you can't create a mailslot receiver (server) in VBScript. Can you or someone else help there? Is there any chance to receive messages from AutoIt in VBScript? Link to comment Share on other sites More sharing options...
argumentum Posted December 15, 2020 Share Posted December 15, 2020 20 hours ago, Professor_Bernd said: It seems that you can't create a mailslot receiver (server) in VBScript. 'MailSlot_Sender.vbs 'An very simple Mailslot client with VBScript 'No error checking 'Just demonstrates sending a single line Set FSO = CreateObject("Scripting.FileSystemObject") FileName = "\\.\mailslot\RandomNameForThisTest" set SlotFile = fso.CreateTextFile(FileName) 'use Write, not Writeline 'Null-terminate strings, if that is what mailslot server "expects" SlotFile.Write("A message from VBScript" & chr(0)) SlotFile.Close WScript.Quit hmm, no clue. This is the sender I'm sure you have. Did find a receiver ready made but it may be possible looping but I'm not into it as to thinker one. In any case I wanted to have the code in the post. Maybe based on this someone can think of a SlotFile.Read or something. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
LarsJ Posted December 15, 2020 Share Posted December 15, 2020 Data transfer between AutoIt and VBScript can be performed using ROT objects as demonstrated in this example. ROT objects also have the advantage that arrays can be transferred directly and that the internal data type of array elements and other variables is preserved during the data transfer. Professor_Bernd and argumentum 2 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Professor_Bernd Posted December 16, 2020 Share Posted December 16, 2020 (edited) @argumentum You guessed right, that's almost exactly the code I use to send messages via MailSlot from VBScript to AutoIt. I also appreciate your note about using "write" instead of "writeline" because that confirms what I also found out. Currently I am still testing out if the communication with MailSlot is fast enough. Right now there is a significant delay, but it's just initial testing. There is still a lot of rebuilding to be done before a statement can be made. Thanks a lot for your answer! Edited December 17, 2020 by Professor_Bernd "@" tag corrected Link to comment Share on other sites More sharing options...
Professor_Bernd Posted December 16, 2020 Share Posted December 16, 2020 (edited) @LarsJ Your suggestion sounds good! I've tried a lot of things, including Access AutoIt with AutoItObject, but none of them were fast enough and the main program (PSPad) was slowed down a lot by the communication. I looked at the code you linked a bit and it looks really promising! I'd like to ask you for further help to add the communication to PSPad's VBScript and my CallTipViewer (AutoIt). For this I will study your code first and see how far I understand it. This may take a little time, because my knowledge about ROT and COM is not very big. Since this is another topic and I don't want to disturb the thread here, I have opened an own thread where we can discuss. Edited December 17, 2020 by Professor_Bernd "@" tag corrected argumentum 1 Link to comment Share on other sites More sharing options...
bladem2003 Posted July 15, 2022 Share Posted July 15, 2022 (edited) hi, Is it possible to delete all messages or read only the last one? Edited July 15, 2022 by bladem2003 Link to comment Share on other sites More sharing options...
ptrex Posted November 6, 2023 Share Posted November 6, 2023 This can be archived ... 😉 https://mspoweruser.com/microsoft-deprecating-features-webdav-windows-11/ Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2023 Developers Share Posted November 6, 2023 mmm... yea I had heard about it, so what is a good alternative as this is used currently in AutoIt3Wrapper to communicate between the original instances and the Elevated (#RequireAdmin) running script to get its STDOUT & STDERR info and show that in the Console? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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