@ -32,7 +32,22 @@
document.execCommand('copy');
document.body.removeChild(el);
};
///Функция перезапуска студии
mGlobal.Actions.fRestartStudioServer= function()
{
///Загрузка данных
$.ajax({
type: "POST",
url: 'RestartStudio',
data: '',
success:
function(lData,l2,l3)
{
var lResponseJSON=JSON.parse(lData);
},
dataType: "text"
});
}
///Функция клонирования объекта
mGlobal.iSysClone=function(obj,lIsCloneSubProperty,lSubItemCallback) {
///Выполнить инициализацию переменной, если она не была передана
@ -74,13 +89,13 @@
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"functionName":"AutomationSearchMouseElementHierarchy","argsArray ":['+JSON.stringify(lSpecificationArray)+']}',
data: '{"ModuleName":"GUI", "ActivityName":"UIOSelector_SearchChildByMouse_UIOTree","ArgumentList ":['+JSON.stringify(lSpecificationArray)+']}',
success:
function(lData,l2,l3)
{
var lResponseJSON=JSON.parse(lData);
///Подготовить структуру рендеринга, если у текущего объекта имееется родитель
var lStructureToRender=lResponseJSON.outputObjec t;
var lStructureToRender=lResponseJSON.Resul t;
if (lSpecificationArray.length>1) {
var lStructureToRenderParent=[]
var lStructureToRenderLocal=lStructureToRenderParent;
@ -99,12 +114,15 @@
}
}
}
///Отображение ошибки
if (lResponseJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lResponseJSON.ErrorMessage+" \nTraceback: "+lResponseJSON.ErrorTraceback);
} else {
///Очистить дерево
mGlobal.ElementTree.fClear();
///Прогрузить новое дерево
mGlobal.ElementTree.fRender(lStructureToRender);
if (lResponseJSON.hasOwnProperty("Error")) {
mGlobal.ShowModal("GUI Error",lResponseJSON.Error);
}
},
dataType: "text"
@ -154,7 +172,7 @@
///Генерация кода HTML
var lResultString="";
var lSubItemActionOnClick=' onclick="mGlobal.TreeLoadSubTree(\''+lElementId+'\');" '
var lSubItemActionOnRightClick=' oncontextmenu ="mGlobal.ElementHighlightNew(\''+lElementId+'\');" '
var lSubItemActionOnRightClick=' onclick ="mGlobal.ElementHighlightNew(\''+lElementId+'\');" '
var lIconSelectOnClick=' onclick="mGlobal.TreeObjectInfoLoad(\''+lElementId+'\');" '
var lIconTestOnClick=' onclick="mGlobal.Test(\''+lElementId+'\');" '
var lIconUpOnClick=' onclick="mGlobal.Actions.fAutomationSearchMouseElementHierarchyRun(\''+lElementId+'\');" '
@ -175,14 +193,14 @@
}
///Генерация кода текущего элемента
lResultString+='\
< div class = "item" 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 > \
< div class = "item" id = "'+lElementId+'" style = "padding:5px;" > \
< i class = "angle double right icon" > < / i > \
< div class = "content" > \
< div class = "header" ' + lSubItemActionOnClick + lSubItemActionOnRightClick + ' > '+inItem.title+'< / div > \
< div class = "description" ' + lSubItemActionOnClick + lSubItemActionOnRightClick + ' > process_id:'+inItem.process_id+'; handle:'+inItem.handle+'; class_name: '+inItem.class_name+'; RECT:L'+inItem.rectangle.left+' T'+inItem.rectangle.top+' R'+inItem.rectangle.right+' B'+inItem.rectangle.bottom+'< / div > \
< div class = "header" ' + lIconSelectOnClick + ' > '+inItem.title+'< / div > \
< div class = "description" ' + lIconSelectOnClick + ' > process_id:'+inItem.process_id+'; handle:'+inItem.handle+'; class_name: '+inItem.class_name+'; RECT:L'+inItem.rectangle.left+' T'+inItem.rectangle.top+' R'+inItem.rectangle.right+' B'+inItem.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 > \
'+lSubListHTML+'\
< / div > \
< / div > '
@ -196,15 +214,15 @@
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"functionName":"ElementGetChildElementList","argsArray ":['+JSON.stringify(lSpecificationArray)+']}',
data: '{"ModuleName":"GUI", "ActivityName":"UIOSelector_GetChildList_UIOList","ArgumentList ":['+JSON.stringify(lSpecificationArray)+']}',
success:
function(lData,l2,l3)
{
var lHTMLTree='< div class = "ui list" > '
var lResponseJSON=JSON.parse(lData)
for (i=0;i< lResponseJSON. outputObjec t.length; i + + ) {
for (i=0;i< lResponseJSON. Resul t.length; i + + ) {
var lElementId = mGlobal.GenerateUniqueID()
var lSubItemHandleId=lResponseJSON.outputObjec t[i].handle;
var lSubItemHandleId=lResponseJSON.Resul t[i].handle;
var lSubItemActionOnClick=' onclick="mGlobal.TreeLoadSubTree(\''+lElementId+'\');" '
var lSubItemActionOnRightClick=' oncontextmenu="mGlobal.ElementHighlightNew(\''+lElementId+'\');" '
var lIconSelectOnClick=' onclick="mGlobal.TreeObjectInfoLoad(\''+lElementId+'\');" '
@ -218,21 +236,22 @@
< i class = "angle double right icon" ' + lIconTestOnClick + ' > < / i > \
< i class = "angle double up icon" ' + lIconUpOnClick + ' > < / i > \
< div class = "content" > \
< div class = "header" ' + lSubItemActionOnClick + lSubItemActionOnRightClick + ' > '+lResponseJSON.outputObjec t[i].title+'< / div > \
< div class = "description" ' + lSubItemActionOnClick + lSubItemActionOnRightClick + ' > process_id:'+lResponseJSON.outputObject[i].process_id+'; handle:'+lSubItemHandleId+'; class_name: '+lResponseJSON.outputObject[i].class_name+'; RECT:L'+lResponseJSON.outputObject[i].rectangle.left+' T'+lResponseJSON.outputObject[i].rectangle.top+' R'+lResponseJSON.outputObject[i].rectangle.right+' B'+lResponseJSON.outputObjec t[i].rectangle.bottom+'< / div > \
< div class = "header" ' + lSubItemActionOnClick + lSubItemActionOnRightClick + ' > '+lResponseJSON.Resul t[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.Resul t[i].rectangle.bottom+'< / div > \
< / div > \
< / div > '
//Добавить информацию о б элементе в словарь JS
mGlobal.GUIElement[lElementId]={};
mGlobal.GUIElement[lElementId]['GUISelectorLocal']=lResponseJSON.outputObjec t[i]
mGlobal.GUIElement[lElementId]['GUISelectorLocal']=lResponseJSON.Resul t[i]
mGlobal.GUIElement[lElementId]['GUISelectorFull']=Array.from(lSpecificationArray);
mGlobal.GUIElement[lElementId]['GUISelectorFull'].push(lResponseJSON.outputObjec t[i])
mGlobal.GUIElement[lElementId]['GUISelectorFull'].push(lResponseJSON.Resul t[i])
}
lHTMLTree+='< / div > '
$("#"+inElementId+" .content").append(lHTMLTree)
///Отображение ошибки
if (lResponseJSON.hasOwnProperty("Error")) {
mGlobal.ShowModal("GUI Error",lResponseJSON.Error);
if (lResponseJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lResponseJSON.ErrorMessage+" \nTraceback: "+lResponseJSON.ErrorTraceback);
}
},
dataType: "text"
@ -260,7 +279,7 @@
lHTMLList+='< / div > '
$(".rpa-hierarchy").html(lHTMLList)
$(".rpa-object-tree .item").css("background-color","");
$("#"+inElementId).css("background-color","RGB(128,128,128 )");
$("#"+inElementId).css("background-color","RGB(210,210,210 )");
///Создать урезанную версию селектора
lTextAreaSpecificationArray=mGlobal.iSysClone(lSpecificationArray,true);
for (var i = 0; i< lTextAreaSpecificationArray.length ; i + + ) {
@ -290,17 +309,18 @@
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"functionName":"ElementRunAction","argsArray ":['+JSON.stringify(lSpecificationArray)+',"get_properties"]}',
data: '{"ModuleName":"GUI", "ActivityName":"UIOSelectorUIOActivity_Run_Dict","ArgumentList ":['+JSON.stringify(lSpecificationArray)+',"get_properties"]}',
success:
function(lData,l2,l3)
{
var lHTMLList='< div class = "ui relaxed divided list" > '
var lHTMLList='< div class = "ui relaxed divided list" style = "height:350px;overflow:scroll;" > '
var lResponseJSON = JSON.parse(lData)
///Ошибка
if (lResponseJSON.hasOwnProperty("Error")) {
mGlobal.ShowModal("GUI Error",lResponseJSON.Error);
if (lResponseJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lResponseJSON.ErrorMessage+" \nTraceback: "+lResponseJSON.ErrorTraceback);
} else {
var lJSONData = JSON.parse(lData).outputObjec t
var lJSONData = JSON.parse(lData).Resul t
var lSpecificationArray=Object.keys(lJSONData)
for (i=0;i< lSpecificationArray.length ; i + + ) {
var lItemKey = lSpecificationArray[i]
@ -332,7 +352,8 @@
var lResponseJSON = JSON.parse(lData)
///Ошибка
if (lResponseJSON["ErrorFlag"]==true) {
mGlobal.ShowModal("GUI Error",lResponseJSON.ErrorMessage);
mGlobal.ShowModal("GUI Error",lResponseJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback);
}
},
dataType: "text"
@ -352,7 +373,7 @@
lDataJSON=JSON.parse(lData);
///Показать ошибку, если таковая возникла
if (lDataJSON["ErrorFlag"]==true) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage);
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback );
}
},
dataType: "text"
@ -365,13 +386,13 @@
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"functionName":"ElementDrawOutlineNewFocus","argsArray ":['+lSpecificationArray+']}',
data: '{"ModuleName":"GUI","ActivityName":"UIOSelector_FocusHighlight","ArgumentList ":['+lSpecificationArray+']}',
success:
function(lData,l2,l3)
{
lDataJSON=JSON.parse(lData);
if (lDataJSON.hasOwnProperty("Error") ) {
mGlobal.ShowModal("GUI Error",lDataJSON.Error);
if (lDataJSON["ErrorFlag"]==true ) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback );
}
},
dataType: "text"
@ -384,56 +405,22 @@
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"functionName":"PywinautoExtElementsGetInfo","argsArray ":['+lSpecificationArray+']}',
data: '{"ModuleName":"GUI","ActivityName":"UIOSelector_Get_UIOInfoList","ArgumentList ":['+lSpecificationArray+']}',
success:
function(lData,l2,l3)
{
lDataJSON=JSON.parse(lData);
if (Array.isArray(lDataJSON.outputObjec t)) {
if (Array.isArray(lDataJSON.Resul t)) {
lHTMLData=""
for (i=0;i< lDataJSON. outputObjec t.length; i + + ) {
for (i=0;i< lDataJSON. Resul t.length; i + + ) {
lHTMLData+='< p > '+
JSON.stringify(lDataJSON.outputObjec t[i])+
JSON.stringify(lDataJSON.Resul t[i])+
'< / p > '
}
$(".openrpa-validate-result").html(lHTMLData)
}
if (lDataJSON.hasOwnProperty("Error")) {
mGlobal.ShowModal("GUI Error",lDataJSON.Error);
}
},
dataType: "text"
});
}
mGlobal.Test = function (inElementId) {
//Подгрузка массива спецификаций
lSpecificationArray = mGlobal.GUIElement[inElementId].GUISelectorFull
///Загрузка данных
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"functionName":"ElementActionGetList","argsArray":['+JSON.stringify(lSpecificationArray)+']}',
success:
function(lData,l2,l3)
{
//lDataJSON=JSON.parse(lData.outputObject);
var lDataJSON=JSON.parse(lData)
var lDataKeyList=lDataJSON.outputObject
var lValueList=[]
for (var i = 0; i< lDataKeyList.length ; i + + ) {
if (lDataKeyList[i].length>0)
if (lDataKeyList[i][0]!="_")
lValueList.push({'name':lDataKeyList[i],'value':lDataKeyList[i]})
}
///Установка значений в dropdown
$('.ui.dropdown.gui-action')
.dropdown({
values: lValueList
})
;
///Показать ошибку, если таковая возникла
if (lDataJSON.hasOwnProperty("Error")) {
mGlobal.ShowModal("GUI Error",lDataJSON.Error);
if (lDataJSON["ErrorFlag"]) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback);
}
},
dataType: "text"
@ -446,13 +433,13 @@
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"functionName":"ElementActionGetList","argsArray ":['+lActionElementSpecification+']}',
data: '{"ModuleName":"GUI","ActivityName":"UIOSelector_Get_UIOActivityList","ArgumentList ":['+lActionElementSpecification+']}',
success:
function(lData,l2,l3)
{
//lDataJSON=JSON.parse(lData.outputObject);
lDataJSON=JSON.parse(lData)
var lDataKeyList=lDataJSON.outputObjec t
var lDataKeyList=lDataJSON.Resul t
var lValueList=[]
for (var i = 0; i< lDataKeyList.length ; i + + ) {
if (lDataKeyList[i].length>0)
@ -466,8 +453,8 @@
})
;
///Показать ошибку, если таковая возникла
if (lDataJSON.hasOwnProperty("Error") ) {
mGlobal.ShowModal("GUI Error",lDataJSON.Error);
if (lDataJSONlDataJSON["ErrorFlag"] ) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback );
}
},
dataType: "text"
@ -525,8 +512,8 @@
var lDataJSON=JSON.parse(lData)
$(".gui-code-list-run-result").html(lDataJSON.outputObject)
///Показать ошибку, если таковая возникла
if (lDataJSON.hasOwnProperty("Error") ) {
mGlobal.ShowModal("GUI Error",lDataJSON.Error);
if (lDataJSONlDataJSON["ErrorFlag"] ) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback );
}
},
dataType: "text"
@ -562,15 +549,15 @@
$.ajax({
type: "POST",
url: 'GUIAction',
data: '{"functionName":"ElementRunAction","argsArray ":['+lActionElementSpecification+',"'+lActionName+'",'+lActionArgumentList+']}',
data: '{"ModuleName":"GUI","ActivityName":"UIOSelectorUIOActivity_Run_Dict","ArgumentList ":['+lActionElementSpecification+',"'+lActionName+'",'+lActionArgumentList+']}',
success:
function(lData,l2,l3)
{
var lDataJSON=JSON.parse(lData)
$(".gui-result").html(lDataJSON.outputObjec t)
$(".gui-result").html(lDataJSON.Resul t)
///Показать ошибку, если таковая возникла
if (lDataJSON.hasOwnProperty("Error") ) {
mGlobal.ShowModal("GUI Error",lDataJSON.Error);
if (lDataJSONlDataJSON["ErrorFlag"] ) {
mGlobal.ShowModal("GUI Error",lDataJSON.ErrorMessage+" \nTraceback: "+lDataJSON.ErrorTraceback );
}
},
dataType: "text"
@ -613,8 +600,8 @@
///Прогрузить новое дерево
mGlobal.ElementTree.fRender(lResponseJSON.Result);
///Показать ошибку, если таковая возникла
if (lResponseJSON.hasOwnProperty("Error") ) {
mGlobal.ShowModal("GUI Error",lResponseJSON.Error);
if (lResponseJSON["ErrorFlag"] ) {
mGlobal.ShowModal("GUI Error",lResponseJSON.ErrorMessage+" \nTraceback: "+lResponseJSON.ErrorTraceback );
}
},
dataType: "text"
@ -688,10 +675,10 @@
< / div >
< div class = "eleven wide column" >
< div class = "ui input" >
< input class = "openrpa-value-backend" type = "text" placeholder = "Backend " value = "win32" >
< input class = "openrpa-value-backend" type = "text" placeholder = "Backend win32 | uia " value = "win32" >
< / div >
< button class = "ui labeled icon button red" onclick = " ">
< i class = " down icon "> < / i >
< button class = "ui labeled icon button red" onclick = " mGlobal.Actions.fRestartStudioServer(); ">
< i class = " icon redo alternate "> < / i >
Restart Studio
< / button >
< / div >
@ -706,30 +693,20 @@
< / div >
< div class = "six wide column rpa-hierarchy" >
< p > This example shows how to use lazy loaded images, a sticky menu, and a simple text container < / p >
< p > Select element in the tree to see hierarchy list < / p >
< / div >
< div class = "four wide column rpa-property-list" >
< / div >
< / div >
< div class = "row black" >
< div class = "t wo wide column">
< div class = "t hree wide column">
< button class = "ui button grey labeled icon mini" onclick = "mGlobal.GUIRefreshTree()" >
< i class = "up refresh icon" > < / i >
Refresh tree
< / button >
< / div >
< div class = "two wide column" >
< button class = "ui button grey labeled icon mini" >
< i class = "up arrow icon" > < / i >
From
< / button >
< / div >
< div class = "two wide column" >
< button class = "ui button grey labeled icon mini" >
< i class = "down arrow icon" > < / i >
To
< / button >
< div class = "three wide column" >
< / div >
< div class = "ten wide column" >
< / div >