Simpel Posted September 15, 2015 Share Posted September 15, 2015 (edited) Hi.If I embedd a compiled autoit script into my new script, is there a possibility to pass some data from the compiled embedded exe to my script?I know it's possible with an ini or txt-file. But is there something without creating a file? I plan to return an array or an unformatted string of datas with delimiters inside.Any ideas?Regards, Conrad Edited September 25, 2015 by Simpel solved SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Jfish Posted September 15, 2015 Share Posted September 15, 2015 (edited) Consolewrite?EDIT: One other thought: I have also used a GUI control to set data that can be read from another app before. I don't believe the GUI or control has to be set to visible for it to work. Edited September 15, 2015 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Simpel Posted September 15, 2015 Author Share Posted September 15, 2015 Hi,I have to get data from a data base with an authentification, I don't want to know. So one guy will write me a compiled AI-script passing me the data. I send via command line a question and I want to get back the data. How can he pass me the data? Is it clearer now?Regards, Conrad SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Jfish Posted September 15, 2015 Share Posted September 15, 2015 Where is the compiled app the other guy is writing that interacts with the database? Is it on your machine? I think you are saying it is an AI (Adobe Illustrator) script, correct? How much data is it? Can you use a network protocol to send and receive it? Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Simpel Posted September 15, 2015 Author Share Posted September 15, 2015 Hi,the compiled app is local on my machine. It is written in autoit (AI), too. I guess it is text or binary.Regards, Conrad SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Skysnake Posted September 15, 2015 Share Posted September 15, 2015 Have you seen this?StdinWriteIf both are in AutoIt, should not be difficult.Alternatively pipe the commands find *.* | del *.* Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Simpel Posted September 15, 2015 Author Share Posted September 15, 2015 Ok,the examples tell me how to send something to a child and to receive it back. But what should the child do to get the data and to push it back to parent?Can me someone give an example in two parts? First the parent, second the child executed by the parent.Regards, Conrad SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
DarkwarlorD Posted September 15, 2015 Share Posted September 15, 2015 Hello, @SimpelTake a look here: Link to comment Share on other sites More sharing options...
LarsJ Posted September 15, 2015 Share Posted September 15, 2015 Conrad, You can do it this way. You must download AutoItObject UDF.Parent.au3:expandcollapse popup#include <Array.au3> #include "AutoItObject.au3" MsgBox( 0, "Parent", "This is parent" ) _AutoItObject_StartUp() ; Register object to transfer data Global $sDataTransferObject = "DataTransferObject" Global $oDataTransferClass, $oDataTransferObject, $hDataTransferObject $oDataTransferClass = _AutoItObject_Class() $oDataTransferClass.AddProperty( "ArrayData" ) $oDataTransferObject = $oDataTransferClass.Object $hDataTransferObject = _AutoItObject_RegisterObject( $oDataTransferObject, $sDataTransferObject ) ; Create array Global $aArray[1000][10] For $i = 0 To 1000 - 1 For $j = 0 To 9 $aArray[$i][$j] = $i & "/" & $j Next Next _ArrayDisplay( $aArray, "Array on parent" ) ; Transfer data $oDataTransferObject.ArrayData = $aArray ; Start child ShellExecuteWait( "Child.au3" ) ; ------- Parent waiting while child is executing ------- MsgBox( 0, "Parent", "This is parent again" ) ; Receive data on parent $aArray = $oDataTransferObject.ArrayData _ArrayDisplay( $aArray, "Modified array on parent" ) ; Unregister data transfer object _AutoItObject_UnregisterObject( $hDataTransferObject ) _AutoItObject_Shutdown() ExitChild.au3:#include <Array.au3> MsgBox( 0, "Child", "This is child" ) ; Data transfer object Global $sDataTransferObject = "DataTransferObject" Global $oDataTransferObject = ObjGet( $sDataTransferObject ) ; Receive data on child Global $aArray = $oDataTransferObject.ArrayData _ArrayDisplay( $aArray, "Array on child" ) ; Modify array on child For $i = 0 To 100 - 1 $aArray[$i][0] = "Modified" $aArray[$i][1] = "on" $aArray[$i][2] = "child" Next _ArrayDisplay( $aArray, "Modified array on child" ) ; Transfer data $oDataTransferObject.ArrayData = $aArray Exit Simpel 1 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...
Simpel Posted September 16, 2015 Author Share Posted September 16, 2015 Sorry @LarsJ but I can't find AutoItObject UDF. I get 1326 pages of results and I cant' find that UDF. Any suggestion?Regards, Conrad SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Jfish Posted September 16, 2015 Share Posted September 16, 2015 Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Simpel Posted September 18, 2015 Author Share Posted September 18, 2015 Thanks very much LarsJ and Jfish. Your examples work great and that UDF seemed to be a powerful thing.Regards, Conrad SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
MrCreatoR Posted April 29, 2020 Share Posted April 29, 2020 On 9/15/2015 at 10:18 PM, LarsJ said: You can do it this way I know it's an old topic, but just small note - the ObjGet in this example doesn't work if you use it in callback function (WM_* for example): Parent.au3: #include <WindowsConstants.au3> #include "AutoItObject.au3" MsgBox( 0, "Parent", "This is parent" ) _AutoItObject_StartUp() ; Register object to transfer data Global $oDataTransferClass, $oDataTransferObject, $hDataTransferObject $oDataTransferClass = _AutoItObject_Class() $oDataTransferClass.AddProperty( "Data" ) $oDataTransferObject = $oDataTransferClass.Object $hDataTransferObject = _AutoItObject_RegisterObject($oDataTransferObject, "DataTransferObject") ; Transfer data $oDataTransferObject.Data = 'test' ; Start child ShellExecute("Child.au3") $hWnd = WinWait('DataTransferObject Window') ;Send command to receiver (just a trigger actualy) DllCall('user32.dll', 'ptr', 'SendMessage', 'hwnd', $hWnd, 'uint', $WM_COPYDATA, 'ptr', 0, 'ptr', DllStructGetPtr(DllStructCreate('ulong_ptr;dword;ptr'))) ; ------- Parent waiting while child is executing ------- MsgBox( 0, "Parent", "This is parent again" ) ; Receive data on parent MsgBox(64, 'Should be test2', $oDataTransferObject.Data) ; Unregister data transfer object _AutoItObject_UnregisterObject($hDataTransferObject) _AutoItObject_Shutdown() Exit Child.au3: #include <WindowsConstants.au3> $GhUI = GUICreate('DataTransferObject Window') GUIRegisterMsg($WM_COPYDATA, '_WM_COPYDATA') While 1 Sleep(10) WEnd Func _WM_COPYDATA($hWnd, $iMsg, $wParam, $lParam) ; Data transfer object Local $oData = ObjGet("DataTransferObject") ;It's always False If IsObj($oData) Then ; Transfer data $oData.Data = 'test2' EndIf Exit EndFunc Any ideas why, and how to make it work there? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
LarsJ Posted April 30, 2020 Share Posted April 30, 2020 Make sure that DllCall works, that the GUIRegisterMsg code works, and that the objects have enough time to do their job. You can do it this way. Tested on Windows 7 32/64 bit. Parent.au3 expandcollapse popup#AutoIt3Wrapper_UseX64=y #include <WindowsConstants.au3> #include "AutoItObject.au3" MsgBox( 0, "Parent", "This is parent" ) _AutoItObject_StartUp() ; Register object to transfer data Global $oDataTransferClass, $oDataTransferObject, $hDataTransferObject $oDataTransferClass = _AutoItObject_Class() $oDataTransferClass.AddProperty( "Data" ) $oDataTransferObject = $oDataTransferClass.Object $hDataTransferObject = _AutoItObject_RegisterObject($oDataTransferObject, "DataTransferObject") ; Transfer data $oDataTransferObject.Data = 'test' ; Start child ShellExecute("Child.au3") $hWnd = WinWait('DataTransferObject Window') ;Send command to receiver (just a trigger actualy) DllCall( "User32.dll", "lresult", "SendMessage", "hwnd", $hWnd, "uint", $WM_USER, "wparam", 0, "lparam", 0 ) ; ------- Parent waiting while child is executing ------- MsgBox( 0, "Parent", "This is parent again" ) ; Receive data on parent MsgBox(64, 'Should be test2', $oDataTransferObject.Data) ; Unregister data transfer object _AutoItObject_UnregisterObject($hDataTransferObject) _AutoItObject_Shutdown() Exit Child.au3 #AutoIt3Wrapper_UseX64=y #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate('DataTransferObject Window') Global $idDummy = GUICtrlCreateDummy() GUIRegisterMsg( $WM_USER, "WM_USER" ) GUISetState( @SW_SHOW ) While 1 Switch GUIGetMsg() Case $idDummy Local $oData While Not IsObj( $oData ) $oData = ObjGet("DataTransferObject") Sleep(10) WEnd ; Transfer data $oData.Data = 'test2' Exit EndSwitch WEnd Func WM_USER( $hWnd, $iMsg, $wParam, $lParam ) GUICtrlSendToDummy( $idDummy ) EndFunc 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...
MrCreatoR Posted April 30, 2020 Share Posted April 30, 2020 (edited) 5 hours ago, LarsJ said: Make sure that DllCall works, that the GUIRegisterMsg code works, and that the objects have enough time to do their job I did that, but if you check that object from inside the WM function it never became an object. 5 hours ago, LarsJ said: You can do it this way Thanks, but i would like to avoid using any external loops or calls, because then i will have to wait from the parent to accept the return data. But still it's not strange that it's not working from inside of the message function? Edited April 30, 2020 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted April 30, 2020 Share Posted April 30, 2020 Btw, if we use _AutoItObject_StartUp(False) (default, no dll load), then it will not work for x64. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted May 1, 2020 Share Posted May 1, 2020 I thought it should work with all data types, but for structures it says "The requested action with this object has failed". Parent... $oDataTransferObject.Data = DllStructCreate('dword') Child... $oData.Data = 'Other data' Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team 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