Author Topic: [v1.8.3.6] "Execute by name (Advanced)" not checking "When I say" for changes  (Read 1539 times)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
When a command is duplicated, and an "Execute Another Command" action is added or edited in the duplicated command , attempting to enter the name of the original command into the "Execute by name (Advanced)" field will show an "Unable to Use Command" dialog that states "Executing with a reference to the containing command is not supported. Please enter another command name.", even if the "When I say" field was already altered.

This actually occurs when adding or editing any command and attempting to save the "Execute Another Command" action when using the "Execute by name (Advanced)" option with the command's original name (E.G. when adding a command, attempting to use the generated "New Command" name), but it is most likely to be noticed when duplicating (E.G. duplicating "My Command" to create "My Command and some additional actions" which would call the original).


If this is changed so the contents of the "When I say" field are checked for duplicates (thus requiring command phrases to be parsed) when the "OK" button on the action is clicked, it would also necessitate checking of any "Execute Another Command" actions in the command when the "OK" button on the "Add/Edit/Duplicate a Command" window is clicked, just in case the contents of "When I say" have been changed in a manner that would cause a circular reference (if the same protection that is currently in place for this advanced option is to be maintained).


This goes back to v1.5.7, in which "Execute by name (Advanced)" was added (though back then duplicating a command would still append a number).


EDIT: Addressed in v1.8.3.8
« Last Edit: January 22, 2020, 07:09:48 PM by Pfeil »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Thanks again for the great detail.  This should be working in the next release.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
In v1.8.3.7, if the phrase entered into the "Execute by name (Advanced)" matches the existing command name when editing a command (not when the command is initially added) that has not yet been saved to the profile, this exception is thrown:
Code: [Select]
System.NullReferenceException: Object reference not set to an instance of an object.
   at VoiceAttack.OtherStuff.frmExecuteCommand.(Object , EventArgs )
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at Telerik.WinControls.RadControl.OnClick(EventArgs e)
   at Telerik.WinControls.UI.RadButtonBase.buttonElement_Click(Object sender, EventArgs e)
   at Telerik.WinControls.RadElement.OnClick(EventArgs e)
   at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e)
   at Telerik.WinControls.UI.RadButtonElement.OnClick(EventArgs e)
   at Telerik.WinControls.RadElement.DoClick(EventArgs e)
   at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)
   at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
   at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

E.G.
Start adding a new command, E.G. "New Command"
Add an "Execute Another Command" action and set the "Execute by name (Advanced)" to the name of the command, click OK to add it to the action list
Click "OK" to add the command to the profile, without saving the changes to the database
Edit the command
Open the "Execute Another Command" action and click "OK", the exception is thrown

If the action was not added initially, but only when editing the command afterward, the exception is still thrown. Just wanted to demonstrate that the issue does not occur when initially adding the command.

As soon as the profile is saved to the database (using "Apply" or "Done"), the action can be edited/added without an exception.



If the "When I say" field is modified, then without clicking "OK" to close the "Edit a Command" window the "Execute Another Command" action's "Execute by name (Advanced)" field is set to that value, clicking "OK" will add/modify the action without any warning dialogs, and the command can be saved with the action referencing the command recursively.

Luckily there is a built-in safeguard on execution that will prevent an actual recursive loop:
"UNABLE TO EXECUTE COMMAND, 'New Command' (by name), SINCE IT IS THE SAME AS THE CALLING COMMAND."

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
This has been addressed in the current beta (v1.8.3.8)

Thanks for the heads-up, Pfeil!