### Install TagUI and Run Flow on macOS/Linux Source: https://github.com/aisingapore/tagui/blob/master/docs/setup.md Set up TagUI on macOS or Linux by creating a symbolic link for the 'tagui' executable and then running a sample automation script. Replace '/your_tagui_path/' with the actual installation directory. ```bash sudo ln -sf /your_tagui_path/tagui/src/tagui /usr/local/bin/tagui tagui /your_tagui_path/tagui/flows/samples/1_google.tag ``` -------------------------------- ### Install TA.Gui via npm Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Use npm to install TA.Gui for Node.js environments. This is the packaged installation method. ```bash npm install tagui ``` -------------------------------- ### Login using Image Identifiers Source: https://github.com/aisingapore/tagui/blob/master/README.md Example of logging into a system using image snapshots for UI elements like email, password, and login button. ```tagui // besides web identifiers, images of UI elements can be used type email_box.png as user@gmail.com type password_box.png as 12345678 click login_button.png ``` -------------------------------- ### Natural Language Loop: For Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Example of a natural language 'for' loop structure. ```text example - for n from 1 to 4 ``` -------------------------------- ### Start TagUI Live Mode Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use this command in your terminal to initiate an interactive live session for running TagUI steps one by one and seeing immediate output. ```default tagui live ``` -------------------------------- ### Image Identifier Example (Subfolder) Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use Image identifiers to match screen areas resembling a given image file located in a subfolder. This uses visual automation. ```tagui click image/button.png ``` -------------------------------- ### Run a TagUI Flow on Windows Source: https://github.com/aisingapore/tagui/blob/master/docs/setup.md Execute a TagUI automation script from the command prompt on Windows. Ensure TagUI is installed and its 'src' directory is added to the system's PATH. ```batch tagui c:\tagui\flows\samples\1_google.tag ``` -------------------------------- ### Natural Language Loop: While Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Example of a natural language 'while' loop condition. ```text example - while cupcakes equal to 12 ``` -------------------------------- ### List Files and Folders Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Returns an array containing the names of files and folders within a specified directory. Supports both relative and absolute paths, and provides examples for iterating through the results. ```tagui // list of files in the same folder as the flow file list = get_files('.') // list of files in the Desktop folder of user Alan // note double backslash because of JavaScript string list = get_files('C:\\Users\\Alan\\Desktop') // alternatively, use single forward slash instead list = get_files('C:/Users/Alan/Desktop') // showing the list of files after retrieving it // JavaScript array start from 0 for 1st element for n from 0 to list.length-1 echo `list[n]` // checking to process a specific file extension for n from 0 to list.length-1 if list[n] contains '.XLSX' echo `list[n]` ``` -------------------------------- ### Image Identifier Example (Root Folder) Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use Image identifiers to match screen areas resembling a given image file. The image is searched for in the flow's folder. This uses visual automation. ```tagui click button.png ``` -------------------------------- ### Interacting with Websites and Sending Notifications in TagUI Source: https://github.com/aisingapore/tagui/blob/master/src/media/TagUI Technical Webinar.md Provides an example of automating a web interaction, specifically searching for an item on Shopee, extracting the link of the first result, and sending it as a Telegram notification. ```tagui // go to Shopee website https://shopee.sg // interact with the website using XPath, attributes or computer vision // for XPath, it can be found easily using SelectorsHub Chrome extension // search for item in search bar and click search button type //input as gryphon osmanthus sencha click //button[@type='button'] // grab and form the URL of first result from the search read (//*[@class = "col-xs-2-4 shopee-search-item-result__item"])[1]//@href to sub_link full_link = 'https://shopee.sg/' + sub_link // send telegram notification message with link to result telegram 1234567890 `full_link` ``` -------------------------------- ### JavaScript Condition Example Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Shows the equivalent JavaScript code for checking if a day equals 'Friday'. ```javascript if (day == "Friday") ``` -------------------------------- ### Get Operating System Name Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Returns the name of the operating system the script is running on. Requires importing the 'system' module. ```javascript os = require('system').os.name echo `os` // expected output is mac for MacOS ``` -------------------------------- ### Natural Language Condition Example Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Demonstrates expressing a condition in natural language for checking if a day equals 'Friday'. ```text example - if day equals to "Friday" ``` -------------------------------- ### Point Identifier Example Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use Point identifiers for visual automation by specifying screen coordinates (x,y). This targets a specific pixel on the screen. ```tagui click (200,500) ``` -------------------------------- ### Get Mouse Coordinates Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use mouse_xy() to get the current mouse coordinates in live mode. This is helpful for identifying coordinates to use in your automation scripts. ```TagUI echo `mouse_xy()` ``` -------------------------------- ### Get Environment Variable Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Retrieves the value of a specified environment variable from the operating system. Supports variables on Windows, macOS, and Linux. ```tagui // getting %USERPROFILE% variable for Windows echo `get_env('USERPROFILE')` home_dir = get_env('USERPROFILE') // getting $HOME variable for Mac or Linux echo `get_env('HOME')` home_dir = get_env('HOME') ``` -------------------------------- ### Login to Xero Accounting Source: https://github.com/aisingapore/tagui/blob/master/README.md Example of logging into Xero accounting using web identifiers for email, password, and the login button. ```tagui https://login.xero.com/identity/user/login type email as user@gmail.com type password as 12345678 click Log in ``` -------------------------------- ### XPath Identifier Example Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use XPath to precisely target web elements. This method is primarily for Chrome/Edge. CSS selectors can also be used. ```tagui click //body/div[1]/nav/div/div[1]/a ``` -------------------------------- ### Set Default Flow Language Source: https://github.com/aisingapore/tagui/blob/master/src/tagui_config.txt Sets the default language for TagUI flows. This should be set before starting any automation. ```javascript var tagui_language = 'english'; ``` -------------------------------- ### Assigning Variable Values Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Assign values to variables for easier referencing. This example uses the `count()` helper function to assign the number of elements matching a pattern to a variable. ```tagui row_count = count('row') ``` -------------------------------- ### Read Word Document (Windows) Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Assign the path to a .docx file to a variable to read its text content. Ensure Microsoft Word is installed. Supports relative and absolute paths. ```tagui word_text = [Research Report.docx] word_text = [C:\Users\Jennifer\Desktop\Report.docx] word_text = [FY2021 Reports\Research Report.docx] filename = 'C:\Users\Jennifer\Desktop\Report' word_text = [`filename`.docx] filename = 'Research Report' word_text = [`filename`.docx] ``` -------------------------------- ### Get Mouse X Coordinate and Modify Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md The mouse_x() helper function retrieves the current mouse X-coordinate. It can be used to calculate new coordinates for mouse actions. ```TagUI hover element.png x = mouse_x() + 200 y = mouse_y() click (`x`,`y`) ``` -------------------------------- ### DOM Identifier Example Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use DOM identifiers to match elements by their id, name, class attributes, or text content. This method is primarily for Chrome/Edge. ```tagui click Getting started ``` -------------------------------- ### Read Word Document (Mac) Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Assign the path to a .docx file to a variable to read its text content. Ensure Microsoft Word is installed. Supports relative and absolute paths. ```tagui word_text = [Research Report.docx] word_text = [/Users/jennifer/Desktop/Report.docx] word_text = [FY2021 Reports/Research Report.docx] filename = '/Users/jennifer/Desktop/Report' word_text = [`filename`.docx] filename = 'Research Report' word_text = [`filename`.docx] ``` -------------------------------- ### Get Current Web Page Title Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Retrieves the title of the current web page. Useful for verifying that the correct page has loaded or for conditional actions based on the title. ```tagui if title() contains 'Confirmation' click button1 ``` -------------------------------- ### Read PDF Document (Windows) Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Assign the path to a .pdf file to a variable to read its text content. Requires Adobe Acrobat Reader to be installed and set as default. Supports relative and absolute paths. ```tagui pdf_text = [Research Report.pdf] pdf_text = [C:\Users\Jennifer\Desktop\Report.pdf] pdf_text = [FY2021 Reports\Research Report.pdf] filename = 'C:\Users\Jennifer\Desktop\Report' pdf_text = [`filename`.pdf] filename = 'Research Report' pdf_text = [`filename`.pdf] ``` -------------------------------- ### Get All Web Page Text Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Extracts all the visible text content from the current web page. This can be used to search for specific text strings or verify page content. ```tagui if text() contains 'success' click button1 ``` -------------------------------- ### Get Current Web Page URL Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Retrieves the URL of the currently active web page. This can be used in conditional logic to check for specific page states or content. ```tagui if url() contains 'success' click button1 ``` -------------------------------- ### Read Data from Excel Source: https://github.com/aisingapore/tagui/blob/master/README.md Reads data from a specific cell in an Excel file using familiar Excel formula syntax. This example reads from cell E11 in the August sheet of 'Monthly Report.xlsx'. ```tagui top_salesman = [Monthly Report.xlsx]August!E11 ``` -------------------------------- ### Save Run Results with -report Option Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Use the -report option to save an HTML log and flow run results to tagui_report.csv. This provides a record of each run, including start time, duration, errors, and log file links. ```default tagui my_flow.tag -report ``` -------------------------------- ### Create a Deployable Shortcut for a TagUI Flow Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Generate a shortcut file (.cmd) to run a TagUI flow by double-clicking. ```bash tagui my_flow.tag -deploy ``` -------------------------------- ### Display output on command line Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Shows static text or the value of a variable on the command line. ```tagui echo Flow has started echo The user is `username` ``` -------------------------------- ### Create a Shortcut with Options for a TagUI Flow Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Generate a shortcut for a TagUI flow that includes additional options like '-h' for headless mode. ```bash tagui my_flow.tag -h -d ``` -------------------------------- ### Natural Language Condition: Complex Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md An example of a complex natural language condition involving multiple checks. ```text example - if A more than B and C not equals to D ``` -------------------------------- ### Repository Object and Step Definitions Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Shows definitions for a reusable 'email' object and a 'type email' step that utilizes it. ```text email|user-email-textbox type email|type `email` as user@gmail.com ``` -------------------------------- ### Natural Language Condition: Contains Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Example of a natural language condition to check if a variable contains a specific text. ```text example - if menu contains "fruits" ``` -------------------------------- ### Run Steps Interactively Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Executes steps interactively, showing immediate output. The flow pauses until the user types 'done'. ```none live ``` -------------------------------- ### Run a TagUI Flow with Full Path Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Execute a TagUI flow by providing its complete file path. ```bash tagui c:\tagui\samples\1_google.tag ``` -------------------------------- ### Paste Text from Clipboard Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use clipboard() with an input to place text onto the clipboard, then use keyboard shortcuts to paste it. This is faster than typing long text. ```TagUI long_text = "This is a very long text which takes a long time to type" clipboard(long_text) click text_input keyboard [ctrl]v keyboard [enter] ``` -------------------------------- ### Login using (x,y) Coordinates Source: https://github.com/aisingapore/tagui/blob/master/docs/index.md Automates login by specifying the exact (x,y) coordinates of UI elements. This method is less robust to UI changes but can be precise. Coordinates are relative to the screen. ```TagUI // (x,y) coordinates of user-interface elements can also be used type (720,400) as user@gmail.com type (720,440) as 12345678 click (720,500) ``` -------------------------------- ### Repository Button Definition Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Defines a reusable object named 'create account' that refers to a specific button element. ```text create account|btn btn--green btn-xl signup-btn ``` -------------------------------- ### Create a Shortcut for a TagUI Flow using -d Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use the shorthand '-d' to create a shortcut for running a TagUI flow via double-click. ```bash tagui my_flow.tag -d ``` -------------------------------- ### Login using Image Identifiers Source: https://github.com/aisingapore/tagui/blob/master/docs/index.md Automates login by referencing UI elements through image files. This method is useful when element IDs are dynamic or unreliable. Ensure image files are accessible. ```TagUI // besides web identifiers, images of UI elements can be used type email_box.png as user@gmail.com type password_box.png as 12345678 click login_button.png ``` -------------------------------- ### Show element text on command line Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Displays the text content of a specified DOM element or XPath directly on the command line. ```tagui show review-text ``` -------------------------------- ### OCR and PDF Handling in TagUI Source: https://github.com/aisingapore/tagui/blob/master/src/media/TagUI Technical Webinar.md Demonstrates how to open PDF files, perform OCR on specific regions or the entire page, clean extracted text, and save results. It also covers handling text-based PDFs by copying content from the clipboard. ```tagui // first, open the PDF file in one of the following ways dclick pdf_icon.png (desktop) run cmd /c start c:\folder\filename.pdf (Windows) run open /Users/folder/filename.pdf (macOS) keyboard step to search for the file and open // second, apply OCR using one of the following ways read pdf_frame.png to ocr_text read (200,200)-(600,600) to ocr_text hover anchor.png x = mouse_x() y = mouse_y() x1 = x + 100 y1 = y + 100 x2 = x + 500 y2 = y + 500 read (`x1`,`y1`)-(`x2`,`y2`) to ocr_text // optionally do data cleaning or extraction ocr_text = del_chars(ocr_text, '\t\r') name = get_text(pdf_text, 'Name:', 'State:') // finally, save result to a text file dump `ocr_text` to ocr_result.txt // note that for text PDF instead of scanned PDF, // you can copy to clipboard instead of using OCR keyboard [ctrl]a keyboard [ctrl]c ocr_text = clipboard() ``` -------------------------------- ### Run a TagUI Flow from Command Line Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Execute a TagUI flow by specifying its name in the current directory. ```bash tagui my_flow.tag ``` -------------------------------- ### Run TA.Gui from Command Line Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Execute automation flows using the TA.Gui command-line interface. Supports various options for browser choice, reporting, and debugging. ```bash ./tagui flow_filename option(s) for macOS/Linux, tagui flow_filename option(s) for Windows ``` -------------------------------- ### Visiting a Webpage Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Navigate to a specified URL. ```tagui https://somewebsite.com ``` -------------------------------- ### Run a TagUI Flow in Headless Mode using -h Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use the shorthand '-h' to run a TagUI web flow without showing the browser. ```bash tagui my_flow.tag -h ``` -------------------------------- ### Run a TagUI Flow from a URL Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Execute a TagUI flow directly by providing its URL. ```bash tagui https://raw.githubusercontent.com/kelaberetiv/TagUI/master/flows/samples/1_google.tag ``` -------------------------------- ### Run a TagUI Flow in Headless Mode Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Execute a TagUI web flow without displaying the browser window using the '-headless' option. ```bash tagui my_flow.tag -headless ``` -------------------------------- ### Run Another TagUI Flow Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Executes another TagUI flow file. The path can be relative or absolute. ```none tagui update-forex.tag ``` ```none tagui flows/update-forex.tag ``` -------------------------------- ### Run Steps in New Tab Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Executes subsequent steps within a new browser tab, identified by a unique part of its URL. ```tagui popup confirm click Confirm ``` -------------------------------- ### Execute Sikuli Code Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Runs Sikuli automation code for image-based UI interaction. Requires SikuliX to be set up. ```none vision click("button1.png") ``` -------------------------------- ### Returning Variables from SikuliX to TagUI Source: https://github.com/aisingapore/tagui/blob/master/src/media/TagUI Technical Webinar.md Illustrates how to return variables from SikuliX to TagUI. This involves using `vision` to output variables to a file and `fetch_sikuli_text()` to retrieve them. ```tagui // save variable to output file using vision info_text = info_text + 'def' vision output_sikuli_text(info_text) // get variable from output file using some_variable = fetch_sikuli_text() echo `some_variable` ``` -------------------------------- ### Clicking by Screen Coordinates Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Click a specific point on the screen using X-Y coordinates. Use the `mouse_xy()` helper function in live mode to find appropriate coordinates. ```tagui click (500,300) ``` -------------------------------- ### Repeat Steps with a For Loop Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use a for loop to execute a block of steps a specified number of times. This is useful for repetitive tasks within a single flow. ```TagUI for n from 1 to 20 some step to take some other step some more step ``` -------------------------------- ### Repository Step Definition Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Defines a reusable step named 'type email' that uses the 'email' object and specifies the text to type. ```text type email|type `email` as user@gmail.com ``` -------------------------------- ### Run a TagUI Flow Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Execute a TagUI flow file directly. This is the basic command to run a workflow. ```default tagui login_crm.tag ``` -------------------------------- ### Echo Input Parameters within TagUI Flow Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Demonstrates how to access and display input parameters (p1, p2, p3, p4) within a TagUI automation script. These parameters are typically passed from the command line. ```tagui echo `p1` echo `p2` echo `p3` echo `p4` ``` -------------------------------- ### Run a TagUI Flow from a Subfolder Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Execute a TagUI flow file located in a subfolder. Supports both Windows and Mac/Linux path separators. ```default // Windows example tagui CRM\login.tag // Mac/Linux example tagui CRM/login.tag ``` -------------------------------- ### Copy Text to Clipboard Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md The clipboard() helper function can be used to copy text to the system clipboard. This is useful for automating copy-paste operations. ```TagUI dclick pdf_document.png wait 3 seconds keyboard [ctrl]a keyboard [ctrl]c text_contents = clipboard() ``` -------------------------------- ### Simulate Keyboard Input Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Enters specified keystrokes directly. Supports special keys like Shift, Ctrl, Enter, and function keys. ```none keyboard [win]run[enter] ``` ```none keyboard [printscreen] ``` ```none keyboard [ctrl]c ``` ```none keyboard [tab][tab][tab][enter] ``` ```none keyboard [cmd]space ``` ```none keyboard safari[enter] ``` ```none keyboard [cmd]c ``` -------------------------------- ### Passing Variables to SikuliX from TagUI Source: https://github.com/aisingapore/tagui/blob/master/src/media/TagUI Technical Webinar.md Shows how to pass TagUI variables to SikuliX for use in vision steps by constructing commands using the `vision_step()` function. ```tagui // by using vision_step() function to form the actual command in SikuliX info_text = 'abc' vision_step('info_text = "' + info_text + '"'); info_number = 123 vision_step('info_number = ' + info_number); // saving and reading from a file is possible but need more lines of code ``` -------------------------------- ### Visual Automation with OCR Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Interact with UI elements using OCR by appending 'using ocr' or 'using OCR' to automation steps. This allows for flexible targeting of elements based on their on-screen appearance. ```tagui click Submit using ocr if exist('Special Offer using ocr') click Add To Cart using OCR // various usage combinations for select step select Dress Color using OCR as Dark Blue using OCR select dress_color.png as Bright Pink using ocr select Dress Color using OCR as dark_black.png select dress_color.png as bright_white.png ``` -------------------------------- ### Executing Python Code within TagUI Source: https://github.com/aisingapore/tagui/blob/master/src/media/TagUI Technical Webinar.md Demonstrates how to run Python code directly within TagUI scripts using the `py` step for single commands or `py begin`/`py finish` for code blocks. It also shows how to execute external Python scripts. ```tagui // TagUI's Python integration lets you access Python packages // check out this Python package that can do this very well https://github.com/atlanhq/camelot // you can run Python code in TagUI with the py step py a = 1 py b = 2 py c = a + b py print(c) echo `py_result` // or use py begin and py finish for Python code blocks py begin a = 1 b = 2 c = a + b print(c) py finish echo `py_result` // you can also run a certain Python script in 1 line py exec(open("full path to Python file").read()) // alternatively, use Python version of TagUI directly https://github.com/tebelorg/RPA-Python ``` -------------------------------- ### Clicking by Image Match Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Click on a web element by matching a previously saved image. Images can be stored in the same folder or a subfolder. ```tagui click button.png ``` ```tagui click image/button.png ``` -------------------------------- ### Run TagUI Flow with Edge Browser and Input Parameters Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Executes a TagUI flow using the Microsoft Edge browser and passes multiple input parameters (p1 to p4) which can be used as variables within the flow. This is suitable for batch processing or parameterized automation. ```default tagui register_attendence.tag -edge Jenny Jason John Joanne ``` -------------------------------- ### Run TagUI in Turbo Mode Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Use the -turbo or -t flag to run TagUI flows at an accelerated speed. Caution is advised as this may cause issues with some applications. ```bash tagui flow.tag -turbo ``` ```bash tagui flow.tag -t ``` -------------------------------- ### Specify Download Location Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Sets the directory where downloaded files will be saved. Defaults to the TagUI flow's folder. ```tagui download to [folder location] ``` -------------------------------- ### Automate Typeform Report Download Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md This snippet demonstrates how to automate downloading a report from Typeform using TA.Gui's natural language syntax. It includes steps for navigation, authentication, and downloading a CSV report. ```tagui https://www.typeform.com click login type username as user@gmail.com type password as 12345678 click btnlogin hover Test Event click action results tooltip click section_results download https://admin.typeform.com/form/2592751/analyze/csv to report.csv ``` -------------------------------- ### Conditional Execution based on URL Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Execute steps only if the current URL contains a specific string. Indentation is crucial for defining the block of steps to be executed. ```none if url() contains "success" click button1.png click button2.png ``` -------------------------------- ### Manage Clipboard Content Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Copies text to the system clipboard or retrieves the current clipboard content. Use `clipboard('text')` to copy and `clipboard()` to retrieve. ```tagui clipboard('some text') keyboard [ctrl]v keyboard [ctrl]c contents = clipboard() ``` -------------------------------- ### Run TagUI Flow with Headless and Report Options Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md This command runs a TagUI flow without displaying the browser and saves the run results to a report file. It's useful for background execution and logging. ```default tagui my_flow.tag -headless -report ``` -------------------------------- ### Conditional Execution based on Variable Less Than Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Run steps if a variable's value is less than a specified number. Useful for checking if a value falls below a certain threshold. ```none if row_count less than 5 some steps ``` -------------------------------- ### Prompt User for Input Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Displays a prompt message to the user and captures their input. The input is stored in the `ask_result` variable. ```none ask What is the date of the receipt? (in DD-MM-YYYY) type search as `ask_result` ``` -------------------------------- ### Load file content into a variable Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Reads the entire content of a specified file and stores it into a variable. ```tagui load report.txt to report ``` -------------------------------- ### Run Python Commands in TagUI Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Use the `py` step to execute Python commands directly within TagUI flows. Results can be printed and captured in the `py_result` variable. ```none py a=1 py b=2 py c=a+b py print(c) echo `py_result` ``` -------------------------------- ### Update TagUI on Windows Source: https://github.com/aisingapore/tagui/blob/master/docs/setup.md Update TagUI to the latest version from the command prompt on Windows. This command fetches the newest features and bug fixes. ```batch tagui update ``` -------------------------------- ### Concatenate variables Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Demonstrates variable concatenation within and outside the echo step. ```tagui echo `a` `b` // output: hello world a = "hello" b = "world" c = a + " " + b echo `c` // output: hello world ``` -------------------------------- ### Typing by Image Match Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Type text into a web input field identified by a matching image. This is useful when direct element identification is difficult. ```tagui type some-input.png as some-text ``` -------------------------------- ### Execute Shell Command Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Runs a command in the system's command prompt or terminal. The standard output is captured in `run_result`. ```none run cmd /c mkdir new_directory ``` -------------------------------- ### Read PDF Document (Mac) Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Assign the path to a .pdf file to a variable to read its text content. Uses the default Preview app. Supports relative and absolute paths. ```tagui pdf_text = [Research Report.pdf] pdf_text = [/Users/jennifer/Desktop/Report.pdf] pdf_text = [FY2021 Reports/Research Report.pdf] filename = '/Users/jennifer/Desktop/Report' pdf_text = [`filename`.pdf] filename = 'Research Report' pdf_text = [`filename`.pdf] ``` -------------------------------- ### Schedule TA.Gui Crontab Entry Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md This crontab entry schedules TA.Gui to check and process pending flows in the queue every 15 minutes. Ensure the path points to your tagui_crontab executable. ```bash 0,15,30,45 * * * * /full_path_on_your_server/tagui_crontab ``` -------------------------------- ### Conditional Execution based on Variable Equality Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Perform actions if a variable's value is exactly equal to a specified number. Ensure the variable is assigned a value beforehand. ```none if row_count equals to 5 some steps ``` -------------------------------- ### Conditional Execution based on Variable Greater Than Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Execute steps if a variable's value is greater than a specified number. This allows for range-based conditional logic. ```none if row_count more than 5 some steps ``` -------------------------------- ### Call Web API Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Invokes a web API and stores the raw response in `api_result`. If the response is JSON, `api_json` is also populated. ```tagui api https://api.github.com/repos/kelaberetiv/TagUI/releases echo `api_result` author = api_json[0].author.login ``` -------------------------------- ### Schedule TA.Gui Flow with Crontab Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Schedule an automation flow to run daily at 8 AM using crontab on macOS or Linux. ```bash 0 8 * * * /full_path_on_your_server/tagui flow_filename option(s) ``` -------------------------------- ### JavaScript Loop: For Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md The JavaScript equivalent for a 'for' loop iterating from 1 to 4. ```javascript for (n=1; n<=4; n++) ``` -------------------------------- ### Configure PhantomJS Page Settings Source: https://github.com/aisingapore/tagui/blob/master/src/tagui_config.txt Sets specific options for PhantomJS, such as image loading, plugin support, and security settings. Adjust these based on the website's requirements. ```javascript casper.options.pageSettings = { loadImages: true, loadPlugins: true, webSecurityEnabled: true, ignoreSslErrors: false, localToRemoteUrlAccessEnabled: false }; ``` -------------------------------- ### Write a new line to a file Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Appends a new line of text or a variable's content to an existing file. ```tagui write firstname,lastname to names.csv write `fullreport` to report.txt ``` -------------------------------- ### Workflow Error Handling (Windows) Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Execute a success workflow only if the main flow completes successfully, or an error workflow if it fails. This uses command prompt chaining with '&&' for success and '||' for error. ```default call tagui flow.tag || tagui error.tag call tagui flow.tag && tagui success.tag ``` -------------------------------- ### Simulate Mouse Events Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Explicitly sends mouse down or mouse up events at the current cursor position. Typically, 'click' is preferred. ```none mouse down ``` ```none mouse up ``` -------------------------------- ### Clicking Web Elements by Text Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Use this step to click on web elements identified by their text, ID, name, or class attributes. It can also target elements by XPath for more precise selection. ```tagui click Getting started ``` ```tagui click //a[@class="icon icon-home"] ``` -------------------------------- ### Repository Object Definition Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Defines a reusable object named 'email' that refers to a specific web element 'user-email-textbox'. ```text email|user-email-textbox ``` -------------------------------- ### Upload File to Website Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Uploads a specified file to a web element using its DOM identifier. ```tagui upload #element_id as report.csv ``` ```tagui upload input[type="file"] as filename.docx ``` -------------------------------- ### Resize Image Snapshots in TagUI Source: https://github.com/aisingapore/tagui/blob/master/src/media/TagUI Technical Webinar.md Adjusts the size of image snapshots for vision processing. Set to 0.5 to search for half the original image size. ```tagui vision Settings.AlwaysResize = 0.5 ``` -------------------------------- ### Using Object Repository Variables in TagUI Flow Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Utilize variables defined in an object repository to interact with web elements. Local definitions override global ones. ```default type `email` as my_email@email.com ``` -------------------------------- ### Capture screenshot Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Saves a screenshot of the whole page, a specific element (DOM/XPath), or a region to a file. ```tagui snap logo to logo.png snap page to webpage.png snap (0,0)-(100,100) to image.png ``` -------------------------------- ### Pass Variables to Python in TagUI Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Pass TagUI variables to Python scripts using `py_step`. Ensure string variables are properly quoted when passed. ```default phone = 1234567 py_step('phone = ' + phone) py print(phone) echo `py_result` ``` ```default name = 'Donald' py_step('name = "' + name + '"') py print(name) echo `py_result` ``` -------------------------------- ### Workflow Error Handling (macOS/Linux) Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Execute a success workflow only if the main flow completes successfully, or an error workflow if it fails. This uses terminal chaining with '&&' for success and '||' for error. ```default tagui flow.tag || tagui error.tag tagUI flow.tag && tagui success.tag ``` -------------------------------- ### Trigger TA.Gui Flow via API Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md This is the API syntax to trigger an automation flow from an application or web browser. Custom inputs are supported and can be passed as parameters. This syntax can also be used for triggering flows from emails via TA.Mail. ```http your_website_url/tagui_service.php?SETTINGS="flow_filename option(s)" ``` -------------------------------- ### Extract Table Data to CSV Source: https://github.com/aisingapore/tagui/blob/master/README.md Grabs data from a specified table on a webpage and saves it to a CSV file. 'n' represents the nth table on the page. ```tagui table n to forex_rates.csv ``` -------------------------------- ### Save text to a file Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Saves specified text or a variable's content to a new file. Can be used to create CSV files with headers. ```tagui dump First Name,Last Name to names.csv ``` -------------------------------- ### Python Code Blocks in TagUI Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Enclose larger Python code blocks using `py begin` and `py finish`. The final `print()` output is captured in the `py_result` variable. ```default py begin a=1 b=2 c=a+b print(c) py finish echo `py_result` ``` -------------------------------- ### Execute Multiple R Statements Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Runs a block of R code. The standard output is captured and stored in the `r_result` variable. ```none r begin [R statements] r finish ``` -------------------------------- ### Control Excel Visibility and Focus Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Configures whether the Excel application runs in the foreground, background, or invisibly during automated actions. ```tagui excel_focus = true ``` ```tagui excel_focus = false ``` ```tagui excel_visible = false ``` ```tagui excel_visible = true ``` -------------------------------- ### Pass and Return Variables Between Flows Source: https://github.com/aisingapore/tagui/blob/master/docs/advanced.md Define variables in the parent flow that are accessible in the child flow, and define variables in the child flow to be returned to the parent. ```default // in this case, username and password variables are available in login.tag username = 'jennifer'; password = '12345678'; tagui login.tag // you can also define variables on separate lines instead of all in 1 line username = 'jennifer' password = '12345678' tagui login.tag // in login.tag you can define and return variables for its parent to use echo `login_result` ``` -------------------------------- ### Wait for Specified Time Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Pauses the execution of the TagUI flow for a given duration. Can specify time in seconds. ```none wait 5.5 ``` ```none wait 10 s ``` ```none wait 20 seconds ``` -------------------------------- ### Set Timeout and Log Level Source: https://github.com/aisingapore/tagui/blob/master/src/tagui_config.txt Configures the maximum wait time before an error occurs and the verbosity of logs. Useful for debugging and performance tuning. ```javascript casper.options.waitTimeout = 10000; casper.options.logLevel = 'debug'; ``` -------------------------------- ### Login to Xero Accounting Website Source: https://github.com/aisingapore/tagui/blob/master/docs/index.md Automates the login process for the Xero accounting website using email and password credentials. Ensure you are on the correct login page before executing. ```TagUI // below is an example to login to Xero accounting website https://login.xero.com/identity/user/login type email as user@gmail.com type password as 12345678 click Log in ``` -------------------------------- ### Select Dropdown Option Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Selects an option from a dropdown element using its DOM or XPath identifier and the desired option value or text. ```tagui select variant as blue ``` -------------------------------- ### Conditional Execution based on Element Existence Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Navigate to a URL if a specified element does not appear within the defined timeout. The '!' operator negates the existence check. ```none if !exist('some-element') https://tagui.readthedocs.io/ ``` -------------------------------- ### Check Element Presence (immediate) Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Immediately checks if an element exists on the page without waiting and returns a boolean. Supports DOM, XPath, and Image identifiers. ```tagui if present('//table') click button1 ``` -------------------------------- ### Copy Data Between Excel Files Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Copies data from a source range in one Excel file to a destination cell in another. Supports creating new files or sheets if they do not exist. ```none [workbook]sheet!cell = [workbook]sheet!range ``` ```none [Monthly Report.xlsx]August!A1 = [Jennifer Report.xlsx]August!A1 [Monthly Report.xlsx]August!A1 = [Jennifer Report.xlsx]August!A1:E200 ``` -------------------------------- ### Execute Single Python Statement Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Runs a single Python statement. The standard output is captured and stored in the `py_result` variable. ```none py result = 2 + 3 py print(result) echo `py_result` ``` -------------------------------- ### Typing into Web Inputs Source: https://github.com/aisingapore/tagui/blob/master/docs/main_concepts.md Type text into web input fields identified by name, ID, or class. Supports clearing input and pressing Enter. ```tagui type some-input as some-text ``` ```tagui type some-input as [clear]some-text[enter] ``` -------------------------------- ### Read/Write Excel Data Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Performs read and write operations on Excel files using standard Excel formula syntax. Supports various file formats and requires the file extension. ```tagui [`workbook`.xlsx]`sheet`!`range` = 123 ``` ```tagui data = [`workbook`.xlsx]`sheet`!`range` ``` -------------------------------- ### Count Matching Elements Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Counts the number of elements on a web page that match a specified identifier. The identifier must be provided as a string enclosed in single quotes. ```tagui rows = count('table-rows') ``` -------------------------------- ### Execute Single JavaScript Statement Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Runs a single JavaScript statement directly. The result can be accessed or manipulated within TagUI. ```none js obj = JSON.parse(api_result) dump `obj` to result.json ``` -------------------------------- ### Write Data to Excel Source: https://github.com/aisingapore/tagui/blob/master/docs/reference.md Writes data to a specified cell or range in an Excel file. Creates new files or sheets if they don't exist. Data can be a single value or a JavaScript array for ranges. ```none [workbook]sheet!cell = variable ``` ```none [Monthly Report.xlsx]August!E10 = 12345 [Monthly Report.xlsx]August!E11 = "Alan" [Monthly Report.xlsx]August!E12 = variable [Quarterly Metrics.xlsx]Main!B3 = data_array ``` ```javascript // to assign a set of range data with 2 rows of 3 columns [C:\\Reports\\June.xls]Sheet1!A1 = [[1, 2, 3], [4, 5, 6]] [C:\\Reports\\June.xls]Sheet1!A1 = [[variable_1, variable_2, variable_3], [4, 5, 6]] // example spreadsheet data with #, name and country [Participants.xlsx]Sheet1!A1 = [['1', 'John', 'USA'], [2, 'Jenny', 'Russia'], [3, 'Javier', 'Serbia']] // get the next row count for the example spreadsheet column_A = [Participants.xlsx]Sheet1!A:A next_row = column_A.length + 1 // write a new row accordingly to example spreadsheet [Participants.xlsx]Sheet1!A`next_row` = [[next_row, 'Janice', 'Brazil']] // example of copying from csv to xlsx, the logic is assign csv to variable data, and then assign to xlsx data = [csvtest.csv]Sheet1!A1:D7 [exceltest.xlsx]Sheet2!A1 = data ``` -------------------------------- ### CasperJS Test Assertions in TA.Gui Source: https://github.com/aisingapore/tagui/blob/master/src/media/initial_release.md Use these JavaScript assertions directly in your TA.Gui automation flow for testing. Note that there is no auto-wait for these direct CasperJS assertions; use the 'wait' step if needed. ```javascript test.assertTextExists('About Tebel','Check for About Tebel text'); ``` ```javascript test.assertSelectorHasText(tx('header'), 'Interface automation','Check for phrase in header element'); ``` -------------------------------- ### Set Browser Display Size Source: https://github.com/aisingapore/tagui/blob/master/src/tagui_config.txt Defines the viewport size of the browser window during automation. Affects element visibility and rendering. ```javascript casper.options.viewportSize = { width: 1366, height: 768 }; ```