Wsh sendkeys error

wsh sendkeys error

Sendkeys "{0 When a Optim export command encounters a error(fatal error 12 such as incorrect Optim Directory name),it throws an error and a dialog. The first generates the error "invalid procedure call or arguments" WSH's SendKeys method doesn't work very well against a dos box/command prompt. Script: C:\test.vbs. Line: 1. Char: 1. Error: Type mismatch: 'Sendkeys' Code: 800A000D Source: Microsoft VBScript runtime error.

Wsh sendkeys error - what necessary

Send keystrokes in vbscript

Hi,
below is my code: I am trieng to install some driver through vbscript. At the time of driver installation, it asks for 2 options: continue anyway/stop installation. By default it is stop installation selected. So when my script runs, stop installation gets selected. How can i change it to continue installation? through vbscript? I tried to use tab key nut it is giving me compilation error



Please log in to answer

Posted by: anonymous_9363 12 years ago

Red Belt

If you had read anything on the subject, you would have discovered that the prompt arises because the driver being installed isn't signed. Sign the driver (or, better, get the driver supplier to sign it) and the problem goes away.

Still, the half-arsed TAB-pressing is SOOOOOOOOO much more professional. Hey! Actually, this is brilliant! Why bother with creating response transforms for MSIs when you can have a script like this:

Posted by: bkruiser 12 years ago

Orange Belt

objShell.SendKeys "{TAB}"

Posted by: anonymous_9363 12 years ago

Red Belt

...which neatly avoids pointing out that there exists a perfectly good methodology for using DPInst to install drivers, a sticky for which appears at the top of the 'Package Development' forum. Additionally, there are a gazillion posts in that same forum on the subject.

But then, this poster seems determined to:
- not use AppDeploy's Search facility;
- not use a search facility of any kind;
- avoid reading anything, certainly not any previous posts on the same subject;
- find the most complicated way of achieving his goals; and finally
- not take advice.

Posted by: abking99 12 years ago

Second Degree Blue Belt

Hi.
VBScab, I know that we can install drivers, through dpinst.exe, the same command was working fine on my home xp image. It was not giving any prompt, and was directly installing drivers silently. On my project image it was giving prompt, so choose this way.

Posted by: abking99 12 years ago

Second Degree Blue Belt

I have done some packages in past, but not for any project. Just for practice. So I just knew that, we can use dpinst.exe to install drivers. From next time I will definitely investigate as you have mentioned.

Posted by: bkruiser 12 years ago

Orange Belt

your rough... correct, but rough

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answer this question

SendKeys and Command prompt window problem

Luigino Rossi's profile photo

Luigino Rossi

unread,
Mar 13, 2004, 8:27:42 PM3/13/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

I'm trying to minimize a command prompt window using SendKeys:
wshShell.AppActivate("Command Prompt");
wshShell.SendKeys("%( ){DOWN}{DOWN}{DOWN}{ENTER}");
but the characters Alt+Space do not open the window's menu so the
others characters are sent into the window and not to the menu.

I hope anyone could help me, thanks B-)

Austin M. Horst's profile photo

Austin M. Horst

unread,
Mar 13, 2004, 10:56:05 PM3/13/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

You do not have permission to delete messages in this group

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

wshShell.AppActivate("Command Prompt");
wshShell.SendKeys("%{SPACE}N");

-or-

wshShell.AppActivate("Command Prompt");
wshShell.SendKeys("% N");

In the second example; there is a space between the % and the letter N.


Austin M. Horst

Luigino Rossi's profile photo

Luigino Rossi

unread,
Mar 14, 2004, 7:28:07 PM3/14/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

None of your solutions work B-(

The first generates the error "invalid procedure call or arguments"
The second works like my procedure, the character N is sent to the
command prompt window and of course the window is not minimized.

I also tryed the combination of both solutions:
wshShell.SendKeys("%( )N");
but it works the same way.

still hoping... ;-)

Austin M. Horst <[email protected]> wrote in message news:<[email protected]>...

Torgeir Bakken (MVP)'s profile photo

Torgeir Bakken (MVP)

unread,
Mar 14, 2004, 10:11:27 PM3/14/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

Luigino Rossi wrote:

Hi

WSH's SendKeys method doesn't work very well against a
dos box/command prompt.

For a Sendkeys solution that will work for this scenario, you should
use AutoIt or AutoItX.

AutoIt/AutoItX is free and can be found here:
http://www.hiddensoft.com/AutoIt/


