fireking300 Posted July 14, 2008 Share Posted July 14, 2008 (edited) I need help with command If and Then I want it to be something like this If @username = Merritt-PC Then Merritt-PC = Daniel Its Something like that but I have no Idea what to do to make it work. So when MsgBox(4096,"Welcome","The time is " & @hour & ":" & @min & ". " & @username & " Your Welcome" ) @username shows up Daniel instead of Merritt-pc I know I can just replace @username with Daniel But I want to do it this way. Edited July 14, 2008 by fireking300 Link to comment Share on other sites More sharing options...
JFee Posted July 14, 2008 Share Posted July 14, 2008 You can't change @username... it is a macro, not a variable. What you can do is create a variable and use it in the msgbox instead of @username Global $username If @UserName = "Merritt-PC" Then $username = "Daniel" MsgBox(4096,"Welcome","The time is " & @hour & ":" & @min & ". " & $username & " Your Welcome" ) Regards,Josh Link to comment Share on other sites More sharing options...
fireking300 Posted July 14, 2008 Author Share Posted July 14, 2008 Ty alot for your help JFee Link to comment Share on other sites More sharing options...
GEOSoft Posted July 14, 2008 Share Posted July 14, 2008 Are you sure it's @UserName that contains Merritt-PC? That looks more like it would be the result of @ComputerName. @UserName is the currently logged on user. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
DaRam Posted July 14, 2008 Share Posted July 14, 2008 Probably want to set the default also (and me being a Grammer Freak, the message text) muttley Global $username = @UserName If @UserName = "Merritt-PC" Then $username = "Daniel" MsgBox(4096,"Welcome","The time is " & @hour & ":" & @min & ". " & $username & " You are Welcome" ) You can't change @username... it is a macro, not a variable. What you can do is create a variable and use it in the msgbox instead of @username Global $username If @UserName = "Merritt-PC" Then $username = "Daniel" MsgBox(4096,"Welcome","The time is " & @hour & ":" & @min & ". " & $username & " Your Welcome" ) Link to comment Share on other sites More sharing options...
fireking300 Posted July 14, 2008 Author Share Posted July 14, 2008 Yeah I named my Username Merritt-pc JFee helped me get it work Link to comment Share on other sites More sharing options...
fireking300 Posted July 14, 2008 Author Share Posted July 14, 2008 I'll Use yours since its correct grammer Daram Link to comment Share on other sites More sharing options...
fireking300 Posted July 14, 2008 Author Share Posted July 14, 2008 Im fixing to test if you can store more than one $Username Link to comment Share on other sites More sharing options...
JFee Posted July 14, 2008 Share Posted July 14, 2008 I take it you're exclusively a GRAMMAR freak, not a spelling freak muttley Regards,Josh Link to comment Share on other sites More sharing options...
fireking300 Posted July 14, 2008 Author Share Posted July 14, 2008 Well I created 2 users and two different messages in the program and it worked. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now