CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2019
    Posts
    4

    How do I minimize a window in VBScript

    Hello,


    I am not a programmer but I find a VBScript file which it works to play a mp3 , and now when the mp3 file play the windows media player or other windows player like VLC, it popups , my question is how to minimize the windows media player directly or without see it when it plays the mp3, which command do I need to add thank you


    this is the VBScript I use which it works to play the a mp3 file

    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "d:\Image\Cabin\AFTER_LANDING.mp3"
    Wscript.Sleep 500
    WshShell.SendKeys "^a"
    Wscript.Sleep 500
    WshShell.SendKeys "{ENTER}"

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: How do I minimize a window in VBScript

    Add a 0 as a second parameter. See https://www.vbsedit.com/html/6f28899...640b0e32ea.asp

  3. #3
    Join Date
    Jul 2019
    Posts
    4

    Re: How do I minimize a window in VBScript

    Thanks Arjay for your respond, as I mentioned that I do not know much about this, can you give me an example how to add the parameter a 0 in this script thanks.

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: How do I minimize a window in VBScript

    Code:
    WshShell.Run ("d:\Image\Cabin\AFTER_LANDING.mp3", 0)
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    Jul 2019
    Posts
    4

    Re: How do I minimize a window in VBScript

    Thanks also 2kaud

    I did as your example but I got an error


    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run ("c:\Temp\Cabin\FSL_A320X_CABIN_PA_AFTER_LANDING.mp3", 0)
    Wscript.Sleep 500
    WshShell.SendKeys "^a"
    Wscript.Sleep 500
    WshShell.SendKeys "{ENTER}"


    this the error I gotName:  zzzzzzzzzzzzz.JPG
Views: 384
Size:  19.5 KB

  6. #6
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: How do I minimize a window in VBScript

    Try
    Code:
    WshShell.Run "d:\Image\Cabin\AFTER_LANDING.mp3", 0
    Sorry, but my VBscript is rusty - I usually program in c++ which requires the ()
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  7. #7
    Join Date
    Jul 2019
    Posts
    4

    Re: How do I minimize a window in VBScript

    Okay no problem, maybe someone else know how ;-)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured