Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


polomint82
2009-09-10T15:41:25Z
The API documentation is extremely thin on example code. How does the TaskExecuteClass relate to JobClass?

I would like to generate the Task -> Arguments dynamically when calling into the Run method of a Job that contains just one Task. It's near impossible to reverse engineer the class hierachy without some sample code.

Sponsor
Forum information
Support
2009-09-10T22:46:47Z
I agree, that needs more documentation.

Basically, a Job can contain one or more Tasks. If you look at the Job property Tasks it is a List<TaskClass>. But when using the API you don't have to care about this.

This example is taken from the TestClient in the API folder:

            // create JobClass
            JobClass j = new JobClass();
            // set name of Job
            j.Name =  "ExecuteJob";
            // add description to Job
            j.Description = "Job that performs an Execute";

            // create task
            TaskClass tc = j.AddTask(TaskClass.TaskT.Execute);
            // set name of Task
            tc.Name = "Runs notepad.exe";

            // set Execute settings of task
            // set path to executable
            tc.Execute.CmdLine = @"c:\windows\notepad.exe";
            // set arguments
            tc.Execute.Arguments = string.Empty;
            // set working directory
            tc.Execute.WorkingDirectory = string.Empty;

            // send Job to Server
            s.Jobs.Add(j);



Do you want to execute locally or remotely?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top