Skip to content

Commit

Permalink
#44 - CLI helper / personal assistant on command prompt
Browse files Browse the repository at this point in the history
Commit for windows batch file. For main commit for php helper and
macos/linux see -
tebelorg@3e3f924
015a14502

The TagUI scripts are already in natural-language-like syntax to
convert to JS code. I want to have a helper that can convert
natural-language-like instructions on the command line to call the
right scripts with right parameters.

Instead of typing tagui download_bank_report june on command prompt, I
think it is more intuitive to support typing erina download my june
bank report or something like that directly on command prompt. And let
the magic happens behind the scenes to return the results.

running this -
erina 5w1h/verb fillers options/modifiers fillers
single-or-multi-word-context

results in running -
tagui 5w1h/verb_context quiet options/modifiers

calling using chrome/firefox/headless or with chrome/firefox/headless
at the end of erina … will call tagui in visible chrome, firefox,
headless chrome respectively.

this feature allows future extension to natural language voice control.
the trigger word erina can be changed by just renaming the erina file
(macos/linux) or erina.cmd (windows) file.
  • Loading branch information
kensoh committed Aug 10, 2017
1 parent 3e3f924 commit bb91fda
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
23 changes: 23 additions & 0 deletions src/erina.cmd
@@ -0,0 +1,23 @@
@echo off
rem # HELPER ASSISTANT SCRIPT FOR RUNNING TAGUI FRAMEWORK ~ TEBEL.ORG #

rem enable windows for loop advanced flow control
setlocal enableextensions enabledelayedexpansion

rem save location of initial directory where helper is called
set "initial_dir=%cd%"

rem change current directory to TAGUI directory
cd /d "%~dp0"

rem delete helper file if it exists to prevent running an old call
if exist "tagui_helper.cmd" del "tagui_helper.cmd"

rem call php helper to interpret parameters passed in to cli helper
php -q tagui_helper.php %1 %2 %3 %4 %5 %6 %7 %8 %9

rem run generated output from php helper to call automation flow
if exist "tagui_helper.cmd" tagui_helper

rem change back to initial directory where tagui is called
cd /d "%initial_dir%"
20 changes: 10 additions & 10 deletions src/tagui.cmd
Expand Up @@ -60,6 +60,16 @@ if not "%flow_file%"=="" if not exist "%online_flowname%" (
exit /b 1
)

rem additional windows section for parameters handling using windows way
set arg2=%2
set arg3=%3
set arg4=%4
set arg5=%5
set arg6=%6
set arg7=%7
set arg8=%8
set arg9=%9

set tagui_baseline_mode=false
rem check baseline parameter to output files to baseline directory
if "%arg2%"=="baseline" (
Expand Down Expand Up @@ -129,16 +139,6 @@ if exist "%~dp0slimerjs\slimerjs.bat" set "SLIMERJS_EXECUTABLE=%~dp0slimerjs\sli
if exist "%~dp0php\php.exe" set "path=%~dp0php;%path%"
if exist "%~dp0unx\gawk.exe" set "path=%~dp0unx;%path%"

rem additional windows section for parameters handling using windows way
set arg2=%2
set arg3=%3
set arg4=%4
set arg5=%5
set arg6=%6
set arg7=%7
set arg8=%8
set arg9=%9

rem set default web browser to be used to phantomjs
set tagui_web_browser=phantomjs

Expand Down
5 changes: 5 additions & 0 deletions src/tagui_helper.php
Expand Up @@ -71,5 +71,10 @@
fwrite($output_file,"# GENERATED HELPER ASSISTANT SCRIPT FOR RUNNING TAGUI FRAMEWORK ~ TEBEL.ORG #" . "\n");
fwrite($output_file,"./tagui " . $helper_flow_filename . " quiet " . $helper_flow_options . "\n");
fclose($output_file); chmod ('tagui_helper',0700);
$output_file = fopen('tagui_helper.cmd','w') or die("cannot open tagui_helper.cmd, raise an issue on TagUI GitHub page" . "\n");
fwrite($output_file,"@echo off" . "\n");
fwrite($output_file,"rem # GENERATED HELPER ASSISTANT SCRIPT FOR RUNNING TAGUI FRAMEWORK ~ TEBEL.ORG #" . "\n");
fwrite($output_file,"tagui " . $helper_flow_filename . " quiet " . $helper_flow_options . "\n");
fclose($output_file); chmod ('tagui_helper.cmd',0700);

?>

0 comments on commit bb91fda

Please sign in to comment.