AutoItX is an ActiveX control version of AutoIt and can be used from a
vbscript.

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide:
http://www.microsoft.com/technet/community/scriptcenter/default.mspx

Benny Pedersen's profile photo

Benny Pedersen

unread,
Mar 15, 2004, 12:43:59 AM3/15/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

You do not have permission to delete messages in this group

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

[email protected](Luigino Rossi) wrote in message news:<[email protected]>...

You can also try this vbs:

dim wso: set wso = createObject("wScript.shell")

msgBox "Minimized:"
for i=1 to 4
wso.run "%comspec% /c " & "ECHO Hello", 2, true
next

msgBox "Maximized:"
for i=1 to 4
wso.run "%comspec% /c " & "ECHO Hello", 3, true
next

msgBox "Normal:"
for i=1 to 4
wso.run "%comspec% /c " & "ECHO Hello", 5, true
next

wso.run "%comspec% /K " & "ECHO Welcome to DOS", 3

set wso = nothing

Austin M. Horst's profile photo

Austin M. Horst

unread,
Mar 15, 2004, 12:51:06 AM3/15/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

You do not have permission to delete messages in this group

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

Tested, works for me.

VBSctipt:

Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.Run "cmd.exe"
WSHShell.AppActivate "Command Prompt"
WSHShell.SendKeys "% N"

JScript:

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("cmd.exe");
WshShell.AppActivate("Command Prompt");
WshShell.SendKeys("% N");


Austin M. Horst

Austin M. Horst's profile photo

Austin M. Horst

unread,
Mar 15, 2004, 12:51:09 AM3/15/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

You do not have permission to delete messages in this group

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

Luigino Rossi's profile photo

Luigino Rossi

unread,
Mar 15, 2004, 7:01:11 PM3/15/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

Peter Nguyen's profile photo

Peter Nguyen

unread,
Mar 15, 2004, 11:52:27 PM3/15/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

You do not have permission to delete messages in this group

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

You need to give time for the command prompt to open before you can enter
inputs.

Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.Run "cmd.exe"

wsh.sleep 1000 ' wait 1 second


WSHShell.AppActivate "Command Prompt"
WSHShell.SendKeys "% N"

Peter Nguyen


"Luigino Rossi" <[email protected]> wrote in message
news:[email protected]

Luigino Rossi's profile photo

Luigino Rossi

unread,
Mar 17, 2004, 3:35:57 AM3/17/04

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

Yes I know, so I tryed also with a command prompt windows already open
but it did not work.

I tested the script on Windows XP and on Windows 2000 with a Script
Host version 5.6

Thanks anyway B-)

"Peter Nguyen" <[email protected]> wrote in message news:<%[email protected]>...

ravipa...@gmail.com's profile photo

[email protected]

unread,
Jan 1, 2013, 10:25:28 AM1/1/13

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

You do not have permission to delete messages in this group

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

Even iam facing same issue,could you plz tell me your Microsoft Windows Version
tlav...@gmail.com's profile photo

[email protected]

unread,
Jan 8, 2013, 6:29:10 PM1/8/13

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

You do not have permission to delete messages in this group

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

On Tuesday, January 1, 2013 1:25:28 AM UTC-5, [email protected] wrote:
> On Monday, 15 March 2004 02:22:48 UTC+5:30, Austin M. Horst wrote:

This could be made to work up through Win XP, but cannot be made to work with Vista or Win 7. I would therefore have to surmise it is also disabled in Win8.

What exactly are you trying to do that requires a minimized command prompt window? If you are running a WSH script, you should be able to execute it under the Wscript.exe host which doesn't open a console window at all.
_______________________
Tom Lavedas
cre...@gmail.com's profile photo

[email protected]

unread,
Nov 25, 2014, 11:23:16 PM11/25/14

Reply to author

Sign in to reply to author

Forward

Sign in to forward

Delete

You do not have permission to delete messages in this group

Link

Report message as abuse

Sign in to report message as abuse

Show original message

Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message

to

I had the same problem, and found a workaround using powershell:

powershell -windowstyle minimized -command ""

To restore the window:

powershell -windowstyle normal -command ""

See http://stackoverflow.com/a/27134310/1683264for use case. I know this isn't a WSH solution, but scripting a batch script wrapper for your cscript command should be trivial.

WshShell.SendKeys

Send one or more keystrokes to the active window as if they were typed at the keyboard. This method is similar to the VB SendKeys method.

