rosado
asked on
How to Show Pictures with Vbscript?
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?
Thanks!
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?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
HTH
HTH
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.Fi leSystemOb ject")
' create textfile
Set fil = fso.CreateTextFile("C:\Fla gfile.vin" )
set wShell = CreateObject("Wscript.Shel l")
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
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.Fi
' create textfile
Set fil = fso.CreateTextFile("C:\Fla
set wShell = CreateObject("Wscript.Shel
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
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.
ASKER
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!