Jump to content

Rephrased question about speech marks.


czardas
 Share

Recommended Posts

I would like to give examples of symbols that are to be avioded in the naming of documents. The following symbols should be avoided. * ? / \ " and so on. But I cannot avoid the script reading the speech marks. I only want the script to deliver the message, in the form of a msgbox with an OK button. Maybe I'm asking too much!

Link to comment
Share on other sites

  • Moderators

I would like to give examples of symbols that are to be avioded in the naming of documents. The following symbols should be avoided. * ? / \ " and so on. But I cannot avoid the script reading the speech marks. I only want the script to deliver the message, in the form of a msgbox with an OK button. Maybe I'm asking too much!

Asking too much? Doubtful!

Explaining correctly? Also Doubtful, because I have no idea what you're asking.

You can check for the chars, and make a conditional statement to not allow them... You can use StringInStr() to find them, and or StringReplace() to just get rid of them all together.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

$text = InputBox("SECRET SCRIPT", "Choose a name for the file. Do not use any of the following chartacters: / \ : < > * ? |")

OK? and... the rest of the story?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

$text = InputBox("SECRET SCRIPT", "Choose a name for the file. Do not use any of the following chartacters: / \ : < > * ? |")

If _IsBadName($text) Then
    MsgBox(0,"Invalid", "FileName Character(s)")
    Exit
EndIf
MsgBox(0,"Valid", "FileName: " & $text)

Func _IsBadName($s_Name)
    Local $Ilegal_chars[9] = ['\', '/', ':', '*', '?', '"', '<', '>', '|']
    Local $x
    For $x = 0 To UBound($Ilegal_chars) - 1
        If StringInStr($s_Name, $Ilegal_chars[$x]) Then Return 1
    Next
    Return 0
EndFunc   ;==>_IsBadName

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • Moderators

The rest of the story is that I want to say

$text = InputBox("SECRET SCRIPT", "Choose a name for the file. Do not use any of the following chartacters: / \ : < > * ? | or "")

The speech marks don't appear in the InputBox. Which is a small problem.

by speach marks do you mean double quote marks?

$text = InputBox("SECRET SCRIPT", 'Choose a name for the file. Do not use any of the following chartacters: / \ : < > * ? | or "')

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...