Skip to content

Commit

Permalink
V9.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
A9T9 committed Oct 28, 2024
1 parent 6f37cc4 commit c65f149
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 63 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Ui.Vision [RPA](https://ui.vision/rpa)

- Modern Robotic Process Automation plus Selenium IDE++
- Modern Robotic Process Automation, Selenium IDE compatible

Questions? Suggestions? - Meet us in the UI.Vision [RPA user forum](https://forum.ui.vision).
Questions? Suggestions? - Meet us in the Ui.Vision [RPA user forum](https://forum.ui.vision).

Every user benefits from the questions and answers provided in the forum, that is why we would ask you to post the question [in the RPA forum](https://forum.ui.vision) first if a public forum is appropriate for your question. The forum is monitored by active users, tech support and the developers, so we would like to concentrate the discussion "over there" in one place.

Expand Down
12 changes: 8 additions & 4 deletions dist/content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,9 @@ var CaptureScreenshotService = exports.CaptureScreenshotService = /*#__PURE__*/f
function CaptureScreenshotService(params) {
_classCallCheck(this, CaptureScreenshotService);
this.params = params;
this.captureVisibleTab = typeof chrome !== 'undefined' && typeof chrome.tabs !== 'undefined' && typeof chrome.tabs.MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND === 'number' ? (0, _ts_utils.throttlePromiseFunc)(this.params.captureVisibleTab, chrome.tabs.MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND * 1000 + 100) : this.params.captureVisibleTab;
// default value to be 2
var MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND = typeof chrome !== 'undefined' && typeof chrome.tabs !== 'undefined' && typeof chrome.tabs.MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND === 'number' ? chrome.tabs.MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND : 2;
this.captureVisibleTab = (0, _ts_utils.throttlePromiseFunc)(this.params.captureVisibleTab, MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND * 1000 + 100);
}
_createClass(CaptureScreenshotService, [{
key: "saveScreen",
Expand Down Expand Up @@ -4967,12 +4969,14 @@ var OcrMatchesHighlighter = exports.OcrMatchesHighlighter = /*#__PURE__*/functio
function getNumberSet(num, type) {
if (parseInt(num) > 0 && type == 'X') {
return ['>', parseInt(num)];
} else if (parseInt(num) < 0 && type == 'X') {
} else if (parseInt(num) <= 0 && type == 'X') {
return ['<', parseInt(num.replace('-', ''))];
} else if (parseInt(num) > 0 && type == 'Y') {
return ['^', parseInt(num)];
} else {
} else if (parseInt(num) <= 0 && type == 'Y') {
return ['v', parseInt(num.replace('-', ''))];
} else {
throw new Error('Invalid input');
}
}
function getAllNumbersWithSign(str) {
Expand Down Expand Up @@ -5016,7 +5020,7 @@ var OcrMatchesHighlighter = exports.OcrMatchesHighlighter = /*#__PURE__*/functio
ocrCalibration = 7;
}
for (x in countCalObj) {
if (x == 'v' || x == 'v') {
if (x == 'v') {
yD += rect['y'] + ocrCalibration * countCalObj[x]; //down (add in y offset)
}
if (x == '>') {
Expand Down
3 changes: 2 additions & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "__MSG_description__",
"short_name": "__MSG_short_name__",
"default_locale": "en",
"version": "9.3.3",
"version": "9.3.5",
"icons": {
"128": "logo128.png"
},
Expand Down Expand Up @@ -58,6 +58,7 @@
"notifications",
"storage",
"tabs",
"activeTab",
"proxy",
"nativeMessaging",
"contextMenus",
Expand Down
16 changes: 11 additions & 5 deletions dist/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,9 @@ var CaptureScreenshotService = exports.CaptureScreenshotService = /*#__PURE__*/f
function CaptureScreenshotService(params) {
_classCallCheck(this, CaptureScreenshotService);
this.params = params;
this.captureVisibleTab = typeof chrome !== 'undefined' && typeof chrome.tabs !== 'undefined' && typeof chrome.tabs.MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND === 'number' ? (0, _ts_utils.throttlePromiseFunc)(this.params.captureVisibleTab, chrome.tabs.MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND * 1000 + 100) : this.params.captureVisibleTab;
// default value to be 2
var MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND = typeof chrome !== 'undefined' && typeof chrome.tabs !== 'undefined' && typeof chrome.tabs.MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND === 'number' ? chrome.tabs.MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND : 2;
this.captureVisibleTab = (0, _ts_utils.throttlePromiseFunc)(this.params.captureVisibleTab, MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND * 1000 + 100);
}
_createClass(CaptureScreenshotService, [{
key: "saveScreen",
Expand Down Expand Up @@ -19427,18 +19429,19 @@ var interpretCsFreeCommands = function interpretCsFreeCommands(_ref14) {
});
hit = searchResult.hit, all = searchResult.all;
console.log('searchResult :>> ', searchResult);
console.log('command :>> ', command);

// if (command.extra && command.extra.throwError != undefined && command.extra.throwError != true)
if (!(command.mode_type != undefined && command.mode_type == 'local' && command.extra && command.extra.throwError != true)) {
_context2.next = 10;
_context2.next = 11;
break;
}
if (!(searchResult.all.length == 0)) {
_context2.next = 10;
_context2.next = 11;
break;
}
throw new Error("E311: OCR text match for '".concat(str, "' not found"));
case 10:
case 11:
newVars = function () {
if (!hit) {
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, value, 0), '!ocrx', 0), '!ocry', 0), '!ocrwidth', 0), '!ocrheight', 0), '!ocr_left_x', 0), '!ocr_right_x', 0);
Expand Down Expand Up @@ -19505,7 +19508,7 @@ var interpretCsFreeCommands = function interpretCsFreeCommands(_ref14) {
best: hit
});
}));
case 16:
case 17:
case "end":
return _context2.stop();
}
Expand Down Expand Up @@ -20926,6 +20929,7 @@ var interpretCsFreeCommands = function interpretCsFreeCommands(_ref14) {
if (_isRelative4 && realTarget.type !== 'visual_search') {
throw new Error("E319: ".concat(cmd, " only accepts a vision image as target"));
}
(0, _log["default"])('realTarget:>> ', realTarget);
switch (realTarget.type) {
case 'locator':
{
Expand Down Expand Up @@ -21105,6 +21109,7 @@ var interpretCsFreeCommands = function interpretCsFreeCommands(_ref14) {
return Promise.all([runCsFreeCommands(_objectSpread(_objectSpread({}, command), {}, {
cmd: 'OCRSearch',
target: target.split('#')[0],
mode_type: 'local',
value: '__ocrResult__'
})), (0, _cv_utils.isCVTypeForDesktop)(vars.get('!CVSCOPE')) ? (0, _xy.getNativeXYAPI)().getScalingFactor() : Promise.resolve(1)]);
}).then(function (_ref50) {
Expand Down Expand Up @@ -21220,6 +21225,7 @@ var interpretCsFreeCommands = function interpretCsFreeCommands(_ref14) {
return Promise.all([runCsFreeCommands(_objectSpread(_objectSpread({}, command), {}, {
cmd: 'OCRSearch',
target: target,
mode_type: 'local',
value: '__ocrResult__'
})), (0, _cv_utils.isCVTypeForDesktop)(vars.get('!CVSCOPE')) ? (0, _xy.getNativeXYAPI)().getScalingFactor() : Promise.resolve(1)]);
}).then(function (_ref52) {
Expand Down
3 changes: 2 additions & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "__MSG_description__",
"short_name": "__MSG_short_name__",
"default_locale": "en",
"version": "9.3.3",
"version": "9.3.5",

"icons": {
"128": "logo128.png"
Expand Down Expand Up @@ -64,6 +64,7 @@
"notifications",
"storage",
"tabs",
"activeTab",
"proxy",
"nativeMessaging",
"contextMenus",
Expand Down
15 changes: 8 additions & 7 deletions src/common/capture_screenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ export class CaptureScreenshotService {
private captureVisibleTab: CaptureVisibleTabFunc

constructor (private params: CaptureScreenshotServiceParams) {
this.captureVisibleTab =
typeof chrome !== 'undefined' &&
typeof chrome.tabs !== 'undefined' &&
typeof (chrome.tabs as any).MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND === 'number'
? throttlePromiseFunc(this.params.captureVisibleTab, (chrome.tabs as any).MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND * 1000 + 100)
: this.params.captureVisibleTab

// default value to be 2
const MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND =
typeof chrome !== 'undefined' &&
typeof chrome.tabs !== 'undefined' &&
typeof (chrome.tabs as any).MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND === 'number'
? (chrome.tabs as any).MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND : 2

this.captureVisibleTab = throttlePromiseFunc(this.params.captureVisibleTab, MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND * 1000 + 100)
}

saveScreen (screenshotStorage: IStandardStorage & IWithLinkStorage, tabId: number, fileName: string, devicePixelRatio: number): Promise<{ url: string; fileName: string }> {
Expand Down
21 changes: 19 additions & 2 deletions src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,26 @@ class Header extends React.Component {
// firefox requires explicit permission to access all urls
// ask user to grant permission, return promise
askPermission = () => {

// test code:
// const permissions = chrome.runtime.getManifest().permissions || [];
// console.log('permission:>> ', permissions)
// let allUrlPermissions = {
// origins: ["<all_urls>"],
// permissions: ['activeTab', 'tabs']
// };
// return new Promise((resolve, reject) => {
// Ext.permissions.request(allUrlPermissions).then((result) => {
// console.log('permission result:>>', result)
// resolve(true)
// }).catch(e => {
// console.log('e:>>', e)
// })
// })

return new Promise((resolve, reject) => {
if (Ext.isFirefox()) {
Ext.permissions.contains({ origins: ["<all_urls>"] }).then(
Ext.permissions.contains({ origins: ["<all_urls>"]}).then(
(permissionGranted) => {
if (!permissionGranted) {
Modal.confirm({
Expand Down Expand Up @@ -352,7 +369,7 @@ class Header extends React.Component {
} else {
resolve(true);
}
}
}
)
} else {
resolve(true);
Expand Down
7 changes: 4 additions & 3 deletions src/containers/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ class Dashboard extends React.Component {
<a href="https://goto.ui.vision/x/idehelp?help=visual" target="_blank"></a>
</div>
<div>
Ui.Vision:
<a href="https://goto.ui.vision/x/idehelp?help=forum" target="_blank"> User Forum</a> -
<a href="https://goto.ui.vision/x/idehelp?help=docs" target="_blank"> Online Help</a>
Ui.Vision Community:&nbsp;
<a href="https://goto.ui.vision/x/idehelp?help=forum" target="_blank">Forums</a>&nbsp;|&nbsp;
<a href="https://goto.ui.vision/x/idehelp?help=docs" target="_blank">Docs</a>&nbsp;|&nbsp;
<a href="https://goto.ui.vision/x/idehelp?help=github" target="_blank">Open-Source</a>
</div>
</div>
</div>
Expand Down
23 changes: 16 additions & 7 deletions src/ext/bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,14 @@ const onRequest = async (cmd, args) => {
// }

case 'PANEL_CAPTURE_VISIBLE_TAB': {
return Ext.tabs.captureVisibleTab(args.windowId, args.options)
return Ext.tabs.captureVisibleTab(args.windowId, args.options).catch(e => {
console.log('captureVisibleTab e:>>', e)
if(e == "Error: Missing activeTab permission"){
throw new Error('Error E144: Screenshot permission issue. To fix, please reload extension.' +
'To do so, go to extension settings and turn the blue switch OFF and then ON again.')
}
throw e;
})
}

case 'PANEL_SET_PROXY': {
Expand Down Expand Up @@ -2129,7 +2136,8 @@ const initOnInstalled = () => {
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'production') {
Ext.runtime.setUninstallURL(config.urlAfterUninstall)

Ext.runtime.onInstalled.addListener(({ reason, previousVersion }) => {
chrome.runtime.onInstalled.addListener(({ reason, previousVersion }) => {
// * Why doesn't it fire in firefox?
switch (reason) {
case 'install': {
storage.get('config')
Expand All @@ -2139,18 +2147,19 @@ const initOnInstalled = () => {
showTestCaseTab: false
})
})

return Ext.tabs.create({
url: config.urlAfterInstall
})
url: config.urlAfterInstall
})
}

case 'update':
case 'update': {
Ext.action.setBadgeText({ text: 'NEW' })
Ext.action.setBadgeBackgroundColor({ color: '#4444FF' })
Ext.action.setBadgeBackgroundColor({ color: '#4444FF' })
return Ext.storage.local.set({
upgrade_not_viewed: 'not_viewed'
})
}
}
})
}
Expand Down
65 changes: 37 additions & 28 deletions src/init_player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,8 @@ const interpretCsFreeCommands = ({ store, vars, getTcPlayer, getInterpreter, xCm
const { hit, all } = searchResult

console.log('searchResult :>> ', searchResult);
console.log('command :>> ', command);


// if (command.extra && command.extra.throwError != undefined && command.extra.throwError != true)
if (command.mode_type != undefined && command.mode_type == 'local' && command.extra && command.extra.throwError != true) {
Expand Down Expand Up @@ -3004,6 +3006,8 @@ const interpretCsFreeCommands = ({ store, vars, getTcPlayer, getInterpreter, xCm
throw new Error(`E319: ${cmd} only accepts a vision image as target`)
}

log('realTarget:>> ', realTarget)

switch (realTarget.type) {
case 'locator': {
return runCommand({
Expand Down Expand Up @@ -3203,42 +3207,45 @@ const interpretCsFreeCommands = ({ store, vars, getTcPlayer, getInterpreter, xCm
}

case 'ocrTextXmoveRelative': {
let isRelative = (/relative/i.test(cmd) && !(/XMoveText/i.test(cmd)));
return csIpc.ask('PANEL_CLEAR_OCR_MATCHES_ON_PLAYING_PAGE')
.catch(() => {})
.then(() => delay(() => {}, 1000))
.then(() => {
return Promise.all([
let isRelative =
/relative/i.test(cmd) && !/XMoveText/i.test(cmd);
return csIpc
.ask('PANEL_CLEAR_OCR_MATCHES_ON_PLAYING_PAGE')
.catch(() => {})
.then(() => delay(() => {}, 1000))
.then(() => {
return Promise.all([
runCsFreeCommands({
...command,
cmd: 'OCRSearch',
target: target.split('#')[0],
value: '__ocrResult__'
...command,
cmd: 'OCRSearch',
target: target.split('#')[0],
mode_type: 'local',
value: '__ocrResult__',
}),
isCVTypeForDesktop(vars.get('!CVSCOPE'))
? getNativeXYAPI().getScalingFactor()
: Promise.resolve(1)
])
})
.then(([result, scalingFactor]) => {
const isDesk = isCVTypeForDesktop(vars.get('!CVSCOPE'));
if (extra && extra.debugVisual && isDesk) {
? getNativeXYAPI().getScalingFactor()
: Promise.resolve(1),
]);
})
.then(([result, scalingFactor]) => {
const isDesk = isCVTypeForDesktop(vars.get('!CVSCOPE'));
if (extra && extra.debugVisual && isDesk) {
return {
byPass: true,
vars: {
[value]: ''
}
}
}
byPass: true,
vars: {
[value]: '',
},
};
}

const { best } = result
if (!best) throw new Error(`E311: No OCR text match found for '${target}'`)

let rect = {
x : result.best.words[0].word.Left,
y :result.best.words[0].word.Top,
height :result.best.words[0].word.Height,
width :result.best.words[0].word.Width
x : result.best.words[0].word.Left,
y :result.best.words[0].word.Top,
height :result.best.words[0].word.Height,
width :result.best.words[0].word.Width
}

let getTickCounter = str => {
Expand Down Expand Up @@ -3322,7 +3329,7 @@ const interpretCsFreeCommands = ({ store, vars, getTcPlayer, getInterpreter, xCm
})
}
})
})
})
}

case 'ocrTextXmove': {
Expand All @@ -3337,6 +3344,7 @@ const interpretCsFreeCommands = ({ store, vars, getTcPlayer, getInterpreter, xCm
...command,
cmd: 'OCRSearch',
target: target,
mode_type: 'local',
value: '__ocrResult__',
}),
isCVTypeForDesktop(vars.get('!CVSCOPE'))
Expand Down Expand Up @@ -3399,6 +3407,7 @@ const interpretCsFreeCommands = ({ store, vars, getTcPlayer, getInterpreter, xCm
})
})
}

case 'ocrText': {
return runCsFreeCommands({
...command,
Expand Down
Loading

0 comments on commit c65f149

Please sign in to comment.