Author Topic: CMDACTION - Subcommand  (Read 3451 times)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
CMDACTION - Subcommand
« on: June 06, 2017, 11:05:07 AM »
Would it be possible to add an output to {CMDACTION} when the currently executing command was called as a subcommand? The current functionality seems to return the command action for the root command. Let's use 2 commands as an example:

Command: Test1, executed by pressing "Enter" key
Code: [Select]
Begin Text Compare : [{CMDISSUBCOMMAND}] Equals '1'
    Write '[Blue] Test1 Type = Subcommand' to log
Else
    Write '[Blue] Test1 Type = Not a Subcommand' to log
End Condition
Write '[Blue] Test1 Action = {CMDACTION}' to log
Execute command, 'Test2' (and wait until it completes)

Command: Test2
Code: [Select]
Begin Text Compare : [{CMDISSUBCOMMAND}] Equals '1'
    Write '[Blue] Test2 Type = Subcommand' to log
Else
    Write '[Blue] Test2 Type = Not a Subcommand' to log
End Condition
Write '[Blue] Test2 Action = {CMDACTION}' to log

After pressing "Enter" the current functionality yields:
Quote
Test1 Type = Not a Subcommand
Test1 Action = Keyboard
Test2 Type = Subcommand
Test2 Action = Keyboard

The desired functionality would yield:
Quote
Test1 Type = Not a Subcommand
Test1 Action = Keyboard
Test2 Type = Subcommand
Test2 Action = Subcommand (or some other designation)

I suppose this type of output could be currently accomplished by:
Code: [Select]
Begin Text Compare : [{CMDISSUBCOMMAND}] Equals '1'
    Write '[Blue] Command Action = Subcommand' to log
Else
    Write '[Blue] Command Action = {CMDACTION}' to log
End Condition

...but I feel like a 'Subcommand' (or similar) output for {CMDACTION} would be in keeping with the definition of the token: "The method by which the current command was executed." Thanks!

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: CMDACTION - Subcommand
« Reply #1 on: June 06, 2017, 11:34:51 AM »
We still need to be able to retrieve the method by which the root command was executed, so the action is conveyed all the way down the chain.  It's a reason '{CMDISSUBCOMMAND}' even exists.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: CMDACTION - Subcommand
« Reply #2 on: June 06, 2017, 12:49:12 PM »
Okay it seems that {CMDACTION} focuses around the root command as opposed to the "current command being executed" (which may or may not be the root command). I'd like to suggest that the Help Document's definition of {CMDACTION} be updated to reflect this.

Maybe something like:
Quote
"The method by which the current root command was executed."

Again, just a suggestion ;)