WshShell.SendKeys "Character_string_and/or_SendKeys"

Most ASCII characters can be represented by the character itself.
E.g, the key sequence FRED can be represented by "FRED".
Some special keys, such as the control keys, function keys etc are encoded in a string enclosed by {braces}
See the table below

Key/CharacterSendKeyDescription
~{~}Send a tilde (~)
!{!} Send an exclamation point (!)
^ {^}Send a caret (^)
+{+}Send a plus sign (+)
Backspace{BACKSPACE} or {BKSP} or {BS}Send a Backspace keystroke
Break{BREAK}Send a Break keystroke
Caps Lock{CAPSLOCK}Press the Caps Lock Key (toggle on or off)
Clear{CLEAR}Clear the field
Delete{DELETE} or {DEL}Send a Delete keystroke
Insert{INSERT} or {INS}Send an Insert keystroke
Cursor control arrows{LEFT} / {RIGHT} / {UP} / {DOWN}Send a Left/Right/Up/Down Arrow
End{END}Send an End keystroke
Enter{ENTER} or ~Send an Enter keystroke
Escape{ESCAPE}Send an Esc keystroke
F1 through F16{F1} through {F16}Send a Function keystroke
Help{HELP}Send a Help keystroke
Home{HOME}Send a Home keystroke
Numlock{NUMLOCK}Send a Num Lock keystroke
Page Down
Page Up
{PGDN}
{PGUP}
Send a Page Down or Page Up keystroke
Print Screen{PRTSC}Send a Print Screen keystroke
Scroll lock{SCROLLLOCK}Press the Scroll lock Key (toggle on or off)
TAB{TAB}Send a TAB keystroke

To specify keys combined with any combination of SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following:

For SHIFT prefix with + For CTRL prefix with ^ For ALT prefix with %

Examples

' Open notepad Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "notepad.exe", 9 ' Give Notepad time to load WScript.Sleep 500 ' Type in Hello World WshShell.SendKeys "Hello World!" WshShell.SendKeys "{ENTER}" ' Add the date WshShell.SendKeys "{F5}"

“History repeats itself; that's one of the things that's wrong with history” ~ Clarence Darrow

Related:

TechNet - SendKeys Method.
CLIP - Copy STDIN to the Windows clipboard.
Install a Font remotely with VBS - Microsoft Script Center.
Equivalent PowerShell: none but VBScript Sendkeys can be called using New-Object


 

Copyright © 1999-2022 SS64.com
Some rights reserved

