Simpel

[Solved] returning data from compiled script

12 posts in this topic

#1 ·  Posted (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 by Simpel
solved

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Have you seen this?

StdinWrite

If both are in AutoIt, should not be difficult.

Alternatively pipe the commands 

find *.* | del *.* :) 


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Conrad, You can do it this way. You must download AutoItObject UDF.

Parent.au3:

#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()

Exit

Child.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

 

1 person likes this

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Thanks very much LarsJ and Jfish. Your examples work great and that UDF seemed to be a powerful thing.

Regards, Conrad

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • youtuber
      By youtuber
      2 writes and how returning?
      $var1 = "1.variable" $var2 = "2.variable" $var3 = "3.variable" For $i = 1 To 3 Step 1 MsgBox(0,"test Message header",$var1) Next For $i = 1 To 3 Step 1 MsgBox(0,"test Message header",$var2) Next If ($var2 = 2) Then Return $var1 For $i = 1 To 3 Step 1 MsgBox(0,"test Message header",$var3) Next  
    • sswcharlie
      By sswcharlie
      For a model railway project only.  Using multiple  rfid readers. These readers have no PID or VID or serial numbers.
      Only difference is the hub/port number allocated.

      Using Win7  32 bit.

      The only information I need to obtain from the HID devices is:

      hub/port number
      last string transmitted.  (14 character string of the rfid tag number)
      timestamp of the latest reading.

      The tag data will be moved to excel immediately after received by usb ready for the next read.  Timestamp and data would be overwritten by next set of data.
      the GUI would have single line for each reader (by hub/port #) with 3 headings.  Timestamp, 14 character data, and hub/port # .
      Is it possible for Autoitscript to have a GUI to do this ?

      Thankyou

      Charles Harris
       
    • PEscobar
      By PEscobar
      $Combo1 = GUICtrlCreateCombo("", 72, 96, 113, 25) GUICtrlSetData(-1, "Test1|Test2") $1 = GUICtrlRead($combo1)  
      So if someone selected Test 1 on the GUI, what value is $1? How about if they selected Test 2?
    • PEscobar
      By PEscobar
      #Region ### START Koda GUI section ### Form=c:\users\paulo\documents\gui.kxf Global $Form1_1 = GUICreate("Test", 499, 196, -1127, 323) Global $Amount = GUICtrlCreateLabel("Amount", 176, 80, 40, 17) Global $AmountInput = GUICtrlCreateInput("", 224, 80, 57, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $x = This one is just a test, but I want the value of $x to be whatever numbers the user types in. 
    • DakotaSamuel
      By DakotaSamuel
      I am having issues with Windows SmartScreen blocking my compiled scripts. They run fine on my computer, but when I move them over to a different one, either by USB or a file hosting site, they get blocked by Windows SmartScreen. I have tested it on a number of computers, and it happens on all of them. I have also done this with scripts that do and don't require Admin, and it always happens. 

      Is that related to this? I was thinking it might be, but I am not so sure since the only antivirus I have is Windows Defender. I wouldn't mind this happening since I realize you can click More info and then click run anyway, but I am planning on distributing my program, and normal users probably wouldn't know this. I don't really want to have to deal with all the users complaining that my program has viruses.
       
      -DakotaSamuel