Sign in to follow this  
Followers 0
Infinitex0

Script problem

11 posts in this topic

#1 ·  Posted (edited)

This script is supposed to open an input box and when the right text is input, play a track.

InputBox( "music", " ")
If $text <> "Eminem" Then
MsgBox(4096, "Don't Have", "Sorry don't have that")
Else
$bLoop = 0   
EndIf
MsgBox(4096, "Got that", "Here")
SoundPlay("C:\Documents and Settings\Administrator\My Documents\My Music\Eminem\The Marshall Mathers LP\07 The Way I Am.wma", 0)

But when I type in the text it says

-------------------------------------------------------------------------------------------------l

l AutoIt Error l

l -----------------------------------------------------------------------------------------------l

l Line 2 (File "C:\Documents and Settings\Administrator\Desktop\test1.au3"): l

l l

l If $text <> "Eminem" Then l

l If ^ERROR l

l l

l Error: Variable used without being declared. l

l l

l ------------ l

l l__OK___ l l

l------------------------------------------------------------------------------------------------l

Any suggestions?

P.S. I had a lot of time on my hands.

Edited by Infinitex0

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites



Onix8 is right this will work

$text = InputBox( "music", " ")
If $text <> "Eminem" Then
MsgBox(4096, "Don't Have", "Sorry don't have that")
Else
$bLoop = 0  
EndIf
MsgBox(4096, "Got that", "Here")
SoundPlay("C:\Documents and Settings\Administrator\My Documents\My Music\Eminem\The Marshall Mathers LP\07 The Way I Am.wma", 0)

Share this post


Link to post
Share on other sites

Thanks, Oxin8. But now I have another problem. The music plays regardless. How could I make the music play only when the right text is inputed?


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

Move the "EndIf" to the end. :lmao:

$text = InputBox( "music", " ")
If $text <> "Eminem" Then
MsgBox(4096, "Don't Have", "Sorry don't have that")
Else
$bLoop = 0  
MsgBox(4096, "Got that", "Here")
SoundPlay("C:\Documents and Settings\Administrator\My Documents\My Music\Eminem\The Marshall Mathers LP\07 The Way I Am.wma", 0)
EndIf

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks, Oxin8, and Nuffilein805

Edited by Infinitex0

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

here you are

$text = InputBox( "music", " ")
If $text <> "Eminem" Then
MsgBox(4096, "Don't Have", "Sorry don't have that")
Else
$bLoop = 0  

MsgBox(4096, "Got that", "Here")
SoundPlay("C:\Documents and Settings\Administrator\My Documents\My Music\Eminem\The Marshall Mathers LP\07 The Way I Am.wma", 0)
endif

just modified 1 line of script

Share this post


Link to post
Share on other sites

Okay how could I make it so if I input "Eminem" it would play one track but if I input "Eminem2" it would play another track?


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

One option is an "If ElseIf Else EndIf". lol. I'm sure there's a better name somewhere...

$text = InputBox( "music", " ")
If $text = "Eminem" Then
    $bLoop = 0
    MsgBox(4096, "Got that", "Here")
    SoundPlay("C:\Documents and Settings\Administrator\My Documents\My Music\Eminem\The Marshall Mathers LP\07 The Way I Am.wma", 0)
ElseIf $text = "Eminem2" Then
    $bLoop = 0
    MsgBox(4096, "Got that", "Here")
       ;Play other song here
Else
    MsgBox(4096, "Don't Have", "Sorry don't have that")
EndIf

And I think that's your last freebie :lmao: Check out the help file and some tutorials as most easything things like this will be covered there. ;)

Edited by Oxin8

Share this post


Link to post
Share on other sites

THANK YOU Oxin8!!!!!!! You are AWESOME!!!!!!!!!!!


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

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