arryo Posted November 2, 2009 Posted November 2, 2009 Hiii, How can I script that multiple (at the same time) running autoit scripts can communicate with each other? Cause I made an Autoit-GUI and when I do an action with that, then it won't do anything until the action is finished. The goal is: 1. Start "Main Autoit.exe" -> GUI Example: "Start" on Main Autoit.exe clicked -> 2. Start "lolbot Autoit.exe" -> sets, for example, opens firefox, sets $x = htmlcode of google page. 3. "Main Autoit.exe" recognizes when "lolbot Autoit.exe" is finished and then gets the variable $x. 4. Closes "lolbot Autoit.exe" & updates "Main Autoit.exe" with the new informations. How is that possible?
Yashied Posted November 2, 2009 Posted November 2, 2009 http://www.autoitscript.com/forum/index.php?showtopic=91346 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
arryo Posted November 2, 2009 Author Posted November 2, 2009 http://www.autoitscript.com/forum/index.php?showtopic=91346love you =)
arryo Posted November 7, 2009 Author Posted November 7, 2009 Hmm, could you please show me a simple example? =( The example in your script is a bit to complicated for me. My 2 scripts: test.au3: #Include <Messages.au3> #Include <Array.au3> Run("test2.exe") _MsgRegister('logincheck1', 'lol1') func lol2() Msgbox(1, "lol", "received something. test2") EndFunc While True Sleep(1000) _MsgSend("logincheck2", "lol2" ) WEnd test2.au3: #Include <Messages.au3> $lol = _MsgRegister('logincheck2', 'lol2') func _Receiver($lol) Msgbox(1, "lol", "received something.") EndFunc func lol2() Msgbox(1, "lol", "received something. test2") EndFunc While True WEnd (ofc i compiled them).
Moderators Melba23 Posted November 7, 2009 Moderators Posted November 7, 2009 arryo, I developed this from Yashied's script so I could understand what was going on myself. Just compile it and then run it twice: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; Based on code from Yashied #include <GUIConstantsEx.au3> Opt("WinTitleMatchMode", 3) Global Const $WM_COPYDATA = 0x004A Global $sThis_Win_Title, $sThat_Win_Title Global $iY, $hInput, $hButton, $hLabel Global $sMsg_To_Send, $sMsg_Rcvd, $sMsg_Set = "" ; Set GUI title If WinExists("First Instance") Then If WinExists("Second Instance") Then Exit $sThis_Win_Title = "Second Instance" $sThat_Win_Title = "First Instance" $iY = 300 Else $sThis_Win_Title = "First Instance" $sThat_Win_Title = "Second Instance" $iY = 100 EndIf ; Create GUI GUICreate($sThis_Win_Title, 400, 150, 100, $iY) $hInput = GUICtrlCreateInput("", 20, 20, 360, 20) $hButton = GUICtrlCreateButton("Send", 160, 60, 80, 30) $hLabel = GUICtrlCreateLabel("", 20, 100, 360, 20) GUIRegisterMsg($WM_COPYDATA, "_WM_COPYDATA") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; Send close message to other window _SendData(WinGetHandle($sThat_Win_Title), "@exit") Exit Case $hButton ; Send message to other window $sMsg_To_Send = GUICtrlRead($hInput) $hWnd = WinGetHandle($sThat_Win_Title) If (Not @error) And ($sMsg_To_Send <> "") Then _SendData($hWnd, $sMsg_To_Send) EndSwitch ; Check messages received If $sMsg_Rcvd = "@exit" Then Exit If $sMsg_Rcvd <> $sMsg_Set Then GUICtrlSetData($hLabel, $sMsg_Rcvd) $sMsg_Set = $sMsg_Rcvd EndIf WEnd Func _SendData($hWnd, $sData) Local $tCOPYDATA, $tMsg $tMsg = DllStructCreate("char[" & StringLen($sData) + 1 & "]") DllStructSetData($tMsg, 1, $sData) $tCOPYDATA = DllStructCreate("dword;dword;ptr") DllStructSetData($tCOPYDATA, 2, StringLen($sData) + 1) DllStructSetData($tCOPYDATA, 3, DllStructGetPtr($tMsg)) $Ret = DllCall("user32.dll", "lparam", "SendMessage", "hwnd", $hWnd, "int", $WM_COPYDATA, "wparam", 0, "lparam", DllStructGetPtr($tCOPYDATA)) If (@error) Or ($Ret[0] = -1) Then Return 0 Return 1 EndFunc ;==>_SendData Func _WM_COPYDATA($hWnd, $msgID, $wParam, $lParam) Local $tCOPYDATA = DllStructCreate("dword;dword;ptr", $lParam) Local $tMsg = DllStructCreate("char[" & DllStructGetData($tCOPYDATA, 2) & "]", DllStructGetData($tCOPYDATA, 3)) $sMsg_Rcvd = DllStructGetData($tMsg, 1) Return 0 EndFunc ;==>_WM_COPYDATA 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 Â
Yashied Posted November 7, 2009 Posted November 7, 2009 Script1.au3#Include <Messages.au3> _MsgRegister('Script1', '_MyReceiver1') $i = 0 While 1 If _IsReceiver('Script2') Then $i += 1 _MsgSend('Script2', String($i)) EndIf Sleep(4000) WEnd Func _MyReceiver1($sMessage) MsgBox(0, 'Script1', $sMessage, 1) EndFunc ;==>_MyReceiver1Script2.au3#Include <Messages.au3> _MsgRegister('Script2', '_MyReceiver2') $i = 0 While 1 If _IsReceiver('Script1') Then $i += 1 _MsgSend('Script1', String($i)) EndIf Sleep(4000) WEnd Func _MyReceiver2($sMessage) MsgBox(0, 'Script2', $sMessage, 1) EndFunc ;==>_MyReceiver2 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Xenobiologist Posted November 7, 2009 Posted November 7, 2009 Hi, you can also write something into e.g. a file and loop whether the status is written, or let the scripts communicate via tcp. (see Chat) Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Yashied Posted November 7, 2009 Posted November 7, 2009 Another way.http://www.autoitscript.com/forum/index.php?showtopic=100500&view=findpost&p=718637 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
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