Jump to content

Help with code plz


Recommended Posts

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]
Link to comment
Share on other sites

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"
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

  • Developers

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

@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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Developers

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...