Sign in to follow this  
Followers 0
the_lord_mephy

Help with code plz

10 posts in this topic

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



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

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

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

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"

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@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

#7 ·  Posted (edited)

@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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

Share this post


Link to post
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

<{POST_SNAPBACK}>

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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  
Followers 0