Jump to content

Programmers invitation


Recommended Posts

The Task schedule seems very hard to do.

You have to create the task then delete the task to recreate the task

to do what you want. This is my understanding on what I have read about it.

Martin would it not be better to start the script as soon as some one logs on.

Then you could leave it in a loop that does not end.

This loop would keep going because there is no -1

Dim Inta : Inta = 1-1

Do

Inta = Inta + 1

'''' Your Action Here

wscript.sleep 60000

Loop Until Inta = -1

The share folder I have no way of testing that.

Link to comment
Share on other sites


2Dman: No prob, this is hobby project :)

2GSM: Nope, that is not good :( The problem is any error during script will block whole execution, whether batch services are independent on each other + you can create threaded execution...

If it is really big problem, I could write it in .NET...

Link to comment
Share on other sites

It is kinda of a problem in vbs because as I understand it you must

create the task then delete the task. You would have to do this for

each task.

The loop you could add I believe a way to handle errors

On Error Resume Next
Here is a example of what I mean
Dim Act, Fso, SD, Test

Set Fso = CreateObject("Scripting.FileSystemObject")

Set Act = CreateObject("Wscript.shell")

SD = Act.ExpandEnvironmentStrings("%systemdrive%")

Test = Array("\Test5","\Test4","\Test3","\Test2")

For Each StrTest In Test

Fso.CreateFolder(SD & StrTest)

Next

Act.Run(SD)

MsgBox "Part One Of The Test Completed"

On Error Resume Next

Fso.DeleteFolder(SD &"\Test1")

Fso.DeleteFolder(SD &"\Test2")

Fso.DeleteFolder(SD &"\Test3")

Fso.DeleteFolder(SD &"\Test4")

Fso.DeleteFolder(SD &"\Test5")

Here Is Another Example

Dim Act, Fso, SD, RunTest

Set Fso = CreateObject("Scripting.FileSystemObject")

Set Act = CreateObject("Wscript.Shell")

SD = Act.ExpandEnvironmentStrings("%systemdrive%")

RunTest = Array(_

SD & "\Windows\Notepad.exe",SD & "\Windows\SmokePad.exe",_

SD & "\Windows\System32\Mspaint.exe",SD & "\Windows\System32\Martin.exe")

For Each StrRunTest In RunTest

If Fso.FileExists(StrRunTest) Then

Act.Run(StrRunTest),1,True

Act.Popup "Completed The Test" & vbCrLf & strRunTest, 5, "Completed", 0 + 32

Else

Act.Popup "Error In The Test" & vbCrLf & strRunTest, 5, "Error", 0 + 32

End If

Next

Link to comment
Share on other sites

Hmmm, I can see the problem :(

The Win32_ScheduledJob class doesnt support that kind of job I would like to see :(

Looks like we will need to find some workaround...

Dman, what do you think, could you create it using C++? I would like to use as less as possible of .NET, because it require runtime :(

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...