[Last Call] Learn how to a build a cloud-first strategyRegister Now


How to Show Pictures with Vbscript?

Posted on 2006-04-07
Medium Priority
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
  • 3

Accepted Solution

dds110 earned 1000 total points
ID: 16402977
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

ID: 16404056

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 wshshell.run  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!

Expert Comment

ID: 16404108
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

ID: 16404215
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:\Flagfile.vin") = "" 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:\Flagfile.vin")

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:\Flagfile.vin"

set fso = Nothing
Set wShell = Nothing


Expert Comment

ID: 16404225
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.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month17 days, 16 hours left to enroll

830 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