Jump to content
Sign in to follow this  
the_lord_mephy

Help with code plz

Recommended Posts

the_lord_mephy

Do
$letter = InputBox("Enter Character", "Please Enter the character you wish to see the ASCII code for. To end script, enter quit in the box below")
$ascii = Asc($letter)
If StringLen($letter) >= 2 AND NOT $letter="quit" Then
   MsgBox(0, "Error", "You typed in more than one character at once")
ElseIf StringLen($letter) = 1 Then
MsgBox(0, "ASCII", "The ASCII Code for: " &$letter& " is: " &$ascii)
EndIf

Until $letter = "quit"

How come when ever i enter a random letter combonation, it doesnt do the Msgbox that says you typed in more than one character at once


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites
Matt @ MPCS

Try This:

Do
$letter = InputBox("Enter Character", "Please Enter the character you wish to see the ASCII code for. To end script, enter quit in the box below")
$ascii = Asc($letter)
If StringLen($letter) >= 2 AND NOT( $letter="quit" ) Then
   MsgBox(0, "Error", "You typed in more than one character at once")
ElseIf StringLen($letter) = 1 Then
MsgBox(0, "ASCII", "The ASCII Code for: " &$letter& " is: " &$ascii)
EndIf

Until $letter = "quit"

Share this post


Link to post
Share on other sites
the_lord_mephy

thankyou


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites
the_lord_mephy

is there a way to make it so that if the person clicks cancel it goes away?


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites
Jos

is there a way to make it so that if the person clicks cancel it goes away?

<{POST_SNAPBACK}>

Do
   $letter = InputBox("Enter Character", "Please Enter the character you wish to see the ASCII code for. To end script, enter quit in the box below")
   If @error = 1 then ExitLoop
   $ascii = Asc($letter)
   If StringLen($letter) >= 2 And Not $letter = "quit" Then
      MsgBox(0, "Error", "You typed in more than one character at once")
   ElseIf StringLen($letter) = 1 Then
      MsgBox(0, "ASCII", "The ASCII Code for: " & $letter & " is: " & $ascii)
   EndIf
   
Until $letter = "quit"

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Matt @ MPCS

@JdeB

Did that work for you? I was trying it, but it wasn't working for me.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites
Jos

@JdeB

Did that work for you? I was trying it, but it wasn't working for me.

*** Matt @ MPCS

<{POST_SNAPBACK}>

yeap, works for me... when Cancel is clicked in the InputBox, the loop is exited....

Did you use my code or did you place the @error test at a different line ?

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Matt @ MPCS

Here it is, for some reason the @error has to come before you determine the ascii value:

Do
   $letter = InputBox("Enter Character", "Please Enter the character you wish to see the ASCII code for. To end script, enter quit in the box below")
   If @error = 1 then ExitLoop
   $ascii = Asc($letter)
   If StringLen($letter) >= 2 AND NOT( $letter="quit" ) Then
      MsgBox(0, "Error", "You typed in more than one character at once")
   ElseIf StringLen($letter) = 1 Then
   MsgBox(0, "ASCII", "The ASCII Code for: " &$letter& " is: " &$ascii)
   EndIf
Until $letter = "quit"

*** Matt @ MPCS

Share this post


Link to post
Share on other sites
Jos

Here it is, for some reason the @error has to come before you determine the ascii value:

Do
   $letter = InputBox("Enter Character", "Please Enter the character you wish to see the ASCII code for. To end script, enter quit in the box below")
   If @error = 1 then ExitLoop
   $ascii = Asc($letter)
   If StringLen($letter) >= 2 AND NOT( $letter="quit" ) Then
      MsgBox(0, "Error", "You typed in more than one character at once")
   ElseIf StringLen($letter) = 1 Then
   MsgBox(0, "ASCII", "The ASCII Code for: " &$letter& " is: " &$ascii)
   EndIf
Until $letter = "quit"

*** Matt @ MPCS

<{POST_SNAPBACK}>

@error contains the Error condition of the last function, so it has to come right after the inputbox.....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Matt @ MPCS

Yeah i figured that out after looking at the documentation. Thanks for the pointer though. :ph34r:

*** Matt @ MPCS

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  

×