Sign in to follow this  
Followers 0
agmonyy

Error In Expression When Trying to add strings

3 posts in this topic

Hello everyone,

Where's the error here? I needed to use a for loop to create a msgbox...

This test works...

$test = "testing"
$test = $test & @CRLF & InputBox("test", "enter test string")
MsgBox(0, "The Result is", $test)

So Why doesn't this?

$msgtext = "You have Chosen to Upload " & $filenumber & " Files." & @CRLF
for $i = 1 to $Filenumber
$msgtext = $msgtext & "File " $i & " - K:\" & $name[$i] & " = " & round((filegetsize($name[$i])/1048576), 1) & " MB." & @CRLF
Next
MsgBox(0, "Confirm The Files You Have Chosen", $msgtext)

Error in expression points to $msgtext =. does anyone know why?

Thanks,

agmonyy

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try:

$msgtext = "You have Chosen to Upload " & $filenumber & " Files." & @CRLF
For $i = 1 To $filenumber
   $msgtext = $msgtext & "File " & $i & " - K:\" & $name[$i] & " = " & round( (FileGetSize($name[$i]) / 1048576), 1) & " MB." & @CRLF
Next
MsgBox(0, "Confirm The Files You Have Chosen", $msgtext)

And overall be careful about...

$msgtext = $msgtext & "File " & $i & " - K:\" & 'ECT...'

...the concatenations symbols.

Edited by ezzetabi

Share this post


Link to post
Share on other sites

Try:

$msgtext = "You have Chosen to Upload " & $filenumber & " Files." & @CRLF
For $i = 1 To $filenumber
   $msgtext = $msgtext & "File " & $i & " - K:\" & $name[$i] & " = " & round( (FileGetSize($name[$i]) / 1048576), 1) & " MB." & @CRLF
Next
MsgBox(0, "Confirm The Files You Have Chosen", $msgtext)

And overall be careful about...

$msgtext = $msgtext & "File " & $i & " - K:\" & 'ECT...'

...the concatenations symbols.

<{POST_SNAPBACK}>

That works.

Thanks again :) Like I said, I'm a new AutoIt user, so I'm still learning!

Agmonyy

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