Sign in to follow this  
Followers 0
godsstigma

Combining Vars

5 posts in this topic

I am trying to combine two variables into one variable separating the two with a single character like "\".

Here is my sample script:

#include <file.au3>

$folderselect = FileSelectFolder("Select folder that contains files you wish to write to an array","@DesktopDir", 7) 
$filelist1 = _FileListToArray($folderselect, "*.*", 1) 
$file = FileOpen("c:\Test Array.txt", 2) 
_FileWriteFromArray($file, $filelist1) 
fileclose($file) 

$file2read = FileOpen("c:\Test Array.txt", 0) 
$readfile = fileread($file2read) 
MsgBox(1, "Contents of File", $readfile)
$readline = FileReadLine($file2read, 6)

I want $folderselect and $readline to be combined separated by "\"

...basically getting the full file path to use later.

Thanks

-John

Share this post


Link to post
Share on other sites



What you're looking for is String Concatenation. In AutoIt, the operator is the & character.

See the following example:

$var3 = $var1 & "\" & $var2

Cheers,

Brett

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I am trying to combine two variables into one variable separating the two with a single character like "\".

Here is my sample script:

#include <file.au3>

$folderselect = FileSelectFolder("Select folder that contains files you wish to write to an array","@DesktopDir", 7) 
$filelist1 = _FileListToArray($folderselect, "*.*", 1) 
$file = FileOpen("c:\Test Array.txt", 2) 
_FileWriteFromArray($file, $filelist1) 
fileclose($file) 

$file2read = FileOpen("c:\Test Array.txt", 0) 
$readfile = fileread($file2read) 
MsgBox(1, "Contents of File", $readfile)
$readline = FileReadLine($file2read, 6)

I want $folderselect and $readline to be combined separated by "\"

...basically getting the full file path to use later.

Thanks

-John

$newvar = $folderselect & "\" & $readline

It's all in the helpfile....

Edited by liteswap

Share this post


Link to post
Share on other sites

Thanks to both of you,

I knew it was in the help file I just couldn't find it.

Now that I know what to search for I should be fine...

thanks again!!!

Share this post


Link to post
Share on other sites

Thanks to both of you,

I knew it was in the help file I just couldn't find it.

Now that I know what to search for I should be fine...

thanks again!!!

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