Solved

vbscript unknown charactor in sendkey

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

785 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