使用 AutoIT 在 HTML 更新时发送警报

发布于 2025-01-20 08:10:03 字数 507 浏览 5 评论 0原文

这可能是一个漫长的镜头,但是我的工作情况在其中一些自动化将很有用。在我的工作中,我们使用一个活动日志系统,该系统在工作空间中记录事件。每隔几秒钟,我们就会在活动日志中获得一个新事件,因此它总是在更新。是否可以使用Autoit不​​断读取该活动日志并在显示某个消息时创建弹出通知?

(即收到警报,发送通知和声音显示警报,所涉及的个人以及警报的位置)

任何帮助都将不胜感激,即使只是在一般方向上稍作推动

- update-- -

上图显示了我在工作中使用的网站的HTML。标记为<表ID =“ ActivityLog5”的部分包含事件的不断更新列表,因为事件全天发生。如果这使它变得更容易,那么你们都去

This might be a long shot, but I have a situation at work in which some automation will be useful. At my work, we use an activity log system that logs events across our workspace. Every few seconds, we get a new event in the activity log, so it's always updating. Is it possible to use AutoIT to constantly read that activity log and create a pop-up notification when a certain message is presented?

(i.e. Alarm received, send notification and sound displaying the alarm, the individual involved, and the location of the alarm)

Any help would be appreciated, even just a slight push in the general direction

--UPDATE--
HTML of the webpage

The picture above shows the HTML of the website I use at work. The section labeled <table id="activityLog5" contains a constantly updating list of events as events happen throughout the day. If this makes it easier, there you all go

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傾城如夢未必闌珊 2025-01-27 08:10:04

由于我们讨论了 AutoIT 的替代方案,因此以下是 Grease Monkey 脚本的脚本想法:

// Basicly your GreaseMonkey Script:

window.addEventListener('load', function() {
    var tableToMonitor = document.getElementById('activityLog5');
    var lastTimeChecked = tableToMonitor.rows.length;
    var intervalHandle = setInterval(function () {
        if (lastTimeChecked === tableToMonitor.rows.length) {
            return;
        }
        lastTimeChecked = tableToMonitor.rows.length;
            // Play your Sound
            // do what ever you want
            // finally make an alert
            setTimeout(function() {
                alert('NEW EVENT');
            }, 1);
    }, 1000); // check every second
});

// ---- Debug Code - not part of your script anymore
var next_id = 2;
function addLog() {
    var newEventRow = document.getElementById('activityLog5').insertRow(-1);
    newEventRow.id = next_id.toString();
    var newEventBox = newEventRow.insertCell(0);
    newEventBox.appendChild(document.createTextNode('New Event'));
    next_id = next_id + 1;
}
    <input type="button" value="Create a new Event" onclick="addLog()"/>
    <table id="activityLog5">
        <tbody>
            <tr id="1"><td>Log Entry</td></tr>
        </tbody>
    </table>

Since we talked about alternates of AutoIT, here would be the Script Idea for a Grease Monkey Script:

// Basicly your GreaseMonkey Script:

window.addEventListener('load', function() {
    var tableToMonitor = document.getElementById('activityLog5');
    var lastTimeChecked = tableToMonitor.rows.length;
    var intervalHandle = setInterval(function () {
        if (lastTimeChecked === tableToMonitor.rows.length) {
            return;
        }
        lastTimeChecked = tableToMonitor.rows.length;
            // Play your Sound
            // do what ever you want
            // finally make an alert
            setTimeout(function() {
                alert('NEW EVENT');
            }, 1);
    }, 1000); // check every second
});

// ---- Debug Code - not part of your script anymore
var next_id = 2;
function addLog() {
    var newEventRow = document.getElementById('activityLog5').insertRow(-1);
    newEventRow.id = next_id.toString();
    var newEventBox = newEventRow.insertCell(0);
    newEventBox.appendChild(document.createTextNode('New Event'));
    next_id = next_id + 1;
}
    <input type="button" value="Create a new Event" onclick="addLog()"/>
    <table id="activityLog5">
        <tbody>
            <tr id="1"><td>Log Entry</td></tr>
        </tbody>
    </table>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文