You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
335 lines
18 KiB
335 lines
18 KiB
4 years ago
|
|
||
|
|
||
|
<!DOCTYPE html>
|
||
|
<html class="writer-html5" lang="en" >
|
||
|
<head>
|
||
|
<meta charset="utf-8" />
|
||
|
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
|
|
||
|
<title>3. How to use — pyOpenRPA v1.2.0 documentation</title>
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!--[if lt IE 9]>
|
||
|
<script src="../_static/js/html5shiv.min.js"></script>
|
||
|
<![endif]-->
|
||
|
|
||
|
|
||
|
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
|
<script src="../_static/jquery.js"></script>
|
||
|
<script src="../_static/underscore.js"></script>
|
||
|
<script src="../_static/doctools.js"></script>
|
||
|
|
||
|
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
||
|
|
||
|
|
||
|
<link rel="index" title="Index" href="../genindex.html" />
|
||
|
<link rel="search" title="Search" href="../search.html" />
|
||
|
<link rel="next" title="4. Dependencies" href="04_Dependencies.html" />
|
||
|
<link rel="prev" title="2. Defs" href="02_Defs.html" />
|
||
|
</head>
|
||
|
|
||
|
<body class="wy-body-for-nav">
|
||
|
|
||
|
|
||
|
<div class="wy-grid-for-nav">
|
||
|
|
||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||
|
<div class="wy-side-scroll">
|
||
|
<div class="wy-side-nav-search" >
|
||
|
|
||
|
|
||
|
|
||
|
<a href="../index.html" class="icon icon-home"> pyOpenRPA
|
||
|
|
||
|
|
||
|
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div role="search">
|
||
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||
|
<input type="text" name="q" placeholder="Search docs" />
|
||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||
|
<input type="hidden" name="area" value="default" />
|
||
|
</form>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<p class="caption"><span class="caption-text">GENERAL</span></p>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../01_HowToInstall.html">1. How to install</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../02_RoadMap.html">2. Roadmap</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../03_Copyrights_Contacts.html">3. Copyrights & Contacts</a></li>
|
||
|
</ul>
|
||
|
<p class="caption"><span class="caption-text">ROBOT</span></p>
|
||
|
<ul class="current">
|
||
|
<li class="toctree-l1"><a class="reference internal" href="01_Robot.html">1. Description</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="02_Defs.html">2. Defs</a></li>
|
||
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">3. How to use</a><ul>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="#content">Content</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="#about">About</a></li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="#way-to-use">Way to use</a><ul>
|
||
|
<li class="toctree-l3"><a class="reference internal" href="#create-python-script">Create python script</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="#execute-python-script">Execute python script</a><ul>
|
||
|
<li class="toctree-l3"><a class="reference internal" href="#execute-in-the-python-x32">Execute in the Python x32</a></li>
|
||
|
<li class="toctree-l3"><a class="reference internal" href="#execute-in-the-python-x64">Execute in the Python x64</a></li>
|
||
|
<li class="toctree-l3"><a class="reference internal" href="#execute-from-cmd-file">Execute from .cmd file</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l2"><a class="reference internal" href="#use-in-studio-script-n-a">Use in studio script (n/a)</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="04_Dependencies.html">4. Dependencies</a></li>
|
||
|
</ul>
|
||
|
<p class="caption"><span class="caption-text">STUDIO</span></p>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../Studio/01_Studio.html">1. Description</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../Studio/02_HowToUse.html">2. How to use</a></li>
|
||
|
</ul>
|
||
|
<p class="caption"><span class="caption-text">ORCHESTRATOR</span></p>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToStart.html">4. How to start process</a></li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</nav>
|
||
|
|
||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||
|
|
||
|
|
||
|
<nav class="wy-nav-top" aria-label="top navigation">
|
||
|
|
||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||
|
<a href="../index.html">pyOpenRPA</a>
|
||
|
|
||
|
</nav>
|
||
|
|
||
|
|
||
|
<div class="wy-nav-content">
|
||
|
|
||
|
<div class="rst-content">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
||
|
|
||
|
<ul class="wy-breadcrumbs">
|
||
|
|
||
|
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
||
|
|
||
|
<li>3. How to use</li>
|
||
|
|
||
|
|
||
|
<li class="wy-breadcrumbs-aside">
|
||
|
|
||
|
|
||
|
<a href="../_sources/Robot/03_HowToUse.rst.txt" rel="nofollow"> View page source</a>
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
<hr/>
|
||
|
</div>
|
||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||
|
<div itemprop="articleBody">
|
||
|
|
||
|
<div class="section" id="how-to-use">
|
||
|
<h1>3. How to use<a class="headerlink" href="#how-to-use" title="Permalink to this headline">¶</a></h1>
|
||
|
<div class="section" id="content">
|
||
|
<h2>Content<a class="headerlink" href="#content" title="Permalink to this headline">¶</a></h2>
|
||
|
<ul class="simple">
|
||
|
<li><p><a class="reference external" href="#about">About</a></p></li>
|
||
|
<li><p><a class="reference external" href="#way-to-use">How to use</a></p></li>
|
||
|
<li><p><a class="reference external" href="#create-python-script">Create python script</a></p></li>
|
||
|
<li><p><a class="reference external" href="#execute-python-script">Execute python script</a></p></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="section" id="about">
|
||
|
<h2>About<a class="headerlink" href="#about" title="Permalink to this headline">¶</a></h2>
|
||
|
<p>The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in OpenRPA.</p>
|
||
|
</div>
|
||
|
<div class="section" id="way-to-use">
|
||
|
<h2>Way to use<a class="headerlink" href="#way-to-use" title="Permalink to this headline">¶</a></h2>
|
||
|
<p>You can use the robot by the several ways:</p>
|
||
|
<ul class="simple">
|
||
|
<li><p>In Python script</p></li>
|
||
|
<li><p>In Studio script (n/a)</p></li>
|
||
|
</ul>
|
||
|
<div class="section" id="create-python-script">
|
||
|
<h3>Create python script<a class="headerlink" href="#create-python-script" title="Permalink to this headline">¶</a></h3>
|
||
|
<p>In order to use robot just add Robot tool folder in work directory and add line “import GUI” in your script.</p>
|
||
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
|
||
|
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'../../'</span><span class="p">)</span>
|
||
|
<span class="kn">import</span> <span class="nn">selenium</span> <span class="c1"># [Web app access](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.1.-Theory-&-practice:-Web-app-access-(Chrome,-Firefox,-Opera))<br></span>
|
||
|
<span class="kn">import</span> <span class="nn">GUI</span> <span class="c1"># [Win32 & UI Automation access](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.2.-Theory-&-practice:-Desktop-app-UI-access-(win32-and-UI-automation-dlls)) <br></span>
|
||
|
<span class="kn">import</span> <span class="nn">pyautogui</span> <span class="c1">#[Screen capture/recognition](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.4.-Theory-&-practice:-Screen-capture-&-image-recognition) [#Mouse manipulation](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.3.-Theory-&-practice:-Keyboard-&-mouse-manipulation)<br></span>
|
||
|
<span class="kn">import</span> <span class="nn">cv2</span> <span class="c1"># [Computer vision](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.4.-Theory-&-practice:-Screen-capture-&-image-recognition)<br></span>
|
||
|
<span class="kn">import</span> <span class="nn">keyboard</span> <span class="c1">#[Keyboard manipulation](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.3.-Theory-&-practice:-Keyboard-&-mouse-manipulation)<br></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section" id="execute-python-script">
|
||
|
<h2>Execute python script<a class="headerlink" href="#execute-python-script" title="Permalink to this headline">¶</a></h2>
|
||
|
<p>The OpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
|
||
|
- Execute in python x32 (OpenRPAResourcesWPy32-3720python-3.7.2)
|
||
|
- Execute in python x64 (OpenRPAResourcesWPy64-3720python-3.7.2.amd64)
|
||
|
- Execute from .cmd file</p>
|
||
|
<div class="section" id="execute-in-the-python-x32">
|
||
|
<h3>Execute in the Python x32<a class="headerlink" href="#execute-in-the-python-x32" title="Permalink to this headline">¶</a></h3>
|
||
|
<p>To execute your python script in x32 bit version just write in command line from x32 python directory:</p>
|
||
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="s2">"\OpenRPA\Resources\WPy32-3720\python-3.7.2"</span>
|
||
|
<span class="n">python</span><span class="o">.</span><span class="n">exe</span> <span class="s2">"path to your python script.py"</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section" id="execute-in-the-python-x64">
|
||
|
<h3>Execute in the Python x64<a class="headerlink" href="#execute-in-the-python-x64" title="Permalink to this headline">¶</a></h3>
|
||
|
<p>To execute your python script in x32 bit version just write in command line from x32 python directory:</p>
|
||
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="s2">"\OpenRPA\Resources\WPy64-3720\python-3.7.2.amd64"</span>
|
||
|
<span class="n">python</span><span class="o">.</span><span class="n">exe</span> <span class="s2">"path to your python script.py"</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section" id="execute-from-cmd-file">
|
||
|
<h3>Execute from .cmd file<a class="headerlink" href="#execute-from-cmd-file" title="Permalink to this headline">¶</a></h3>
|
||
|
<p>In order to simplify the execution process you can write several code lines in file with the .cmd extension:</p>
|
||
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">%~</span><span class="n">dp0</span>
|
||
|
<span class="n">copy</span> <span class="o">/</span><span class="n">Y</span> <span class="o">..</span>\<span class="n">Resources</span>\<span class="n">WPy32</span><span class="o">-</span><span class="mi">3720</span>\<span class="n">python</span><span class="o">-</span><span class="mf">3.7</span><span class="o">.</span><span class="mi">2</span>\<span class="n">python</span><span class="o">.</span><span class="n">exe</span> <span class="o">..</span>\<span class="n">Resources</span>\<span class="n">WPy32</span><span class="o">-</span><span class="mi">3720</span>\<span class="n">python</span><span class="o">-</span><span class="mf">3.7</span><span class="o">.</span><span class="mi">2</span>\<span class="n">OpenRPAOrchestrator</span><span class="o">.</span><span class="n">exe</span>
|
||
|
<span class="o">.</span>\<span class="o">..</span>\<span class="n">Resources</span>\<span class="n">WPy32</span><span class="o">-</span><span class="mi">3720</span>\<span class="n">python</span><span class="o">-</span><span class="mf">3.7</span><span class="o">.</span><span class="mi">2</span>\<span class="n">OpenRPAOrchestrator</span><span class="o">.</span><span class="n">exe</span> <span class="n">orchestratorMain</span><span class="o">.</span><span class="n">py</span>
|
||
|
<span class="n">pause</span> <span class="o">></span><span class="n">nul</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section" id="use-in-studio-script-n-a">
|
||
|
<h2>Use in studio script (n/a)<a class="headerlink" href="#use-in-studio-script-n-a" title="Permalink to this headline">¶</a></h2>
|
||
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
|
||
|
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'../../'</span><span class="p">)</span>
|
||
|
<span class="kn">import</span> <span class="nn">GUI</span>
|
||
|
<span class="kn">import</span> <span class="nn">keyboard</span>
|
||
|
<span class="kn">import</span> <span class="nn">subprocess</span>
|
||
|
<span class="kn">import</span> <span class="nn">time</span>
|
||
|
|
||
|
<span class="c1">#Highlight the UI Object in Folder explorer<br></span>
|
||
|
<span class="n">GUI</span><span class="o">.</span><span class="n">UIOSelector_FocusHighlight</span><span class="p">([{</span><span class="s2">"class_name"</span><span class="p">:</span><span class="s2">"CabinetWClass"</span><span class="p">,</span><span class="s2">"backend"</span><span class="p">:</span><span class="s2">"uia"</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">2</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">0</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">2</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">0</span><span class="p">}])</span><span class="o"><</span><span class="n">br</span><span class="o">></span>
|
||
|
|
||
|
<span class="c1">#Wait 2 seconds<br></span>
|
||
|
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o"><</span><span class="n">br</span><span class="o">></span>
|
||
|
|
||
|
<span class="c1">#Loop: get child element of UI List<br></span>
|
||
|
<span class="k">for</span> <span class="n">lItem</span> <span class="ow">in</span> <span class="n">GUI</span><span class="o">.</span><span class="n">UIOSelector_Get_UIO</span><span class="p">([{</span><span class="s2">"class_name"</span><span class="p">:</span><span class="s2">"CabinetWClass"</span><span class="p">,</span><span class="s2">"backend"</span><span class="p">:</span><span class="s2">"uia"</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">2</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">0</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">2</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">0</span><span class="p">}])</span><span class="o">.</span><span class="n">children</span><span class="p">():</span><span class="o"><</span><span class="n">br</span><span class="o">></span>
|
||
|
<span class="o">&</span><span class="n">nbsp</span><span class="p">;</span> <span class="o">&</span><span class="n">nbsp</span><span class="p">;</span> <span class="o">&</span><span class="n">nbsp</span><span class="p">;</span> <span class="o">&</span><span class="n">nbsp</span><span class="p">;</span> <span class="nb">print</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">lItem</span><span class="p">))</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
<footer>
|
||
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||
|
<a href="04_Dependencies.html" class="btn btn-neutral float-right" title="4. Dependencies" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||
|
<a href="02_Defs.html" class="btn btn-neutral float-left" title="2. Defs" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||
|
</div>
|
||
|
|
||
|
<hr/>
|
||
|
|
||
|
<div role="contentinfo">
|
||
|
<p>
|
||
|
© Copyright 2021, Ivan Maslov.
|
||
|
|
||
|
</p>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||
|
|
||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||
|
|
||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||
|
|
||
|
</footer>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</section>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
jQuery(function () {
|
||
|
SphinxRtdTheme.Navigation.enable(true);
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|