|
2 | 2 | # Apache License 2.0, Copyright 2019 Tebel.Automation Private Limited
|
3 | 3 | # https://github.com/tebelorg/RPA-Python/blob/master/LICENSE.txt
|
4 | 4 | __author__ = 'Ken Soh <[email protected]>'
|
5 |
| -__version__ = '1.44.1' |
| 5 | +__version__ = '1.45.0' |
6 | 6 |
|
7 | 7 | import subprocess
|
8 | 8 | import os
|
@@ -429,7 +429,7 @@ def setup():
|
429 | 429 |
|
430 | 430 | return True
|
431 | 431 |
|
432 |
| -def init(visual_automation = False, chrome_browser = True, headless_mode = False): |
| 432 | +def init(visual_automation = False, chrome_browser = True, headless_mode = False, turbo_mode = False): |
433 | 433 | """start and connect to tagui process by checking tagui live mode readiness"""
|
434 | 434 |
|
435 | 435 | global _process, _tagui_started, _tagui_id, _tagui_visual, _tagui_chrome, _tagui_init_directory, _tagui_download_directory
|
@@ -507,7 +507,20 @@ def init(visual_automation = False, chrome_browser = True, headless_mode = False
|
507 | 507 | browser_option = 'chrome'
|
508 | 508 | if headless_mode:
|
509 | 509 | browser_option = 'headless'
|
510 |
| - |
| 510 | + |
| 511 | + # special handling for turbo mode to run 10X faster |
| 512 | + tagui_chrome_php = tagui_directory + '/' + 'src' + '/' + 'tagui_chrome.php' |
| 513 | + tagui_header_js = tagui_directory + '/' + 'src' + '/' + 'tagui_header.js' |
| 514 | + tagui_sikuli_py = tagui_directory + '/' + 'src' + '/' + 'tagui.sikuli/tagui.py' |
| 515 | + if not turbo_mode: |
| 516 | + dump(load(tagui_chrome_php).replace('$scan_period = 10000;', '$scan_period = 100000;'), tagui_chrome_php) |
| 517 | + dump(load(tagui_header_js).replace('function sleep(ms) {ms *= 0.1; //', 'function sleep(ms) { //').replace("chrome_step('Input.insertText',{text: value});};", "for (var character = 0, length = value.length; character < length; character++) {\nchrome_step('Input.dispatchKeyEvent',{type: 'char', text: value[character]});}};"), tagui_header_js) |
| 518 | + dump(load(tagui_sikuli_py).replace('scan_period = 0.05\n\n# teleport mouse instead of moving to target\nSettings.MoveMouseDelay = 0', 'scan_period = 0.5'), tagui_sikuli_py) |
| 519 | + else: |
| 520 | + dump(load(tagui_chrome_php).replace('$scan_period = 100000;', '$scan_period = 10000;'), tagui_chrome_php) |
| 521 | + dump(load(tagui_header_js).replace('function sleep(ms) { //', 'function sleep(ms) {ms *= 0.1; //').replace("for (var character = 0, length = value.length; character < length; character++) {\nchrome_step('Input.dispatchKeyEvent',{type: 'char', text: value[character]});}};", "chrome_step('Input.insertText',{text: value});};"), tagui_header_js) |
| 522 | + dump(load(tagui_sikuli_py).replace('scan_period = 0.5', 'scan_period = 0.05\n\n# teleport mouse instead of moving to target\nSettings.MoveMouseDelay = 0'), tagui_sikuli_py) |
| 523 | + |
511 | 524 | # entry shell command to invoke tagui process
|
512 | 525 | tagui_cmd = '"' + tagui_executable + '"' + ' rpa_python ' + browser_option
|
513 | 526 |
|
|
0 commit comments