DrJeseuss Posted November 25, 2011 Author Posted November 25, 2011 Interscript communication now working. For future interest, I'd be interested to see how you went about this.
Moderators Melba23 Posted November 25, 2011 Moderators Posted November 25, 2011 DrJeseuss,As I said earlier I went for trancexx's MailSlot UDF. The forum is not allowing me to upload files at the moment so here are the 2 .au3 files I used:- Master.au3:expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "MailSlot.au3" ; Create the .a3x file from the one stored within this one FileInstall("M:\Program\Au3 Scripts\Forum Help Scripts\Halloween\Child.a3x", @ScriptDir & "\Sound.a3x", 1) Global $sMailSlotListFile = @ScriptDir & "\MailSlotList.lst" ; Start the high file $sID = "HIGH" $sPath = '"' & @ScriptDir & '\High.wav"' $iVolume_HIGH = 20 Run('"' & @ScriptFullPath & '" /AutoIt3ExecuteScript Sound.a3x ' & $sID & " " & $sPath & " " & $iVolume_HIGH & ' "') Sleep(500) ; Start the low file $sID = "LOW" $sPath = '"' & @ScriptDir & '\Low.wav"' $iVolume_LOW = 100 Run('"' & @ScriptFullPath & '" /AutoIt3ExecuteScript Sound.a3x ' & $sID & " " & $sPath & " " & $iVolume_LOW & ' "') ; Now change the volume as we go along $iBegin = TimerInit() While 1 Sleep(10) If TimerDiff($iBegin) > 5000 Then ; Change the volume of the HIGH file $iVolume_HIGH += 20 If $iVolume_HIGH = 120 Then ; Stop when we get over 100 $sMailSlotName = "\\.\mailslot\" & IniRead($sMailSlotListFile, "MailSlots", "HIGH_Child", "") _MailSlotWrite($sMailSlotName, "-99") Else $sMailSlotName = "\\.\mailslot\" & IniRead($sMailSlotListFile, "MailSlots", "HIGH_Child", "") _MailSlotWrite($sMailSlotName, String($iVolume_HIGH)) EndIf ; And now for the low file $iVolume_LOW -= 20 If $iVolume_LOW = 0 Then $sMailSlotName = "\\.\mailslot\" & IniRead($sMailSlotListFile, "MailSlots", "LOW_Child", "") _MailSlotWrite($sMailSlotName, "-99") MsgBox(0, "Master", "Exiting") FileDelete(@ScriptDir & "\Sound.a3x") Else $sMailSlotName = "\\.\mailslot\" & IniRead($sMailSlotListFile, "MailSlots", "LOW_Child", "") _MailSlotWrite($sMailSlotName, String($iVolume_LOW)) EndIf $iBegin = TimerInit() EndIf WEndAnd Child.au3:expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_type=a3x #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Sound.au3> #include "MailSlot.au3" ; Read the command line parameters $sID = $CmdLine[1] $aSndID = _SoundOpen($CmdLine[2]) SoundSetWaveVolume($CmdLine[3]) $iVolume = $CmdLine[3] _SoundPlay($aSndId) ; Create the Mailslot Global $sMailSlotListFile = @ScriptDir & "\MailSlotList.lst" Global $sMailSlotTitle = $sID & "_Child" Global $sRandomMailSlotname = _RandomStr() Global Const $sMailSlotName_Receive = "\\.\mailslot\" & $sRandomMailSlotname Global $hMailSlot = _MailSlotCreate($sMailSlotName_Receive) If @error Then MsgBox(48, "MailSlot for " & $sID, "Failed to create account!") Exit EndIf ; Add to the master list IniWrite($sMailSlotListFile, "MailSlots", $sMailSlotTitle, $sRandomMailSlotname) While 1 ; Loop the sound if required If _SoundStatus($aSndId) = "stopped" Then _SoundPlay($aSndId) EndIf ; Is there a message? Local $iSize = _MailSlotCheckForNextMessage($hMailSlot) If $iSize Then ; If so then read it Local $iVol = Number(_MailSlotRead($hMailSlot, $iSize, 1)) ; Is it a shutdown request If $iVol = -99 Then _SoundClose($aSndID) Exit Else ; Set the volume If $iVol <> $iVolume Then $iVolume = $iVol SoundSetWaveVolume($iVolume) EndIf EndIf EndIf ; Save the CPU Sleep(10) WEnd Func _RandomStr() Local $sString For $i = 1 To 13 $sString &= Chr(Random(97, 122, 1)) Next Return $sString EndFunc ;==>__RandomStrCompile them both and you should get Master.exe and Child.a3x.I used 2 simple sound files called High.wav and Low.wav - they were each about 10 secs long and played a single high/low note to make it easy to distinguish between them - just create 2 file of your liking, but do call them High/Low.wav. You will also need the MailSlot.au3 UDF in the same folder.When you execute Master.exe it creates a Sound.a3x file in the folder - that way you only need distribute that one file and not both. It runs 2 instances of the Sound.a3x files, each playing one of the sound files - one loud and one soft. At intervals it alters the volume of the 2 files until the other is louder. It then exists and clears up after itself.Please ask if you have any questions on the .au3 files - if you have questions on MailSlot then please go and ask trancexx! 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
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