Compare commits

..

4 Commits

2 changed files with 18 additions and 9 deletions

View File

@ -13,7 +13,7 @@
## `Use`
```powershell
./vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-c] [-m] [-s] <api commands>
.\vmrcli.exe [-h] [-i] [-k] [-D] [-v] [-c] [-m] [-s] <api commands>
```
Where:
@ -38,13 +38,13 @@ Examples:
Launch basic GUI, set log level to INFO, Toggle Strip 0 Mute, print its new value, then decrease Bus 0 Gain by 3.8
```powershell
./vmrcli.exe -kbasic -D2 !strip[0].mute strip[0].mute bus[0].gain-=3.8
.\vmrcli.exe -kbasic -D2 !strip[0].mute strip[0].mute bus[0].gain-=3.8
```
Launch banana GUI, set log level to DEBUG, set Strip 0 label to podmic then print Strip 2 label
```powershell
./vmrcli.exe -kbanana -D1 strip[0].label=podmic strip[2].label
.\vmrcli.exe -kbanana -D1 strip[0].label=podmic strip[2].label
```
## `Interactive Mode`
@ -52,7 +52,7 @@ Launch banana GUI, set log level to DEBUG, set Strip 0 label to podmic then prin
Running the following command in Powershell:
```powershell
./vmrcli.exe -i
.\vmrcli.exe -i
```
Will open an interactive prompt:
@ -69,7 +69,13 @@ API commands follow the same rules as listed above. Entering `Q` or `q` will exi
Scripts can be loaded from text files, for example in Powershell:
```powershell
./vmrcli.exe -D1 $(Get-Content .\example_commands.txt)
.\vmrcli.exe -D1 $(Get-Content .\example_commands.txt)
```
You may also pipe a scripts contents to the CLI:
```powershell
$(Get-Content .\example_commands.txt) | .\vmrcli.exe -D1 -i
```
Multiple API commands can be in a single line but they should be space separated.

View File

@ -15,6 +15,7 @@
#include <getopt.h>
#include <string.h>
#include <ctype.h>
#include <windows.h>
#include "ivmr.h"
#include "wrapper.h"
#include "log.h"
@ -146,6 +147,8 @@ int main(int argc, char *argv[])
{
log_info("Profile %s loaded", cvalue);
set_parameter_string(vmr, "command.load", cvalue);
Sleep(300);
clear_dirty(vmr);
}
if (iflag)
@ -243,13 +246,12 @@ void interactive(PT_VMR vmr)
while (fgets(input, MAX_LINE, stdin) != NULL)
{
input[strcspn(input, "\n")] = 0;
len = strlen(input);
if (len == 1 && toupper(input[0]) == 'Q')
if ((len = strlen(input)) == 1 && toupper(input[0]) == 'Q')
break;
parse_input(vmr, input, len);
memset(input, '\0', MAX_LINE); /* reset input buffer */
memset(input, 0, MAX_LINE); /* reset input buffer */
printf(">> ");
}
}
@ -328,6 +330,7 @@ void parse_command(PT_VMR vmr, char *command)
printf("%s: %.1f\n", command, res.val.f);
break;
case STRING_T:
if (res.val.s[0] != '\0')
printf("%s: %ls\n", command, res.val.s);
break;
default: