Jump to content

Combining Vars


Recommended Posts

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

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

Link to comment
Share on other sites

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
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...