Jump to content
Simpel

[Solved] returning data from compiled script

Recommended Posts

Simpel

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

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
Jfish

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
Simpel

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 = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
Jfish

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
Simpel

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 = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
Skysnake

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
Simpel

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 = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
DarkwarlorD

Hello, @Simpel

Take a look here:

 

Share this post


Link to post
Share on other sites
LarsJ

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

 

  • Like 1

Share this post


Link to post
Share on other sites
Simpel

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 = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
Simpel

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 = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

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

    • dimm
      By dimm
      Is it possible to compile script without any icon resources included?
      When I make exe it uses default system icon of current OS even if I compile as console application.
      On other versions of Windows it looks a little strange

       
      Update:
      It seems that the only way is remove icons from exe after compilation using resource editors like ResHacker.

       
      another bad solution:
      Using corrupted 35 bytes icon file. Windows can't load it and shows default system icon.
      #pragma compile(Icon, broken.ico) broken.ico
    • Skeletor
      By Skeletor
      Hi All,
      It has been bugging me for a while now. 
      Can you view the AutoIt code from within a compiled exe. Like how you can with most .Net exe's by using a certain program.
      If this is possible, how then can I secure my program (if this method exists).
       
    • Simpel
      By Simpel
      Hi,
      I'm trying to replace line breaks. But when there are two or more of them keep them. At the end it should reformat copied text with unwanted line breaks. This is my code:
      #include <MsgBoxConstants.au3> ;~ Local $sText = ClipGet() Local $sText = "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & "asd" & @CRLF & @CRLF & "asd" MsgBox($MB_TOPMOST, "Original", $sText) Local $sRegexKillEnters = "(?m)(?<=\V)\v(?!\v|\h\h|\t)" ; (first all but Enter)Enter(but not if Enter or 2 Spaces or a Tab - if one wrote a list) $sText = StringRegExpReplace($sText, $sRegexKillEnters, " ") MsgBox($MB_TOPMOST, "Kill Enters", $sText & @CRLF & @CRLF & "Extended: " & @extended) I would expect:
      asd asd asd asd asd asd asd asd asd asd asd but get no error code and this:
      asd asd asd asd asd asd asd asd asd asd asd It works at regex101.com with flavour pcre: https://regex101.com/r/aTmV2T/1 but @AZJIO RegExp-Tester gives @Extended = 11.
      What is my mistake? Simpel
    • smud
      By smud
      Currently, I'm working on a program that will display Dialog boxes with either Yes or No.
      For each dialog, I reward the user with X amount of Credits.
      I'm hoping to output the amount of credits to a cell in a column (there will be 20 different columns).
      It will only post to a row that is equal to today's date (first column). If no row exists yet with the current date, it will start a new row.
      Any suggestions?
      Thank you
    • Pricehacker
      By Pricehacker
      Hello!
      I want to make a script that changes the filesize of program files while still having them run as usual.
      I tried FileWrite() but then the program wouldnt be recognized as a runnable program, could you guys help me to the right path?
×