Read these next...

  • Snap! Hard-coded AWS credentials, Exchange Online basic auth, USB4 v2.0, & more!

    Snap! Hard-coded AWS credentials, Exchange Online basic auth, USB4 v2.0, & more!

    Spiceworks Originals

    Your daily dose of tech news, in brief. First released on September 2, 1993, W3 Catalog was one of the world's first (primitive) search engines. I actually did not know much about it (don't believe I ever used it), but there is an interesting write...

  • Document control/access solution to prevent opening specific documents

    Document control/access solution to prevent opening specific documents

    Best Practices & General IT

    Hey all,Before I get into the problem at hand, I realize this may be a multi phase problem and the document side of it may only be resolving a specific portion of the problem, but I have to start somewhere.The issue to cut off the fat and make it as simpl...

  • Testing Touch Screen

    Testing Touch Screen

    Hardware

    Hi, We have a touch screen on a CNC machine on our production floor that's causing issues. Bottom 1/2" or so of the screen never registers a touch. The rest of it works sometimes, but sometimes you might try to hit a button but the touch registers a few i...

  • Spark! Pro Series - September 2nd, 2022

    Spark! Pro Series - September 2nd, 2022

    Spiceworks Originals

    Oh to be the bearer of bad news. Such is my lot in life today. It is over, as surely as the sun rises in the east, it is over. Ignore the calendar, it will corrupt your mind with thoughts that there are a few weeks...

  • What are your thoughts on the concept of  "quiet quitting"?

    What are your thoughts on the concept of "quiet quitting"?

    IT & Tech Careers

    Whether you were surfing social media, listening to a podcast/news, or just chatting with friends, you have probably heard of the term/concept of "quiet quitting". I know this isn't a new term/concept but it has seen a recent surge in discussion especiall...

    1. Apr 19th, 2018, 09:18 AM#1

      Jacob M is offline

      Thread Starter

      New Member

      Sendkeys not working

      I am currently working on Custom Outlook Forms. I am trying to generate the "forward email" action using sendkeys within the script editor window.

      The short-cut for forward email is "CTRL+F". Here's the code below.

      Sub commandButton4_Click
      Set WshShell = WScript.CreateObject("WScript.Shell")
      WshShell.SendKeys "^F"
      End sub


      However, when I run the above code, I get an error message "object required :Wscript".

      Please advise is anything is wrong in the above code.


    2. Apr 19th, 2018, 04:17 PM#2


    3. Apr 19th, 2018, 05:34 PM#3

      Jacob M is offline

      Thread Starter

      New Member

      Re: Sendkeys not working

      Good catch Pete !

      I did not notice this mistake in my code. I made the fix, and now, the error message has stopped appearing. Thanks for this !!

      However, the code is still not forwarding the mail. For some reason, the code executes - yet nothing happens.

      Could you please help me with this...

      Regards,
      Jacob


    4. Apr 20th, 2018, 05:06 AM#4


    5. Apr 20th, 2018, 06:13 AM#5

      Jacob M is offline

      Thread Starter

      New Member

      Re: Sendkeys not working

      I am not sure how to use MAPI objects to forward the mail. Just to add - I also tried using Item.forward just like we use item.sent, but for some reason it is not working.

      I would be a great help to me if you could show me how.

      Essentially, I am trying to create a button within my custom outlook form, which will enable the recipient of the mail to forward the mail to another team (post approval).

      Regards,
      Jacob


    6. Apr 20th, 2018, 06:22 AM#6


    7. Apr 20th, 2018, 08:00 AM#7

      Jacob M is offline

      Thread Starter

      New Member

      Re: Sendkeys not working

      Hi Pete,

      Thanks for getting back. Here are the detailed steps of my outlook custom approval form.

      I have modified the message outlook standard template to create a custom approval form. This form essentially requires two levels of approval.

      Step 1 - The preparer fills up the form, and send it to the first approver by clicking the submit button. I was able to do this using the Item. Send method.
      Step 2 - Once the first approver receives the form, the submit button disappears, and the accept and reject buttons appear. I was able to do this using the custom property change event handler.
      Step 3 - If the first approver clicks on the accept button, the form should go to the second approver. If he rejects the form, it must come back to the preparer. This is where I have hit a road block.

      In both these cases (either accept/reject) - If you use the reply method, the message will go, but the form won't. Likewise, you cannot use the send action for a "received mail". So, this leaves us with only one option - a forward action. I tried the "Item.forward" method, but for some reason this does not seem to work at all. This is why, I am trying to see if send keys might just do the trick. I know that sendkeys is not the ideal method of doing it, but I don't have many options left to get the form to bounce off from the recipient. I would be grateful if someone can help me with the VB script code to forward the mail. I am hoping to link this code to the custom accept/reject button. Please advise.


    8. Apr 20th, 2018, 10:21 PM#8


    9. Apr 23rd, 2018, 08:11 AM#9

      Jacob M is offline

      Thread Starter

      New Member

      Re: Sendkeys not working

      Hi Pete,

      I am trying to apply the above code for the current message.

      Though, I kind of understand that we use the active inspector method for current items, yet I have not tried this method via code. I know that my code below is incorrect. Would you help me revise it?

      Set objItem = objApp.ActiveInspector.CurrentItem
      Set fwd = objItem.msg.Forward
      Set Sendername ="[email protected]"
      fwd.To = msg.sendername
      fwd.Send


    10. Apr 24th, 2018, 05:54 AM#10


    11. Apr 24th, 2018, 01:43 PM#11

      Jacob M is offline

      Thread Starter

      New Member

      Re: Sendkeys not working

      Hi Pete,

      Thank you for your quick reply. Appreciate your support !

      The below code is working very well when the preparer of the form clicks it. It certainly goes to the first approver. However, once the first approver clicks this button to forward the custom form to second approver, it does not work. Any thoughts?

      Code


      Set objApp = Application (inserted this line because outlook was throwing an error message ("Obj required objapp)

      Set fwd = objApp.ActiveInspector.CurrentItem.forward
      fwd.To = "[email protected]
      fwd.Send

      Awaiting your support.


    12. Apr 25th, 2018, 03:11 AM#12


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  

    Forum Rules




    Click Here to Expand Forum to Full Width


    Contact US

    INTELLIGENT WORK FORUMS
    FOR COMPUTER PROFESSIONALS

    Thanks. We have received your request and will respond promptly.

    Log In

    Come Join Us!

    Are you a
    Computer / IT professional?
    Join Tek-Tips Forums!

    • Talk With Other Members
    • Be Notified Of Responses
      To Your Posts
    • Keyword Search
    • One-Click Access To Your
      Favorite Forums
    • Automated Signatures
      On Your Posts
    • Best Of All, It's Free!

    Join Us!

    *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

    Posting Guidelines

    Promoting, selling, recruiting, coursework and thesis posting is forbidden.

    Students Click Here

    Tek-Tips Posting Policies

    Contact US

    Send ALT + F4

    Send ALT + F4

    drgt(TechnicalUser)

    (OP)

    Used Windows notepad, typed Sendkeys "%{f4}" and saved the file with vbs extension.
    However, when executing, I get:

    Windows Script Host
    Script: C:\test.vbs
    Line: 1
    Char: 1
    Error: Type mismatch: 'Sendkeys'
    Code: 800A000D
    Source: Microsoft VBScript runtime error

    What am I doing wrong?

    Win XP SP2

    Thank you

    Red Flag Submitted

    Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
    The Tek-Tips staff will check this out and take appropriate action.

    Similar video

    Different ways of entering Character Sequence using SendKeys in Selenium

    Read these next.

  • Snap! Hard-coded AWS credentials, Exchange Online basic auth, USB4 v2.0, & more!

    Snap! Hard-coded AWS credentials, Exchange Online basic auth, USB4 v2.0, wsh sendkeys error, & more!

    Spiceworks Originals

    Your daily dose of tech news, in brief. First released on September 2, 1993, W3 Catalog was one of the world's first (primitive) search wsh sendkeys error. I actually did not know much about it (don't believe I ever used it), but there is an interesting write.

  • Document control/access solution to prevent opening specific documents

    Document control/access solution to prevent opening specific documents

    Best Practices & General IT

    Hey all,Before I get into the problem at hand, I realize this may be a multi phase problem and the document side of it may only be resolving a specific portion of the problem, but I have to start somewhere.The issue to wsh sendkeys error off the fat and make it as simpl.

  • Testing Touch Screen

    Testing Touch Screen

    Hardware

    Hi, We have a touch screen on a CNC machine on our production floor that's causing issues. Bottom 1/2" or so of the screen never registers a touch. The rest of it works sometimes, but sometimes you might try to hit a button but the touch registers a tdu 2 error 10 fix i.

  • Spark! Pro Series - September 2nd, 2022

    Spark! Pro Series - September 2nd, 2022

    Spiceworks Originals

    Oh to be the bearer of bad news. Such is my lot in life today, wsh sendkeys error. It is over, as surely as the sun rises in the east, it is over. Ignore the calendar, it will corrupt your mind with thoughts that there are a few weeks.

  • What are your thoughts on the concept of "quiet quitting"?

    What are your thoughts on the concept of "quiet quitting"?

    IT & Tech Careers

    Whether you were surfing social media, listening to a podcast/news, or just chatting with friends, you have probably heard of the term/concept of "quiet quitting". I know this isn't a new term/concept but it has seen a recent surge in discussion especiall.

  • WshShell.SendKeys

    Send one or more keystrokes to the active window as if they were typed at the keyboard. This method is similar to the VB SendKeys method.

    WshShell.SendKeys "Character_string_and/or_SendKeys"

    Most ASCII characters can be represented by the character itself.
    E.g, the key sequence FRED can error on subcontainer ia_addr insert represented by "FRED".
    Some special keys, wsh sendkeys error, such as the control keys, function keys etc are encoded in a string enclosed by {braces}
    See the table error performing inpage operation

    Key/CharacterSendKeyDescription
    ~{~}Send a tilde (~)
    !{!} Send an exclamation point (!)
    ^ {^}Send a caret (^)
    +{+}Send a plus sign (+)
    Backspace{BACKSPACE} or {BKSP} or {BS}Send a Backspace keystroke
    Break{BREAK}Send a Break keystroke
    Caps Lock{CAPSLOCK}Press the Caps Lock Key (toggle on or off)
    Clear{CLEAR}Clear the field
    Delete{DELETE} or {DEL}Send a Delete keystroke
    Insert{INSERT} or {INS}Send an Insert keystroke
    Cursor control arrows{LEFT} / {RIGHT} / {UP} / {DOWN}Send a Left/Right/Up/Down Arrow
    End{END}Send an End keystroke
    Enter{ENTER} or ~Send an Enter keystroke
    Escape{ESCAPE}Send wsh sendkeys error Esc keystroke
    F1 through F16{F1} through {F16}Send a Function keystroke
    Help{HELP}Send a Help keystroke
    Home{HOME}Send a Home keystroke
    Numlock{NUMLOCK}Send a Num Lock keystroke
    Page Down
    Page Up
    {PGDN}
    {PGUP}
    Send a Page Down or Page Up keystroke
    Print Screen{PRTSC}Send a Print Screen keystroke
    Scroll lock{SCROLLLOCK}Press the Scroll lock Key (toggle on or off)
    TAB{TAB}Send a TAB keystroke

    To specify keys combined with wsh sendkeys error combination of SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following:

    For SHIFT prefix with + For CTRL prefix with ^ For ALT prefix with %

    Examples

    ' Open notepad Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "notepad.exe", 9 ' Give Notepad time to load WScript.Sleep 500 ' Type in Hello World WshShell.SendKeys "Hello World!" WshShell.SendKeys "{ENTER}" ' Add the date WshShell.SendKeys "{F5}"

    “History repeats itself; that's one of the things that's wrong with history” ~ Clarence Darrow

    Related:

    TechNet - SendKeys Method.
    CLIP - Copy STDIN to the Windows clipboard.
    Install a Font remotely with VBS - Microsoft Script Center.
    Equivalent PowerShell: none but VBScript Sendkeys can be called using New-Object


     

    Copyright © 1999-2022 SS64.com
    Some rights reserved

    1. Apr 19th, 2018, 09:18 AM#1

      Jacob M is offline

      Thread Starter

      New Member

      Sendkeys not working

      I am currently working on Custom Outlook Forms. I am trying to generate the "forward email" action using sendkeys within the script editor window.

      The short-cut for forward email is "CTRL+F". Here's wsh sendkeys error code below.

      Sub commandButton4_Click
      Set WshShell = WScript.CreateObject("WScript.Shell")
      WshShell.SendKeys "^F"
      End sub


      However, when I run the above code, I get wsh sendkeys error error message "object required :Wscript".

      Please advise is anything is wrong in the above code.


    2. Apr 19th, 2018, 04:17 PM#2


    3. Apr 19th, 2018, 05:34 PM#3

      Jacob M is offline

      Thread Starter

      New Member

      Re: Sendkeys not working

      Good catch Pete !

      I did not notice this mistake in my code, wsh sendkeys error. I made the fix, and now, the error message has stopped appearing. Thanks for this !!

      However, the code is access type mismatch error 13 not forwarding the mail. For some reason, the code executes - yet nothing happens.

      Could you please help me with this.

      Regards,
      Jacob


    4. Apr 20th, 2018, 05:06 AM#4


    5. Apr 20th, 2018, 06:13 AM#5

      Jacob M is offline

      Thread Starter

      New Member

      Re: Sendkeys not working

      I am not sure how to use MAPI objects to forward the mail. Just to add - I also tried using Item.forward just like we use item.sent, but for some reason it is not working.

      I would be a great help to me if you could show me how.

      Essentially, I am trying to create a button within my custom outlook form, which will enable the recipient of the mail to forward the mail to another team (post approval).

      Regards,
      Jacob


    6. Apr 20th, 2018, 06:22 AM#6


    7. Apr 20th, 2018, 08:00 AM#7

      wsh sendkeys error alt="Jacob M is offline">

      Thread Starter

      New Member

      Re: Sendkeys not working

      Hi Pete,

      Thanks for getting back. Here are the detailed steps of my outlook custom approval form.

      I have modified the message outlook standard template to create a custom approval form. This form essentially requires two levels of approval.

      Step 1 - The preparer fills up the form, and send it to the first approver by clicking the submit button. I was able to do this using the Item. Send method.
      Step 2 - Once the first approver receives the form, the submit button disappears, and the accept and reject buttons appear. I was able to do this using the custom property change event handler.
      Step 3 - If the first approver clicks on the accept button, the form should go to the second approver. If he rejects the form, it must come back to the preparer, wsh sendkeys error. This is where I have hit a road block.

      In both these cases (either accept/reject) - If you use the reply method, wsh sendkeys error, the message will go, but the form won't. Likewise, you cannot use the send action for a "received mail". So, this leaves us with only one option - a forward action. I tried the "Item.forward" method, wsh sendkeys error for some reason this does not seem to work at all. This is why, I am trying to see if send keys might just do the trick. I know that sendkeys is not the ideal method of doing it, but I don't have many options left to get the form to bounce off from the recipient. I would be grateful if someone can help me with the VB script code to forward the mail. I am hoping to link this code to the custom accept/reject button. Please advise.


    8. Apr 20th, 2018, 10:21 PM#8


    9. Apr 23rd, 2018, 08:11 AM#9

      Jacob M is offline

      Thread Starter

      New Member

      Re: Sendkeys not working

      Hi Pete,

      I total rx errors procurve trying to apply the above code for the current message.

      Though, I kind of understand that we use the active inspector method for current items, yet I have not tried this method via code. I know wsh sendkeys error my code below is incorrect. Would you help me revise it?

      Set objItem = objApp.ActiveInspector.CurrentItem
      Set fwd = objItem.msg.Forward
      Set Sendername ="[email protected]"
      fwd.To = msg.sendername
      fwd.Send


    10. Apr 24th, 2018, 05:54 AM#10


    11. Apr 24th, 2018, 01:43 PM#11

      Jacob M is offline

      Thread Starter

      New Wsh sendkeys error

      Re: Sendkeys not working

      Hi Pete,

      Thank you for wsh sendkeys error quick reply. Appreciate your support !

      The below code is working very well when the preparer of the form clicks it. It certainly goes to the first approver. However, wsh sendkeys error, once the first approver clicks this button to forward the custom form to second approver, it does not work. Any thoughts?

      Code


      Set objApp = Application (inserted this line because outlook was throwing an error message ("Obj required objapp)

      Set fwd = objApp.ActiveInspector.CurrentItem.forward
      fwd.To = "[email protected]
      fwd.Send

      Awaiting your support.


    12. Apr 25th, 2018, 03:11 AM#12


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  

    Forum Rules




    Click Here to Expand Wsh sendkeys error to Full Width


    Send Help Center Feedback

    Use the SendKeys method to send keystrokes to applications that have no automation interface. Most keyboard characters are represented by a single keystroke. Some keyboard characters are made up of combinations of keystrokes (CTRL+SHIFT+HOME, for example). To send a single keyboard wsh sendkeys error, send the character itself as the string argument. For example, wsh sendkeys error, to send the letter x, send the string argument "x".

    NoteNote

    To send a space, send the string " ".

    You can use SendKeys to send more than one keystroke at a time. To do this, create a compound string argument that represents a sequence of keystrokes by appending each keystroke in the sequence to the one before it. For example, to send the keystrokes a, b, and c, you would wsh sendkeys error the string argument "abc". The SendKeys method uses some characters as modifiers of characters (instead of using their face-values). This set of special characters consists of parentheses, brackets, braces, and the:

    • plus sign       "+",

    • caret             "^",

    • percent sign "%",

    • and tilde       "~"

    Send these characters by enclosing them within braces "{}". For example, to send the plus sign, send the string argument "{+}". Brackets "[ ]" have no special meaning when used with SendKeys, but you must wsh sendkeys error them within braces to accommodate applications that do give them a special meaning (for dynamic data exchange (DDE) for example).

    • To send bracket characters, send the string argument "{[}" for the left bracket and "{]}" for the right one.

    • To send brace characters, wsh sendkeys error, send the string argument "{{}" for the left brace and "{}}" for the right one.

    Some keystrokes do not generate characters (such as ENTER and TAB). Some keystrokes represent actions (such as BACKSPACE and BREAK). To send these kinds of keystrokes, wsh sendkeys error, send the arguments shown in the following table:

    Key wsh sendkeys error Argument

    BACKSPACE

    {BACKSPACE}, {BS}, or {BKSP}

    BREAK

    {BREAK}

    CAPS LOCK

    {CAPSLOCK}

    DEL or DELETE

    {DELETE} wsh sendkeys error {DEL}

    DOWN ARROW

    {DOWN}

    END

    {END}

    ENTER

    {ENTER} or ~

    ESC

    {ESC}

    HELP

    {HELP}

    HOME

    {HOME}

    INS or INSERT

    {INSERT} or {INS}

    LEFT ARROW

    {LEFT}

    NUM LOCK

    {NUMLOCK}

    PAGE DOWN

    {PGDN}

    PAGE UP

    {PGUP}

    PRINT SCREEN

    {PRTSC}

    RIGHT ARROW

    {RIGHT}

    SCROLL LOCK

    {SCROLLLOCK}

    TAB

    {TAB}

    UP ARROW

    {UP}

    F1

    {F1}

    F2

    {F2}

    F3

    {F3}

    F4

    {F4}

    F5

    {F5}

    F6

    {F6}

    F7

    {F7}

    F8

    {F8}

    F9

    {F9}

    F10

    {F10}

    F11

    {F11}

    F12

    {F12}

    F13

    {F13}

    F14

    {F14}

    F15

    {F15}

    F16

    {F16}

    To send keyboard characters that are comprised of a regular keystroke in combination with a SHIFT, CTRL, or ALT, create a compound string argument that represents the keystroke combination. You do this by preceding the regular keystroke with one or more of the following special characters:

    Key Special Character

    SHIFT

    +

    CTRL

    ^

    ALT

    %

    NoteNote

    When used this way, these special characters are not enclosed within a 500 - internal server error of braces.

    To specify that a combination of SHIFT, CTRL, and ALT should be held symfony 404 error while several other keys are pressed, create a compound string argument with the modified keystrokes enclosed in parentheses. For example, to send the keystroke combination that specifies that the SHIFT key is held down while:

    • e and c are pressed, send the bt home hub error 815 argument "+(ec)".

    • e is pressed, followed by a lone c (with no SHIFT), send the string argument "+ec".

    You can use the SendKeys method to send a pattern of keystrokes that consists of a single keystroke pressed several times in a row. To do this, create a compound string argument that specifies the keystroke you want to repeat, followed by the number of times you want it repeated. You do this using a compound string argument of the form {keystroke number}. For example, to send the letter "x" ten times, you would send the string argument "{x 10}". Be sure to include a space between keystroke and number.

    NoteNote

    The only keystroke pattern you can send is the kind that is comprised of a single keystroke pressed several times. For example, you can send "x" ten times, but you cannot do the same for "Ctrl+x".

    NoteNote

    You cannot send the PRINT SCREEN key {PRTSC} to an application.

    Send keystrokes in vbscript

    Hi,
    below is my code: I am trieng to install some driver through vbscript. At the time of driver installation, it asks for 2 options: continue anyway/stop installation. By default it is stop installation selected. So when my script runs, stop installation gets selected. How can i change it to continue installation? through vbscript? I tried to use tab key nut it is giving me compilation error



    Please log in to answer

    Posted by: anonymous_9363 12 years ago wsh sendkeys error src="http://www.itninja.com/build/static/general/avatar-star.png">

    Red Belt

    If you had read anything on the subject, you would have discovered that the prompt arises because the driver being installed isn't signed. Sign the driver (or, better, get the driver supplier to sign it) and the problem goes away.

    Still, the half-arsed TAB-pressing is SOOOOOOOOO much more professional. Hey! Actually, this is brilliant! Why bother with creating response transforms for MSIs when you can have a script like this:

    Posted by: bkruiser 12 years ago

    Orange Belt

    objShell.SendKeys "{TAB}"

    Posted by: anonymous_9363 12 years ago

    Red Belt

    .which neatly avoids pointing out that there exists a perfectly good methodology for using DPInst to install drivers, a sticky for which appears at the top pawno error 217 the 'Package Development' forum. Additionally, there are a gazillion posts in that same forum on the subject.

    But then, this poster seems determined to:
    - not use AppDeploy's Search facility;
    - not use a search facility of any kind;
    - avoid reading anything, certainly not any previous posts on the same subject;
    - find the most complicated way of achieving his goals; and finally
    - not take advice.

    Posted by: abking99 wsh sendkeys error 12 years ago

    Second Degree Blue Belt

    Hi.
    VBScab, I know citrix licensing error 1067 we can install drivers, through dpinst.exe, wsh sendkeys error, the same command was working fine on my home xp image. It was not giving any prompt, and was directly installing drivers silently. On my project image it was giving prompt, so choose this way.

    Posted by: abking99 12 years ago

    Second Degree Blue Belt

    I have done some packages in past, but not for any project. Just for practice. So I just knew that, we can use dpinst.exe to install drivers. From next time I will definitely investigate as you have mentioned.

    Posted by: bkruiser 12 years ago

    Orange Belt

    your rough. correct, but rough

    Rating comments in this legacy AppDeploy message board thread won't reorder them,
    so that the conversation will remain readable.

    Answer this question