Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for calling other TagUI scripts within a script #80

Closed
terrygoldman opened this issue Feb 27, 2018 · 7 comments
Closed

Support for calling other TagUI scripts within a script #80

terrygoldman opened this issue Feb 27, 2018 · 7 comments
Labels

Comments

@terrygoldman
Copy link

It would be great to have the the ability to create a library of functions that include actions, blocks of code that I can reuse from script to script.

example:
include include.filename

This feature would allow us to create reusable code and provide the ability to rapidly create new scripts based on previous work.

best regards,
Terry

@kensoh
Copy link
Member

kensoh commented Feb 28, 2018

Hi @terrygoldman I have thought of implementing this at some point in time. Can you share more about your thoughts some ways that can be done?

Thinking aloud, on-the-fly invoking a separate instance of TagUI from command-line may be a bad idea, lack of context of parent process and the underlying 'infra' (CasperJS / PhantomJS / Sikuli) should have conflicts.

Another approach could be prior to interpreting the script into JS code, perform an iterative parsing of a new step that calls another TagUI script filename. The end result is generating a fully expanded script without further calls to other scripts. And then start the parsing translation into JS code.

Another area that I need to tackle is to make TagUI extensible so that users can create their own modules / plugins / steps or whatever you call it, and perhaps some easy way to overwrite TagUI's default steps behavior.

The ability to call other TagUI scripts for reusability, and an extension framework are two areas which I had been holding back on implementing. It may suddenly open up much more possible uses and attract a lot more users than I can handle. But I think the time is now ripe to start working on dramatic enhancements to TagUI.

@kensoh kensoh added the feature label Feb 28, 2018
@kensoh kensoh changed the title Support for action libraries Support for calling other TagUI scripts within a script Mar 6, 2018
kensoh added a commit that referenced this issue Mar 6, 2018
With this commit, users can now create reusable TagUI scripts that can be called from other scripts.

In this way, scripts can be compounded to do some much more complicated, while keeping the flow readable and reusable.

A .raw file will be created to store a copy of the expanded script prior to parsing the TagUI language into the JavaScript file for execution.

More details in the issue #80
@kensoh
Copy link
Member

kensoh commented Mar 6, 2018

Made a commit with following comments -


With this commit, users can now create reusable TagUI scripts that can be called from other scripts.

In this way, scripts can be compounded to do some much more complicated, while keeping the flow readable and reusable.

A .raw file will be created to store a copy of the expanded script prior to parsing the TagUI language into the JavaScript file for execution.

@kensoh
Copy link
Member

kensoh commented Mar 6, 2018

@terrygoldman you can give a try by downloading the cutting edge version from here to replace your existing installation. To call your reusable or sub scripts start off the line with tagui followed by the filename, either relative or absolute.

tagui absolute_filename
tagui relative_filename

Object repository for sub-scripts is not enabled to reduce complexity and the chance of creating scripts too complicated for understanding or debugging. Closing the issue for now.

@terrygoldman
Copy link
Author

Thanks Ken, sorry for the delay in responding, been busy with the day job.

BR,
Terry

@kensoh
Copy link
Member

kensoh commented Mar 6, 2018

Hey Terry no probs at all, I'm closing the issue to focus on working on some of the outstanding ideas to explore. Do let me know if you run into issue calling subscripts using the above tagui step and I'll reopen the issue to track when needed.

Let me know too your thoughts, if there is a way to improve on the current implementation. I chose the word tagui instead of programming convention call or include or require, so that the same word can be used even for other languages. As TagUI supports writing scripts in over 20 human languages, something like call or include can be translated and I got a hunch doing that can introduce bugs later on.

@terrygoldman
Copy link
Author

terrygoldman commented Mar 6, 2018 via email

@kensoh
Copy link
Member

kensoh commented Mar 8, 2018

Adding on, besides following naming convention -

tagui filename

Users can also use something like below to make it easier to organize their 'action libraries'. By naming the filename as some context . followed by some action.

tagui context.action

For example, below will expand a TagUI script named as mainscreen.login to perform the login actions.

tagui mainscreen.login

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants