How to Show Pictures with Vbscript?

Posted on 2006-04-07
Last Modified: 2008-05-05
Hi All,

Not sure if this is the right place but it was the closest I got to vbscript...

I need something very simple... I am writing a logonscript  in vbscript to run in my windows environment and would like to have a .gif picture on the screen while the script runs...

I was, however, not able to find any way to show a picture (file) on the screen with vbscript...

Any hint?

Question by:rosado
    LVL 8

    Accepted Solution

    despite its name, there is nothing visual about vbscript (other than input boxes and msg boxes).  your best bet would to create a simple exe to display the image and load that while your script runs.  If you don't have access to vb, you could always do it in java.

    Let me know if you need help.

    Author Comment


    Thanks a lot for your reply, actually thats what was working on. I am using a visual basic component called angif which works pretty fine. I did a vb project which just opens the gif and compiled to prodruce an exe file. I call that file with a  and it works quite fine.

    The only problem is that the form stays on the screen after the script finishes... any idea of how can I close an exe from a vbscript?

    Thansk again!
    LVL 8

    Expert Comment

    I'm not sure if wshshell can handle it or not, but if you use automation directly from vbscript, you can most likely use the .Quit method on your application.

    LVL 28

    Expert Comment

    Not sure if this is something you want to try,but as a workaround you could create a textfile in your vbscript before calling the exe. Then have the exe unload itself when it detects that the script has deleted the file.

    For example,in your exe add a timer to your form and add the following:

    Private Sub Form_Load()
    Timer1.Interval = 1000
    End Sub

    Private Sub Timer1_Timer()
    If Dir("C:\") = "" Then  
       ' file is gone, so shutdown
        Timer1.Enabled = False
        Unload Me
    End If
    End Sub

    Then in your script:

    Dim wShell,fso,fil

    Set fso = CreateObject("Scripting.FileSystemObject")
    ' create textfile
    Set fil = fso.CreateTextFile("C:\")

    set wShell = CreateObject("Wscript.Shell")
    wShell.Run "C:\Project1.exe",1

    ' do stuff here

    set fil = nothing

    ' delete text file. When exe detects textfile is gone it will shutdown
    fso.DeleteFile "C:\"

    set fso = Nothing
    Set wShell = Nothing

    LVL 8

    Expert Comment

    vinnyd79's got a great idea.  Wish I could be more helpful but I don't have VB at work where I can run my own tests.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction This article makes the case for using two modules in your VBA/VB6 applications to provide both case-sensitive and case-insensitive text comparison operations.  Recently, I solved an EE question using the LIKE function.  In order for th…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    759 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

    10 Experts available now in Live!

    Get 1:1 Help Now