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

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning AutoIt community!
      Today, I'm here to ask you if you know how to run an .exe from cmd.exe ( Command Prompt )...
      My intention is to read a .ini file where I store an information that has to be included in the shell, and run an .exe with that information...
      I'll give you an example
      Local $aFileCartellaAuditCopy = _FileListToArray($sPercorsoAuditCopy, "*.txt") If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la lettura della lista dei file nella directory" & @CRLF & $sPercorsoAuditCopy & @CRLF & "Errore: " & @error) Return False Else Local $iPID = Run("cmd.exe" & ' /k "C:\Users\Portatile-60\Desktop\HmiCheckLogIntegrity.exe" "C:\Users\Portatile-60\Desktop\AuditTrailDosaggio0_20170327_151335_DOSAGGIO_PW_01.txt"') ; & " /k " & '"' & $sHmiCheckLogIntegrity & '"' & " " & '"' & $sPercorsoAuditCopy & "\" & $aFileCartellaAuditCopy[1] & '"', "", @SW_SHOW, $STDOUT_CHILD) Return True EndIf This code is in a function, that returns False if it can retrive at least a file from the path stored in the .ini file...
      Else
      I would like to run the Command Prompt with the .exe and with a parameter of that .exe, but it seems to not work properly.

      Could please anyone tell me why?

      Thanks  
    • bdenn
      By bdenn
      Hello,
      I have searched and searched the web for an answer on how to get data from a webpage and paste it into a notepad document.
      The problem is I need to access a website that is not on the internet but yet only on our local network so the IP will be "192.168.125.xxx"
      This site only displays a few things but what I need to do is pull two parts of information that are located in a table. looking at this as an excel point of view this would be cells B2 and C2. These cells hold two numbers that say 850 Watts and 3 Watts, but they change all the time.
      If I do a page "inspect element" I can see these exact numbers in the source code but very deep.
      Currently I have the following code:
      run ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")         sleep(500)         Send("192.168.125.xxx")         Send("{Enter}")         sleep(100)         Send("password")         Send("{Enter}") How do I get AutoIT to see these two data points and copy and paste them into a notepad.
      I do not really need the webpage to open, but will deal with it if I need to.
      ** I have attached an image of the data I need.
      Thanks,
      Bdenn

    • ur
      By ur
      I have an exe with name "erwin Data Modeler r9.7 (32-bit)_2332.exe"
       
      THe lat 4 digits 2332 may vary and also the version number r9.7 also might vary.
      So, how to write a generic expression so that the exe can be picked from the current directory {with any version (9.7 or anything) and any build number (2332 or anything)}
       
      Thanks in Advance
    • 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