Sha256: 08b32f6420f86a71b3943ada961dd47f5d77efe15ba53ed60c6331aa113819d3

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

#######################################################################
# taskscheduler_example.rb
#
# A test script for general futzing. You can run this example via the
# 'example' rake task.
#
# Modify as you see fit.
#######################################################################
require "win32/taskscheduler"
require "fileutils"
require "pp"
include Win32

puts "VERSION: " + TaskScheduler::VERSION

ts = TaskScheduler.new

trigger = {
  start_year: 2009,
  start_month: 4,
  start_day: 11,
  start_hour: 7,
  start_minute: 14,
  trigger_type: TaskScheduler::DAILY,
  type: { "days_interval" => 1 }
}

unless ts.enum.grep(/foo/).length > 0
  ts.new_work_item("foo", trigger)
  ts.application_name = "notepad.exe"
  puts "Task Added"
end

ts.activate("foo")
ts.priority = TaskScheduler::IDLE
ts.working_directory = "C:\\"

puts "App name: " + ts.application_name
puts "Creator: " + ts.creator
puts "Exit code: " + ts.exit_code.to_s
puts "Max run time: " + ts.max_run_time.to_s
puts "Next run time: " + ts.next_run_time.to_s
puts "Parameters: " + ts.parameters
puts "Priority: " + ts.priority.to_s
puts "Status: " + ts.status
puts "Trigger count: " + ts.trigger_count.to_s
puts "Trigger string: " + ts.trigger_string(0)
puts "Working directory: " + ts.working_directory
puts "Trigger: "

pp ts.trigger(0)

ts.delete("foo")
puts "Task deleted"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
win32-taskscheduler-2.0.1 examples/taskscheduler_example.rb
win32-taskscheduler-2.0.0 examples/taskscheduler_example.rb
win32-taskscheduler-1.0.12 examples/taskscheduler_example.rb