Login Register






What is the physical difference between the two?!! filter_list
Author
Message
What is the physical difference between the two?!! #1
I cannot figure it out. Not sure if my eyes are deceiving me or what but what is the difference in the two sets of code? this is autoit3 btw

Dont say anything about letter cases (capital letters vs undercase letter) and the single quote over double quote (' over ") they all mean the same thing respectively.

The code i handwrote
Code:
Dim $version = @AutoItVersion Dim $computername = @ComputerName Dim $OS = @OSVersion Dim $text = '' Switch $OS Case 'Win_2008' $OS = 'Windows Server 2008' Case 'Win_vista' $OS = 'Windows Vista' Case 'Win_2003' $OS = 'Windows Server 2003' Case 'Win_xp' $OS = 'Windows xp' Case 'Win_2000' $OS = 'Windows 2000' Case 'Win_nt4' $OS = 'Windows NT 4.0' Case 'Win_me' $OS = 'Windows ME' Case 'Win_98' $OS = 'Windows 98' Case 'Win_95' $OS = 'Windows 95' Case Else $OS = 'Unknown!' EndSwitch $text = 'Autoit Version = ' & $version & @CRLF $text = 'Computer Name = ' & $computername & @CRLF $text = 'Operating System = ' & $OS MsgBox (0,'Computer Information',$text)

The code presented.
Code:
Dim $version = @AutoItVersion Dim $computername = @ComputerName Dim $OS = @OSVersion Dim $text = "" Switch $OS Case "WIN_2008" $OS = "Windows Server 2008" Case "WIN_VISTA" $OS = "Windows Vista" Case "WIN_2003" $OS = "Windows Server 2003" Case "WIN_XP" $OS = "Windows XP" Case "WIN_2000" $OS = "Windows 2000" Case "WIN_NT4" $OS = "Windows NT 4.0" Case "WIN_ME" $OS = "Windows ME" Case "WIN_98" $OS = "Windows 98" Case "WIN_95" $OS = "Windows 95" Case Else $OS = "Unknown!" EndSwitch $text = "AutoIt Version = " & $version & @CRLF $text &= "Computer Name = " & $computername & @CRLF $text &= "Operating System = " & $OS MsgBox (0, "Computer Information", $text)

Reply

RE: What is the physical difference between the two?!! #2
Quote:$text &= 'Computer Name = ' & $computername & @CRLF ; the &= adds to the variable. same as doing $var=$var & 'extra stuff'
$text &= 'Operating System = ' & $OS

In the code presented, the text is being appended to the $text variable, whereas you are just assigning the value.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: What is the physical difference between the two?!! #3
what?

Reply

RE: What is the physical difference between the two?!! #4
The red text (&) is missing from your code in the 2nd last and 3rd last line.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: What is the physical difference between the two?!! #5
i dont know what is missing there...unless you're thinking the comments. the single line comments in au3 is starts with semicolon...

im going to remove all comments from both of these.

Reply

RE: What is the physical difference between the two?!! #6
You didn't get it. See:

code presented:
Quote:$text = "AutoIt Version = " & $version & @CRLF ; The & character concentrates (joins) two
values together.
$text &= "Computer Name = " & $computername & @CRLF ; The &= adds to the variable. The
same as doing $var = $var & "extra stuff"
$text &= "Operating System = " & $OS

your code:

Quote:$text = 'Autoit Version = ' & $version & @CRLF ; & joins the two values together.
$text = 'Computer Name = ' & $computername & @CRLF ; the &= adds to the variable. same as doing $var=$var & 'extra stuff'
$text = 'Operating System = ' & $OS

You wrote $text &= as $text =
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: What is the physical difference between the two?!! #7
i saw that after a closer look into what you were saying! thank you!<33

im sorry for being a little under myself, and letting that go over my head...im a blonde ya know Wink


Reply

RE: What is the physical difference between the two?!! #8
Haha, no problem. It happens many times.
The trick to finding the difference in these situations is open both in Notepad++ or a similar text editor, and try to format them exactly the same so that the textual differences become more revealing.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: What is the physical difference between the two?!! #9
scite4 for au3...its the editor default to au3. its based off the same platform as NP++ though.....i guess so many hours of looking at and writing code could mess with your eyes eh? Wink

Reply

RE: What is the physical difference between the two?!! #10
bleach is really addictive, 20 episodes per day XD that i even can't write 1 line of code of au3...

i started bleach 5 days ago, i'm on epi 100 now lol

if i wasn't addicted i'd help ya :whistle:
(This post was last modified: 10-06-2011, 04:42 AM by Skullmeat.)
Pierce the life fibers with your drill.

Reply