Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

vbscript unknown charactor in sendkey

Posted on 2009-07-16
5
Medium Priority
?
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
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…

705 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