Sign in to follow this  
Followers 0
Beilby

Pass variable result into a text file

4 posts in this topic

I would like to take the resultant string of a variable and pass this into an ,au3 file at the correct line and column. i.e.

CODE
$var = "world"

Feeds into a script file in the same folder which could have code like this;

CODE
$h = "hello"

$w = ;string from other script here

MsgBox (0,@ScriptName, $h & " " & $w)

where the text string would need to be inserted at line 7, column 6

What code would need to go into the first script if the second script was called "hello.au3" and was located in the same folder as the first running script?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#inculde "hello.au3"
; There is a variable named $w in the header file like "Global Const $w = 'Hello'

Dim $hello

$Hello = $w ;? this is what you mean?

Angle bracket is for the default include folder where AutoIt search for <> includes and double quotes tells AutoIt that the file resides in the script's folder.

Edit: I feel like I've missed something, if you want to send your current script string variable or anything to external script you can make some function that take either ByRef or ByVal (ByVal is the default method and there is no such keywork - ByVal). Both method, and the upper one can help you send or initialized variables from/of external scripts.

Edited by Authenticity

Share this post


Link to post
Share on other sites

I would like to take the resultant string of a variable and pass this into an ,au3 file at the correct line and column. i.e.

$var = "world"

Feeds into a script file in the same folder which could have code like this;

$h = "hello"
$w =;string from other script here

MsgBox (0,@ScriptName, $h & " " & $w)

where the text string would need to be inserted at line 7, column 6

What code would need to go into the first script if the second script was called "hello.au3" and was located in the same folder as the first running script?

Why wouldn't you just call the other script with a command line parameter containing the variable data?

Anyway, if you are determined to do it that way, use FileReadLine() and _FileWriteToLine() to make the changes.

:)


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

Share this post


Link to post
Share on other sites

Why wouldn't you just call the other script with a command line parameter containing the variable data?

Anyway, if you are determined to do it that way, use FileReadLine() and _FileWriteToLine() to make the changes.

:)

Indeed _FileWriteToLine() is the method I have gone for in the end, thanks for your help all

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
Sign in to follow this  
Followers 0