web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

WshShell.SendKey command for ALT+TAB

(0) ShareShare
ReportReport
Posted on by 1,305

I've used SendKey quite a bit, but can't figure out how to send Alt + Tab (Windows change screen combination)

 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,977 Super User 2025 Season 2 on at
    RE: WshShell.SendKey command for ALT+TAB

    Try below Code

    IF ISCLEAR(WSHShell) THEN

     CREATE(WSHShell);

    WSHShell.SendKeys('%{Tab}');

  • Dan Eckhoff Profile Picture
    1,305 on at
    RE: WshShell.SendKey command for ALT+TAB

    Thanks for the reply, Mohana, but it's not doing what I need it to.  I'm not sure whether the combination is wrong or there's something else involved.

    We created a sub-card for the sales quote subform(strange, I know, but we have reasons).  When I change the quantity field value on the sub-card it switched the windows focus to the Sales Quotes Card or subform .  (Alt+Tab) takes us back to the sub-card.  We could run the sub card modally which will prevent the behavior, but the customer wants to be able to flip around the product while having the sub-card open.  

    My thought was to use SendKey to buffer the (Alt+Tab) in the Quantity onValidate in the sub-card.  It's either clearing the buffer when the other page gets focus or ('%{Tab}') isn't the right combination.

    Any ideas are appreciated.

  • Suggested answer
    Mohana Yadav Profile Picture
    60,977 Super User 2025 Season 2 on at
    RE: WshShell.SendKey command for ALT+TAB

    As you said your case is different.

    but I am sure that combinations are correct and they are working fine.

    I have to spend some time to create your scenario.

    Is manual Alt+Tab working as you expected?

    What is happening with the below code?

    Where is the cursor moving from new sub-card to?

  • Dan Eckhoff Profile Picture
    1,305 on at
    RE: WshShell.SendKey command for ALT+TAB

    Manual Alt+Tab works fine.  There is no effect from the code you sent which is why I'm thinking that the keyboard buffer is getting cleared when the Quote page gets focus. The cursor will move back to whatever field was last in focus when either page was active.  

    I created the subcard by first copying the quote subform(page 95) and then changing it to a card.  I call it with an event I added to page 95 which uses Page.RUN(PageNo, SalesLineRef)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Alexander Ermakov Profile Picture

Alexander Ermakov 2

#2
SC666 Profile Picture

SC666 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans