Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

vbscript unknown charactor in sendkey

Posted on 2009-07-16
5
Medium Priority
?
296 Views
Last Modified: 2012-05-07
I have, objShell.SendKeys name
I am getting name from a client access screen from an i Series.  If the text is just text everthing is cool, if I have a strang charactor, ( or + it errors out.  can I enclose the name in quotes or something to prevent this?  so something like objShell.SendKeys ' & name & '?
0
Comment
Question by:bergertime
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:solomonacquah
ID: 24870485
Where is sendkeys sending the information to a command line?
0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 2000 total points
ID: 24870530
You could filter out any undesired characters from the string using a function like the one below.


strSample = "This is **#$a p*er\fe+ctly ordinary s%enten~ce."
strAllowed = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
 
WScript.Echo FilterChars(strSample, strAllowed)
 
Function FilterChars(strText, strFilter)
    For i = 1 to Len(strText)
        strChar = Mid(strText, i, 1)
        
        If InStr(strAllowed, strChar) > 0 Then
            strNewText = strNewText & strChar
        End If    
    Next
    
    FilterChars = strNewText
End Function

Open in new window

0
 
LVL 2

Author Comment

by:bergertime
ID: 24870538
To a windows app.  The script starts a clickonce app, then scraps the text from an as400, then pastes the text in the windows app.
0
 
LVL 4

Expert Comment

by:solomonacquah
ID: 24870584
Try using double quotes

objShell.SendKeys Chr(34) & name & Chr(34)
0
 
LVL 2

Author Closing Comment

by:bergertime
ID: 31604271
Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question