PuNiC4 Posted May 29, 2006 Posted May 29, 2006 (edited) Hello @ allI created a Script that start some Programms after a while when the PC is running.But because im a newbi in Programming there are some mistakes in the Code plz help me.Option ExpicitDim objshellDim intwartenintwarten = 15000WScript.sleep intwartenset objshell = Wscript.CreateObject(>>WScript.shell<<)objshell.Exec(>>C:\...<<) Edited May 29, 2006 by PuNiC4
gunsmokingman Posted May 29, 2006 Posted May 29, 2006 Hello @ allI created a Script that start some Programms after a while when the PC is running.But because im a newbi in Programming there are some mistakes in the Code plz help me.Option ExpicitDim objshellDim intwartenintwarten = 15000WScript.sleep intwartenset objshell = Wscript.CreateObject(>>WScript.shell<<)objshell.Exec(>>C:\...<<)1:\ You had Option Explicit spelled wrong2:\ You can not have this (>>C:\...<<) 3:\ You can not have this Wscript.CreateObject(>>WScript.shell<<)Try this it count down the seconds left before C:\ opensOption Explicit Dim i, Cnt : Cnt = 15 Dim Act : Set Act = CreateObject("Wscript.Shell") For i = 1 To 15 Act.Popup "There is, " & Cnt -i & " seconds left before C:\ opens", 1, "Count Down", 0 + 32 Next Act.Run("C:\")This sleeps for 15 seconds before C:\ opensOption Explicit Dim Act : Set Act = CreateObject("Wscript.Shell") WScript.Sleep 15000 : Act.Run("C:\")Or if you want only 1 line of codeOption Explicit : WScript.Sleep 15000 : CreateObject("Wscript.Shell").Run("C:\")
PuNiC4 Posted May 30, 2006 Author Posted May 30, 2006 (edited) After a while nobody answeriong my question.I started to write a new code.And this was the result.Dim WshShell, oExec, intwartenintwarten = 15000WScript.Sleep intwartenSet WshShell = CreateObject("WScript.Shell")Set oExec = WshShell.Exec("C:\Datei.exe")And it works Edited May 30, 2006 by PuNiC4
gunsmokingman Posted May 30, 2006 Posted May 30, 2006 1:\ You do not have to have this intwarten = 15000it a wasted line.2:\ Here is another waste of a line Set oExec = WshShell.Exec("C:\Datei.exe") I left 3 correct ways of doing your script but I gues it was to complex for you to understand.This is the most efficent way of doing it.Option Explicit : WScript.Sleep 15000 : CreateObject("Wscript.Shell").Run("C:\") One single line of code is all you need.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now