Solved

vbscript unknown charactor in sendkey

Posted on 2009-07-16
5
287 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 500 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now