Here: [Resolved] Schedule a script to run
To schedule a task has a provided solution…
Solution: save the script as HTML (plus autorun) then schedule it with Task Scheduler.
… but this is no longer available.
I assume Task Scheduler is still used to trigger but how is it that I should export or reference a script / macro since this is no longer an option through this method, what alternative methods are available?
Original exported html file is :
<!doctype html>
<html lang="en">
<head>
<title>UI.Vision Shortcut Page</title>
</head>
<body>
<h3>Command line:</h3>
<a id="run" href="ui.vision.html?direct=1&closeRPA=1&closeBrowser=1&savelog=log.txt¯o=TEST.json">Click here</a>
<br>
<br>
<!-- To start another macro just edit this HTML file and change the macro name in the command line above^. -->
<!-- For more command line parameters see https://ui.vision/rpa/docs#cmd -->
<script>
window.location.href = document.getElementById("run").getAttribute("href");
</script>
</body>
</html>
We need a command use browser to view the above html file:
@echo off
echo Start TEST
set "fx32Path=C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
set "fx64Path=C:\Program Files\Mozilla Firefox\firefox.exe"
set "macroFP=file:///D:/uivision/start-TEST.html"
REM check 64 bit version
if exist "%fx64Path%" (
start "" "%fx64Path%" -headless -p "PPP" -new-window "%macroFP%"
exit
)
REM No 64 bit version installed, check 32 bit version
if exist "%fx32Path%" (
start "" "%fx32Path%" -headless -p "PPP" -new-window "%macroFP%"
exit
)
REM neither to show error
echo No FX Installed
I’m trying browser command in bat to view ui.vision.html and run Macro directly:
@echo off
echo Start TEST
set "fx32Path=C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
set "fx64Path=C:\Program Files\Mozilla Firefox\firefox.exe"
set "macroFP=file:///D:/uivision/ui.vision.html?macro=TEST"
REM check 64 bit version
if exist "%fx64Path%" (
start "" "%fx64Path%" -headless -p "PPP" -new-window "%macroFP%&direct=1&closeRPA=1&closeBrowser=1&savelog=log.txt"
exit
)
REM No 64 bit version installed, check 32 bit version
if exist "%fx32Path%" (
start "" "%fx32Path%" -headless -p "PPP" -new-window "%macroFP%&direct=1&closeRPA=1&closeBrowser=1&savelog=log.txt"
exit
)
REM neither to show error
echo No FX Installed
Where is ui.vision.html? set “macroFP=file:///D:/uivision/ui.vision.html?macro=TEST”. I have a ‘start-TEST.html’, the batch file, but it is looking for ui.vision.html.
Below is ui.vision.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>UI.Vision Autostart Page</title>
</head>
<body>
<h3>Starting Browser and UI.Vision...</h3>
<script>
(function() {
var isExtensionLoaded = function () {
const $root = document.documentElement
return !!$root && !!$root.getAttribute('data-kantu')
}
var increaseCountInUrl = function (max) {
var url = new URL(window.location.href)
var count = 1 + (parseInt(url.searchParams.get('reload') || 0))
url.searchParams.set('reload', count)
var nextUrl = url.toString()
var shouldStop = count > max
return [shouldStop, !shouldStop ? nextUrl : null]
}
var run = function () {
try {
var evt = new CustomEvent('kantuSaveAndRunMacro', {
detail: {
html: document.documentElement.outerHTML,
noImport: true,
storageMode: 'xfile'
}
})
window.dispatchEvent(evt)
var intervalTimer = setInterval(() => window.dispatchEvent(evt), 1000);
if (window.location.protocol === 'file:') {
var onInvokeSuccess = function () {
clearTimeout(timer)
clearTimeout(reloadTimer)
clearInterval(intervalTimer)
window.removeEventListener('kantuInvokeSuccess', onInvokeSuccess)
}
var timer = setTimeout(function () {
alert('Error #203: It seems you need to turn on *Allow access to file URLs* for Kantu in your browser extension settings.')
}, 8000)
window.addEventListener('kantuInvokeSuccess', onInvokeSuccess)
}
} catch (e) {
alert('Kantu Bookmarklet error: ' + e.toString());
}
}
var reloadTimer = null
var main = function () {
if (isExtensionLoaded()) return run()
var MAX_TRY = 3
var INTERVAL = 1000
var tuple = increaseCountInUrl(MAX_TRY)
if (tuple[0]) {
return alert('Error #204: It seems UI.Vision RPA is not installed yet - or you need to turn on *Allow access to file URLs* for UI.Vision RPA in your browser extension settings.')
} else {
reloadTimer = setTimeout(function () {
window.location.href = tuple[1]
}, INTERVAL)
}
}
setTimeout(main, 500)
})();
</script>
</body>
</html>
You can visit UI Automation Open-Source Selenium IDE plus additional features, iMacros alternative for more.
TY. That was the missing piece to the puzzle.