2

I am trying to automate the Windows Task Scheduler using Ruby.

I am using Ruby 1.8 under Windows Vista.

The RegisterTaskDefintion method of the TaskFolder object takes two VARIANT parameters for the username and password. Any attempt to pass a string into these parameters results in a 'method_missing' exception:

This does not work:

rootFolder.RegisterTaskDefinition("Task", newTask, TASK_CREATE_OR_UPDATE, 'user', 'password', TASK_LOGON_PASSWORD,  nil)

This works:

rootFolder.RegisterTaskDefinition("Task", newTask, TASK_CREATE_OR_UPDATE, '', '', TASK_LOGON_NONE,  nil)

Any ideas?

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
bvanderw
  • 1,065
  • 2
  • 12
  • 20

1 Answers1

0

Just create a VARIANT?

WIN32OLE_VARIANT.new("Blah", VT_BSTR)
Matt Davison
  • 1,544
  • 10
  • 11