Jump to content
Sign in to follow this  
dforsyth

Help With Username and If statement

Recommended Posts

dforsyth

Hey everyone. I need some help getting and using the @username with an if statement.

So, the goal of my script is to run a program, find the username, then send certain keys depending on that the username is. So right now, here is my code:

If @Username = testuser1 Then
Send("testuser1 stuff")
Elseif @username = testuser2
Send("testuser2 stuff")
Else
Send("testuser3 stuff")
EndIf

Am i doing this correctly? When the script runs it i get the "Error parsing function call" pop up box.

Thanks for the help in advance.

Share this post


Link to post
Share on other sites
Nessie

Hey everyone. I need some help getting and using the @username with an if statement.

So, the goal of my script is to run a program, find the username, then send certain keys depending on that the username is. So right now, here is my code:

If @Username = testuser1 Then
Send("testuser1 stuff")
Elseif @username = testuser2
Send("testuser2 stuff")
Else
Send("testuser3 stuff")
EndIf

Am i doing this correctly? When the script runs it i get the "Error parsing function call" pop up box.

Thanks for the help in advance.

You haven't used the " in the If statement, you don't have used Then after the end of Elseif statement. Your Send command is totally wrong ;)

Take a look on help file for Send command, and If statement.

Hi!

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites
JLogan3o13

dforsyth, in your initial post you were missing both the quotes around testuser1 and testuser2 and the Then keyword. This fails:

If @Username = testuser1 Then
Send("testuser1 stuff")
Elseif @username = testuser2
Send("testuser2 stuff")
Else
Send("testuser3 stuff")
EndIf

This does not:

If @Username = "testuser1" Then
 Send("testuser1 stuff")
Elseif @username = "testuser2" Then
 Send("testuser2 stuff")
Else
 Send("testuser3 stuff")
EndIf

See why now?


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
dforsyth

That makes perfect sense. And it is now working. Thank you guys very much

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  

×