#Studio_OtcherActivities #Robot_WindowDialog #Studio_Fixes

dev-linux
Ivan Maslov 6 years ago
parent d227f1a0e2
commit 15d8b52193

@ -95,7 +95,7 @@ def ActivityRun(inActivitySpecificationDict):
#Подключить модуль для вызова
lModule=importlib.import_module(inActivitySpecificationDict["ModuleName"])
#Найти функцию
lFunction=getattr(lModule,inActivitySpecificationDict["FunctionName"])
lFunction=getattr(lModule,inActivitySpecificationDict["ActivityName"])
#Выполнить вызов и записать результат
lResponseObject["Result"]=lFunction(*lArgumentList,**lArgumentDict)
except Exception as e:

@ -0,0 +1,13 @@
import ctypes
####################################
#Info: Window module of the Robot app (OpenRPA - Robot)
####################################
# WIndow Module - Show information dialog messages to user by the modal windows
################
###DialogYesNo
################
#return 1 - Yes; 2 - No
def DialogYesNo(inTitle,inBody):
lResult = ctypes.windll.user32.MessageBoxW(0, inBody, inTitle, 1)
return lResult

@ -12,7 +12,14 @@
var mGlobal={}
$(document)
.ready(function() {
/////////////////////////////////////////////////////////////////
///ПАРАМЕТРЫ
/////////////////////////////////////////////////////////////////
mGlobal.Settings={}
mGlobal.Settings.mUIOTreeHeight=450
mGlobal.GUIElement={}
mGlobal.GenerateUniqueID=function(inPrefix="ID") {
return inPrefix+Math.round(Math.random()*1000)+"-"+Math.round(Math.random()*10000)+"-"+Math.round(Math.random()*1000)
@ -32,6 +39,20 @@
document.execCommand('copy');
document.body.removeChild(el);
};
///////////////////////////
///Функция нормализации текстовой строки для HTML
///////////////////////////
mGlobal.Tools={}
mGlobal.Tools.HTMLNormalizeStr=function(inString)
{
lResult=inString;
lResult=lResult.replace(/&/g,"&");
lResult=lResult.replace(/</g,"&lt;");
lResult=lResult.replace(/>/g,"&gt;");
lResult=lResult.replace(/"/g,"&quot;");
lResult=lResult.replace(/'/g,"&#39;");
return lResult;
}
///Функция перезапуска студии
mGlobal.Actions.fRestartStudioServer= function()
{
@ -137,9 +158,11 @@
}
///Функция визуализации дерева
mGlobal.ElementTree.fRender = function(inElementsTreeDataArray)
mGlobal.ElementTree.fRender = function(inElementsTreeDataArray,inBackendString="-")
{
var lHTMLList='<div class="ui list" style="height:350px;overflow:scroll;">';
var lHTMLList=
'<b style="font-size:10px;" >Backend: '+inBackendString+'</b>\
<div class="ui list" style="height:'+mGlobal.Settings.mUIOTreeHeight+'px;overflow:scroll; margin-top:0px;">';
///Циклический обход списка
for (var i = 0; i< inElementsTreeDataArray.length;i++) {
///Добавить HTML код позиции
@ -228,16 +251,21 @@
var lIconSelectOnClick=' onclick="mGlobal.TreeObjectInfoLoad(\''+lElementId+'\');" '
var lIconTestOnClick=' onclick="mGlobal.Test(\''+lElementId+'\');" '
var lIconUpOnClick=' onclick="mGlobal.Actions.fAutomationSearchMouseElementHierarchyRun(\''+lElementId+'\');" '
var lTitle=mGlobal.Tools.HTMLNormalizeStr(lResponseJSON.Result[i].title);
var lSettingBigTitleLength=300;
if (lTitle.length>lSettingBigTitleLength)
{
lTitle=lTitle.slice(0,lSettingBigTitleLength)+"..."
}
lHTMLTree+='\
<div class="item handle_'+lSubItemHandleId+'" handle_id="'+lSubItemHandleId+'" id="'+lElementId+'">\
<i class="folder icon"></i>\
<i class="angle double right icon" '+lIconSelectOnClick+'></i>\
<i class="angle double right icon" '+lIconTestOnClick+'></i>\
<i class="angle double up icon" '+lIconUpOnClick+'></i>\
<i class="angle double right icon"></i>\
<div class="content">\
<div class="header" '+lSubItemActionOnClick+lSubItemActionOnRightClick+'>'+lResponseJSON.Result[i].title+'</div>\
<div class="description" '+lSubItemActionOnClick+lSubItemActionOnRightClick+'>process_id:'+lResponseJSON.Result[i].process_id+'; handle:'+lSubItemHandleId+'; class_name: '+lResponseJSON.Result[i].class_name+'; RECT:L'+lResponseJSON.Result[i].rectangle.left+' T'+lResponseJSON.Result[i].rectangle.top+' R'+lResponseJSON.Result[i].rectangle.right+' B'+lResponseJSON.Result[i].rectangle.bottom+'</div>\
<div class="header" '+lIconSelectOnClick+'>'+lTitle+'</div>\
<div class="description" '+lIconSelectOnClick+'>process_id:'+lResponseJSON.Result[i].process_id+'; handle:'+lSubItemHandleId+'; class_name: '+lResponseJSON.Result[i].class_name+'; RECT:L'+lResponseJSON.Result[i].rectangle.left+' T'+lResponseJSON.Result[i].rectangle.top+' R'+lResponseJSON.Result[i].rectangle.right+' B'+lResponseJSON.Result[i].rectangle.bottom+'</div>\
<a class="ui tag label teal mini" '+lSubItemActionOnRightClick+'>Highlight</a>\
<a class="ui tag label teal mini" '+lSubItemActionOnClick+'>Expand</a>\
<a class="ui tag label teal mini" '+lIconUpOnClick+'>Mouse search</a>\
</div>\
</div>'
//Добавить информацию об элементе в словарь JS
@ -260,7 +288,7 @@
mGlobal.TreeObjectInfoLoad =function (inElementId) {
//Подгрузка массива спецификаций
lSpecificationArray = mGlobal.GUIElement[inElementId].GUISelectorFull
var lHTMLList='<div class="ui relaxed divided list" style="height:350px;overflow:scroll;">'
var lHTMLList='<div class="ui relaxed divided list" style="height:'+mGlobal.Settings.mUIOTreeHeight+'px;overflow:scroll;">'
var lSpecificationArrayNew=[]
for (i=0;i<lSpecificationArray.length;i++) {
lSpecificationArrayNew.push(lSpecificationArray[i])
@ -313,7 +341,7 @@
success:
function(lData,l2,l3)
{
var lHTMLList='<div class="ui relaxed divided list" style="height:350px;overflow:scroll;">'
var lHTMLList='<div class="ui relaxed divided list" style="height:'+mGlobal.Settings.mUIOTreeHeight+'px;overflow:scroll;">'
var lResponseJSON = JSON.parse(lData)
///Ошибка
if (lResponseJSON["ErrorFlag"]) {
@ -453,7 +481,7 @@
})
;
///Показать ошибку, если таковая возникла
if (lDataJSONlDataJSON["ErrorFlag"]) {
if (lDataJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback);
}
},
@ -513,7 +541,7 @@
var lDataJSON=JSON.parse(lData)
$(".gui-code-list-run-result").html(lDataJSON.outputObject)
///Показать ошибку, если таковая возникла
if (lDataJSONlDataJSON["ErrorFlag"]) {
if (lDataJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback);
}
},
@ -557,13 +585,62 @@
var lDataJSON=JSON.parse(lData)
$(".gui-result").html(lDataJSON.Result)
///Показать ошибку, если таковая возникла
if (lDataJSONlDataJSON["ErrorFlag"]) {
if (lDataJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback);
}
},
dataType: "text"
});
}
///////////////////////////////////////////////
////OtherActivity
///////////////////////////////////////////////
///Выполнить действие
mGlobal.OtherActivityRun = function () {
var lModuleName=$('.openrpa-other-activity-module-name-input')[0].value
var lActivityName=$('.openrpa-other-activity-activity-name-input')[0].value
var lArgumentList=$('.openrpa-other-activity-argument-list-input')[0].value
var lArgumentDict=$('.openrpa-other-activity-argument-dict-input')[0].value
///Доп. обработка
if (lArgumentList=="") lArgumentList="[]"
if (lArgumentDict=="") lArgumentDict="{}"
///Загрузка данных
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"ModuleName":"'+lModuleName+'","ActivityName":"'+lActivityName+'","ArgumentList":'+lArgumentList+',"ArgumentDict":'+lArgumentDict+'}',
success:
function(lData,l2,l3)
{
var lDataJSON=JSON.parse(lData)
$(".gui-code-list-run-result").html(lData)
///Показать ошибку, если таковая возникла
if (lDataJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback);
}
},
dataType: "text"
});
}
///Добавить действие в список на исполнение
mGlobal.OtherActivityCodeListAppend = function() {
var lModuleName=$('.openrpa-other-activity-module-name-input')[0].value
var lActivityName=$('.openrpa-other-activity-activity-name-input')[0].value
var lArgumentList=$('.openrpa-other-activity-argument-list-input')[0].value
var lArgumentDict=$('.openrpa-other-activity-argument-dict-input')[0].value
///Доп. обработка
if (lArgumentList=="") lArgumentList="[]"
if (lArgumentDict=="") lArgumentDict="{}"
///Сформировать строку спецификации действия
lActionSpecificationObject = {"ModuleName":lModuleName,"ActivityName":lActivityName,"ArgumentList":JSON.parse(lArgumentList),"ArgumentDict":JSON.parse(lArgumentDict)}
lActionSpecificationString = '{"ModuleName":"'+lModuleName+'","ActivityName":"'+lActivityName+'","ArgumentList":'+lArgumentList+',"ArgumentDict":'+lArgumentDict+'}'
///Добавить в массив действий
mGlobal.ActionSpecificationList.push(lActionSpecificationObject)
///Обновить визуализацию
mGlobal.CodeList.fRender()
}
// fix main menu to page on passing
$('.main.menu').visibility({
type: 'fixed'
@ -599,7 +676,7 @@
///Очистить дерево
mGlobal.ElementTree.fClear();
///Прогрузить новое дерево
mGlobal.ElementTree.fRender(lResponseJSON.Result);
mGlobal.ElementTree.fRender(lResponseJSON.Result,$(".openrpa-value-backend")[0].value);
///Показать ошибку, если таковая возникла
if (lResponseJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lResponseJSON.ErrorMessage+" \nTraceback: "+lResponseJSON.ErrorTraceback);
@ -682,6 +759,7 @@
<i class="icon redo alternate"></i>
Restart Studio
</button>
<b style="font-size:10px;color: #b1b1b1;" >Backend: win32 or uia</b>
</div>
<div class="two wide column">
<h2 class="ui header inverted" style="margin-bottom:5px;">OpenRPA</h2>
@ -715,7 +793,8 @@
</div>
<div class="row">
<div class="eight wide column">
<div class="ui tiny header">Edit GUI selector</div>
<div class="ui tiny header" style="margin-bottom:0px;">Edit GUI selector</div>
<b style="font-size:10px;color: #797979;" >[{depth_start: &lt1+&gt, depth_end: &lt1+&gt, index|ctrl_index: &lt0+&gt, title: &ltstr&gt, rich_text: &ltstr&gt, class_name: &ltstr&gt, friendly_class_name: &ltstr&gt, control_type: &ltstr&gt}]</b>
<textarea style="width:100%; font-size:12pt" class="rpa-gui-selector" rows="6" cols="60"></textarea>
<button class="large ui blue button rpa-action-highlight" onclick="mGlobal.ElementHighlightNewGUISelectorString($('.rpa-gui-selector')[0].value);">Highlight element</button>
<button class="large ui grey button rpa-action-validate" onclick="mGlobal.ElementValidateGUISelectorString($('.rpa-gui-selector')[0].value);">Validate element</button>
@ -752,10 +831,28 @@
</div>
<div class="row">
<div class="eight wide column">
<div class="ui tiny header">Additional actions</div>
<div class="ui tiny header">Other activity</div>
<a class="ui tag label teal mini" onclick="$('.openrpa-other-activity-module-name-input')[0].value='time'; $('.openrpa-other-activity-activity-name-input')[0].value='sleep'; $('.openrpa-other-activity-argument-list-input')[0].value='[3]'; $('.openrpa-other-activity-argument-dict-input')[0].value=''; $('.gui-code-result').html('');">Sleep 3s</a>
<a class="ui tag label teal mini" onclick="$('.openrpa-other-activity-module-name-input')[0].value='Window'; $('.openrpa-other-activity-activity-name-input')[0].value='DialogYesNo'; $('.openrpa-other-activity-argument-list-input')[0].value='[&quot;Type title here&quot;,&quot;Type body message here&quot;]'; $('.openrpa-other-activity-argument-dict-input')[0].value=''; $('.gui-code-result').html('');">Show dialog YesNo</a>
<div class="ui tiny header">Module name</div>
<div class="ui input" style="width:300px;">
<input type="text" placeholder="time|keyboard|..." class="openrpa-other-activity-module-name-input">
</div>
<div class="ui tiny header">Activity name</div>
<div class="ui input" style="width:300px;">
<input type="text" placeholder="sleep|..." class="openrpa-other-activity-activity-name-input">
</div>
<div class="ui tiny header">Argument list</div>
<div class="ui input" style="width:300px;">
<input type="text" placeholder="[3]|[...]" class="openrpa-other-activity-argument-list-input">
</div>
<div class="ui tiny header">Argument dict</div>
<div class="ui input" style="width:300px;">
<input type="text" placeholder="{&quot;title&quot;:&quot;OpenRPA&quot;}|{...}" class="openrpa-other-activity-argument-dict-input">
</div>
<button class="large ui green button" onclick="mGlobal.OtherActivityRun();">Run activity</button>
<button class="large ui grey button" onclick="mGlobal.OtherActivityCodeListAppend();">+ Code list</button>
<div class="content gui-code-list-run-result"></div>
<button class="large ui pink button" onclick="mGlobal.GUIActionWaitAddToList();">Wait element 60s: add to list</button>
<button class="large ui pink button" onclick="mGlobal.GUIActionSleep2sAddToList();">Sleep 2s: add to list</button>
</div>
<div class="eight wide column">
<div class="ui tiny header">Code list</div>

Loading…
Cancel
Save