Jump to content

Child Script


torels
 Share

Recommended Posts

Hi there

I'm working on a project where I need to return a value to a script other form the script where the function returning the value is in, and the "child" script isn't included in the "parent" one.

Is there any way to return values using Return ?

since my english isn't wonderful, i'll make a simple example: Script A.au3 runs script B.au3, and I want a value to be returned from script B.au3 to script A.au3

thanks in advance :mellow:

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

Hi there

I'm working on a project where I need to return a value to a script other form the script where the function returning the value is in, and the "child" script isn't included in the "parent" one.

Is there any way to return values using Return ?

since my english isn't wonderful, i'll make a simple example: Script A.au3 runs script B.au3, and I want a value to be returned from script B.au3 to script A.au3

thanks in advance :mellow:

Lots of ways. Here is one

script 1. Compile this as exit1.exe and save it in the same folder as the next script

ControlSend("1997aggh","","[Class:Edit;Instance:1]",536)

then run this script

$rf = GUICreate("1997aggh")
$ed=GUICtrlCreateEdit("",0,0,100,100)
Runwait("exit1.exe")

ConsoleWrite(GUICtrlRead($ed ) & @CRLF)

But it depends on what you want to send back.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

thanks for the example but I wanted to use return

Script B is a user-created script (created after script A is compiled) And I wanted it to return values like if the function was in the script, so using Return. Also, script A has no GUI.

I was also thinking of a function override (i think that's the word) so to create a "Return" Function acting like Return... but i don't think it's possible...

any other suggestions ?

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

thanks for the example but I wanted to use return

Script B is a user-created script (created after script A is compiled) And I wanted it to return values like if the function was in the script, so using Return. Also, script A has no GUI.

I was also thinking of a function override (i think that's the word) so to create a "Return" Function acting like Return... but i don't think it's possible...

any other suggestions ?

Maybe an example of something you would like to do would help.

Do you mean that you want the second script to act as a function and return some result? In which case the method I showed would work but so would others.

My example was just to show a way to pass information very simply without a visible gui, but you could also use messages for example.

Dlls act as external functions but you cannot create them with AutoIt.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Perhaps the child script could end with:

$iRetVal = 1234 ; Some meaningful INT32 value
Exit $iRetVal

The the parent script would call it with:

$iRET = RunWait($sPathToChildScript)

Only good for INT32 values, but you haven't been very clear about what data you want to pass back.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Another way is to store and read the data in a file.

Second script writes the data , first one reads the data after script 2 finishes.

You can store in INI files - there a a lot of helpful ini functions you can check in the help file.

Link to comment
Share on other sites

@Juvigy & dmob: I now there are many methods. The point of my question was, as I said, that the script returing the value is User-Created after the script recieving the value is compiled. So I needed to keep it as simple as possible so to use any script without any particular changes.

Thanks for the help anyway

@PsaltyDS: Thanks for your help, I suppose it's the easiest way of doing it :mellow:

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...