从一个浏览器窗口复制文本到另一个浏览器窗口

发布于 2025-01-28 11:45:49 字数 333 浏览 3 评论 0原文

我有这两个浏览器窗口,它们在服装列表上的每个订单上都打开,并带有约18K订单。我必须手动从第一个窗口复制值,然后将它们粘贴到第二个窗口中的相应输入上。每个订单都必须重复这一点。

我正在考虑制造一个小工具,该工具允许识别窗口,复制所需的值并将其粘贴到第二个窗口上。 JavaScript&这是否可以html,还是C#?

I have this two browser windows, which are opened for each order on an apparel list with about 18K orders. I have to manually copy the values from the first window and paste them on the corresponding inputs in the second window. This has to be repeated for every single order.

I was thinking about making a small tool which allows to identify both windows, copy the needed values and paste them on the second window. Is this possible with Javascript & HTML, or maybe C#?

Example

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

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

发布评论

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

评论(3

痴情 2025-02-04 11:45:49

从技术上讲,这无法通过JavaScript实现。您可以使用一些自动化工具,例如自动启用,例如

某些键盘也支持Marco功能。您可以记录一个宏并复制每个记录,如果整个过程都可以重复。

Technically, this cannot be achieved via JavaScript. You can use some automation tools like AutoIt e.g.

Some Keyboards are also supporting Marco functions. You can record a Macro and copy every record if the entire process is repeatable.

雪花飘飘的天空 2025-02-04 11:45:49

我认为,这可以通过镀铬扩展来实现。

通常,Chrome扩展程序需要

  • 在左窗口上进行以下查询,并将其值存储在JS对象中。
  • 使用window.postmessage()API或类似的内容将JS对象发送到您收听消息并接收内容的另一个窗口(棘手的部分是定义谁是发件人,谁是接收者)。
  • 然后,将输入字段的值设置为接收的JS对象的值。

I think, this could be achieved with a chrome extension.

In general, the chrome extension needs to do the following

  • query all the input fields on the left window and store its values in a JS object.
  • use Window.postMessage() API or something similar to send the JS object to the other window where you listen to the message and receive the content (Tricky part is to define who is sender and who is receiver).
  • Then you set the value of the input fields to the values of the received js object.
香草可樂 2025-02-04 11:45:49

首先,在哪个平台,Windows或其他OS,
两个浏览器窗口是桌面应用程序或Web浏览器,
如果是Web浏览器,则可以尝试使用Selenium或剧作家,可以连接浏览器窗口并从窗口1刮擦数据并填写在窗口2中。

如果它是桌面应用程序或与Web浏览器混合,如果您熟悉Python,您,您,您可以尝试以下Visual Studio Extension Clicknium,它可以在Web和桌面应用上进行自动化,支持Recorde UI元素。

然后,这是从一个应用程序到另一个应用程序进行数据应对的简单方法。
以下是示例代码:

import subprocess
from time import sleep
from clicknium import clicknium as cc, locator, ui

def main():
    # sample code to demo web automation and desktop application
    tab = cc.edge.open("https://www.bing.com/")
    tab.find_element(
        locator.new_store.sample.bing.search_sb_form_q).set_text('clicknium')
    tab.find_element(locator.new_store.sample.bing.svg).click()
    sleep(3)
    tab.close()

    process = subprocess.Popen("notepad")
    ui(locator.new_store.sample.notepad.document_15).set_text("clicknium")

if __name__ == "__main__":
    main()

first, in which platform, windows or other os,
and two browser windows are desktop applications or web browser,
if it is web browser, you can try selenium or playwright, can attach the browser window and scraping the data from window 1 and filled in window 2.

if it is desktop application or mixed with web browser, and if you familiar with python, you can try the following visual studio extension clicknium, it can do automation on both web and desktop applation, support recorde the ui elements.

then it is easy way to do data coping from one application to another application.
the following is the sample code:

import subprocess
from time import sleep
from clicknium import clicknium as cc, locator, ui

def main():
    # sample code to demo web automation and desktop application
    tab = cc.edge.open("https://www.bing.com/")
    tab.find_element(
        locator.new_store.sample.bing.search_sb_form_q).set_text('clicknium')
    tab.find_element(locator.new_store.sample.bing.svg).click()
    sleep(3)
    tab.close()

    process = subprocess.Popen("notepad")
    ui(locator.new_store.sample.notepad.document_15).set_text("clicknium")

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