ale1981 Posted April 2, 2008 Posted April 2, 2008 I need to create an application that deals with the Windows Private Message Queues and XMLs. We use a program which creates XML files and places them into queues in windows. I will need to access the queues and work with the messages? Any kind of help will be appreciated.
PsaltyDS Posted April 2, 2008 Posted April 2, 2008 I need to create an application that deals with the Windows Private Message Queues and XMLs. We use a program which creates XML files and places them into queues in windows. I will need to access the queues and work with the messages? Any kind of help will be appreciated. There is a scripting object available if MSMQ is installed (Control Panel/Windows Components/Message Queuing), though I have no experience with it. I would love to see one of the smart people post a simple demo that opened a local (private) destination queue, then opened an output queue to it and transferred a simple piece of data. Translated from a VBS fragment found on the web: Global $sMsmqQue = "MyQueueName" Global $oMSMQ = ObjCreate("MSMQ.MSMQManagement") $oMSMQ.Init(@ComputerName, "", "DIRECT=OS:" & @ComputerName & "\private$\" & $sMsmqQue) $iMsmqCnt = $oMSMQ.MessageCount MsgBox(64, "Count", "Current message count is: " & $iMsmqCnt) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ale1981 Posted April 2, 2008 Author Posted April 2, 2008 Thanks. Yes I have Message Queuing installed. I have found the .NET code that connects / reads / writes to a que; WRITE System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(".\\Private$\\MyPrivateQueue"); queue.Send("Hello world"); READ System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(".\\Private$\\MyPrivateQueue"); queue.Send("Hello world"); System.Messaging.Message msg = queue.Receive(); msg.Formatter = new System.Messaging.XmlMessageFormatter( new string[] {"System.String"}); Console.WriteLine(msg.Body);
PsaltyDS Posted April 2, 2008 Posted April 2, 2008 Thanks. Yes I have Message Queuing installed. I have found the .NET code that connects / reads / writes to a que; WRITE System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(".\\Private$\\MyPrivateQueue"); queue.Send("Hello world"); READ System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(".\\Private$\\MyPrivateQueue"); queue.Send("Hello world"); System.Messaging.Message msg = queue.Receive(); msg.Formatter = new System.Messaging.XmlMessageFormatter( new string[] {"System.String"}); Console.WriteLine(msg.Body); I doesn't help me to see .NET code (smarter people my be able to use it), because that would use libraries loaded into that compiler and not available to AutoIt. Do you have such an example in a scripting language like VBS? This succeeds in creating the initial MSMQ object, but the .init fails:Global $sMsmqQue = "Private$\MyPrivateQueue", $sXmt = "Hello, world!", $sRcv Global $oMSMQ = ObjCreate("MSMQ.MSMQManagement") $oMSMQ.Init(@ComputerName, "", "DIRECT=OS:" & @ComputerName & "\" & $sMsmqQue) $oMSMQ.Send($sXmt) $sRcv = $oMSMQ.Receive MsgBox(64, "Results", "Message is: " & $sRcv) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ale1981 Posted April 2, 2008 Author Posted April 2, 2008 I cant seem to find any VBS anywhere! I managed to get your original script; Global $sMsmqQue = "MyQueueName" Global $oMSMQ = ObjCreate("MSMQ.MSMQManagement") $oMSMQ.Init(@ComputerName, "", "DIRECT=OS:" & @ComputerName & "\private$\" & $sMsmqQue) $iMsmqCnt = $oMSMQ.MessageCount MsgBox(64, "Count", "Current message count is: " & $iMsmqCnt) .. working once, but now the .init fails also.
ale1981 Posted April 2, 2008 Author Posted April 2, 2008 Not sure if this will be helpful??http://www.topxml.com/conference/wrox/1999...t/brianmsmq.asp
PsaltyDS Posted April 2, 2008 Posted April 2, 2008 (edited) Not sure if this will be helpful?? http://www.topxml.com/conference/wrox/1999...t/brianmsmq.asp That looks like it should be very helpful, but I'm not making it work in AutoIt. This fails:Global $sMsmqQue = "Private$\MyPrivateQueue", $sXmt = "Hello, world!", $sRcv Global $oMSMQ = ObjCreate("MSMQ.MSMQQueueInfo") $oMSMQ.PathName = $sMsmqQue $oMSMQ.Create $oMSMQ.Send($sXmt) Interestingly, it doesn't fail until the .Create method. I think the problem is that page references Visual Basic (vice VB Script), and assumes some libraries available to the compiler that include syntax/objects/methods/properties that we can't get to in AutoIt using the scripting object. Still looking for smart people to interpret... Edit: Typo Edited April 2, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ResNullius Posted April 3, 2008 Posted April 3, 2008 More good info here, in VBS format: http://msmq.spaces.live.com/default.aspxHaven't had a chance to try any of it yet, but hopefully soon....MSMQ newgroups here: http://msdn2.microsoft.com/en-us/subscript...74230.aspx#MSMQ
ale1981 Posted October 21, 2008 Author Posted October 21, 2008 .... bump .... anybody manage to get anything related to queues working?!
ptrex Posted October 22, 2008 Posted October 22, 2008 @All Maybe this can get you going. ; Initialize error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $PlumbApp = ObjCreate("MSMQ.MSMQApplication") $PlumbQArray = $PlumbApp.ActiveQueues For $PlumbQFormatName in $PlumbApp.ActiveQueues Dim $Mgmt $Mgmt = ObjCreate("MSMQ.MSMQManagement") $Mgmt.Init (Default,Default,$PlumbQFormatName) ConsoleWrite("There are " & $Mgmt.MessageCount & " Messages in " & $PlumbQFormatName & @CR) Next ;This is custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"LogParser COM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc Regards ptrex 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
ale1981 Posted October 24, 2008 Author Posted October 24, 2008 Hi ptrex, I can not work out how to do this for a remote computer, the code you supplied will list the active queues on the computer the script is run? Thanks again.
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