topten Posted October 24, 2015 Share Posted October 24, 2015 I have searched but found nothing for a working example of communication between autoit scripts, but without gui creation. Is it possible? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 24, 2015 Moderators Share Posted October 24, 2015 topten,Of course - the GUIs are usually there so you can see the sent/received data. Here are 2 scripts without GUIs - compile both and run the parent:MailSlot_Parent,au3:expandcollapse popup#include <MsgBoxConstants.au3> #include "MailSlot.au3" HotKeySet("{ESC}", "_Exit") ; Create the Mailslot $sMailSlotName = "\\.\mailslot\trancexxudf" $hMailSlot = _MailSlotCreate($sMailSlotName) If @error Then MsgBox(48, "MailSlot for Label_Master", "Failed to create account!") Exit EndIf ; Run child ShellExecute("MailSlot_Child.exe", $sMailSlotName) While 1 Sleep(10) ; Is there a message? Local $iSize = _MailSlotCheckForNextMessage($hMailSlot) If $iSize Then ; If so then read it $sMessage = _MailSlotRead($hMailSlot, $iSize, 1) ; Announce content MsgBox($MB_SYSTEMMODAL, "Message from Parent", "Received: " & $sMessage) EndIf WEnd Func _Exit() Exit EndFuncMailslot_Child.au3:#include <MsgBoxConstants.au3> #include "MailSlot.au3" If $CmdLine[0] = 0 Then Exit ; Read MailSlot name $sMailSlotName = $CmdLine[1] ; Start timer $nBegin = TimerInit() While 1 Sleep(10) If TimerDiff($nBegin) > 20 * 1000 Then ; Random uppercase letter $sMessage = Chr(Random(65, 90, 1)) ; Announce sending MsgBox($MB_SYSTEMMODAL, "Message from Child", "Sending: " & $sMessage) ; Send _MailSlotWrite($sMailSlotName, $sMessage) ; Reset timer $nBegin = TimerInit() EndIf If Not ProcessExists("MailSlot_Parent.exe") Then Exit EndIf WEndKeep the same names as I have hard-coded them for simplicity. You will obviously also need trancexx's MailSlot UDF:M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MilesAhead Posted October 24, 2015 Share Posted October 24, 2015 (edited) You can also create message only windows using the CreateWindowEx api. But that may be more useful in multi-thread programs. May work with a timer but I haven't tried it. I used it as a scheme to pass the command line to the primary instance of a program with WM_COPYDATA. But there are lots of IPC you can use. Windows does a lot with named memory mapped files. If you can pass your data with a single page of memory then you can map the file using the page file as backing, rather than creating an actual disk file, even if the system has no paging file(virtual memory set to 0.) Windows must make a temp file under the covers or just remap it to some memory in the system. I don't know how it does it but I tried it and it does work.Just rambling on. Edited October 24, 2015 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
mikell Posted October 24, 2015 Share Posted October 24, 2015 You could also try the Container UDF 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