Closed joverton33 closed 3 years ago
Can you tell me the type of Action it is and which fields are set (or send image)? I have added more detailed error handling than the system app and you may be missing information on the form. For example, the "Start a program" action (ExecAction
) cannot validate if the path specified does not exist and the "Email" action will not validate if the Subject, From, To or Text fields are empty.
It is “Start Program”. I created the Action using:
// Add an action that will launch V3 whenever the trigger fires string fName = useUNCFilename ? PathHelper.GetUNCPath(currDoc.FullName) : currDoc.FullName; this.RegTask.Definition.Actions.Add(new ExecAction( string.Format("\"{0}\"", currDoc.MasterController.ExeName), string.Format("-b \"{0}\"{1}{2}", fName, string.IsNullOrWhiteSpace(theJobParm.ConnectionName) ? string.Format(" \"{0}\"", theJobParm.ConnectionName) : string.Empty), theJobParm.IsDefaultScheduleTask && !string.IsNullOrWhiteSpace(theJobParm.Name) ? string.Format(" \"{0}\"", theJobParm.Name) : string.Empty)), null));
I just noticed that I can add a New Action from the Edit Dialog, and if I do that, I can Edit the New Action, but I still cannot edit the action that I added programmatically.
I should have added, the Action that I create executes correctly.
Based on the value of string.Format("\"{0}\"", currDoc.MasterController.ExeName)
, would it pass or fail the validation code here?
If it fails, please point out the line(s) of code where it fails so I can correct them.
David,
It’s failing here: var fn = System.IO.Path.GetFileName(path); With “Illegal characters in Path.”
I am wrapping the EXE name in quote characters which I thought was necessary in case there was a blank char in the path name.
If I remove the quote marks, IsValidPath validates ok AND the problem with editing the action goes away.
Should I not be using the quote chars?
Thanks,
John
Yes, the surrounding quotes are extraneous since this is submitted as a path and not as a command line. I thought to make my validator allow for quotes, but it just causes extra work when the system just calls ShellExecuteEx
and would have to strip them anyways.
I will remove the quotes. Thank you. BTW, your response time is awesome, I did not expect to hear back from you so fast:)
Not sure if this is a bug or if I am doing something wrong...
After creating a Task with a single Action, I call:
using (TaskEditDialog dlgEditTask = new TaskEditDialog(currTask.RegTask, true, true))
I am able to Edit the Task and Add Triggers, however, If I try to Edit the Action, the Edit Action dialog opens and allows me to make changes, but the OK button does not light up (it remains gray) so I cannot save my changes.
I can edit the action fine if I open the task directly in the Task Scheduler.
I just updated to 2.9.1 and I am seeing the same behavior.
Thanks,
John