当表单页面最小化时,如何将条形码阅读器的值插入表单输入?

时间:2021-04-10 00:00:36

I have developed an attendance taking system with PHP and I am running it on localhost. The system is like this:

我用PHP开发了一个考勤系统,我在localhost上运行它。系统是这样的:

Suppose a student has a bar coded ID card and to take his attendance there is a barcode reader and the form I have developed. The barcode reader I have automatically pushes the submit button so as soon as I trigger the barcode reader's button, the value from the barcode is taken and after some processing some values are inserted into the database.

假设一个学生有一个条形码身份证并且他的出勤有一个条形码阅读器和我开发的表格。条形码阅读器我自动按下提交按钮,一旦我触发条形码阅读器的按钮,就会获取条形码的值,经过一些处理后,一些值被插入到数据库中。

Now it is working fine, but the problem is every time I take the attendance I need to open up the form first and then take the attendance. (I need to take attendance several times a day.) I was wondering if there is any way to take the attendance without having to open up the form repeatedly.

现在它工作正常,但问题是每次我需要出席我需要首先打开表格,然后参加。 (我需要每天参加几次。)我想知道是否有办法参加考试而不必反复打开表格。

If there is no solution for it, is it possible to keep the form page minimized and take attendances while someone is working on computer (doing something else)?

如果没有解决方案,是否可以保持表单页面最小化并在有人在计算机上工作时做出勤(做其他事情)?

2 个解决方案

#1


3  

This depends on how your barcode reader works, mostly. I infer from your description that:

这主要取决于条形码阅读器的工作方式。我从你的描述中推断:

  • The barcode reader, when activated, sends the data and emulates Enter
  • 条形码阅读器激活后,会发送数据并模拟回车

  • The data is populated in the active input element, or, I assume, anywhere that keyboard characters are accepted. Can be tested by opening a text editor and seeing if the data is accepted followed by a newline.
  • 数据填充在活动输入元素中,或者,我假设,接受键盘字符的任何位置。可以通过打开文本编辑器进行测试,看看数据是否被接受后跟换行符。

Next, you have a web application, which doesn't run in the background. Technically it's still active on the browser even while minimized, but once minimized the browser is no longer the application with focus, and therefore the data doesn't go to it.

接下来,您有一个Web应用程序,它不在后台运行。从技术上讲,即使在最小化的情况下,它仍然在浏览器上处于活动状态,但一旦最小化,浏览器就不再是具有焦点的应用程序,因此数据不会发挥作用。

So you have two problems:

所以你有两个问题:

  1. You need a way to get data from the barcode reader without affecting the current application. In other words, if someone is using a word processor, you don't want the barcode reader to suddenly insert random information in their work.
  2. 您需要一种从条形码阅读器获取数据而不影响当前应用程序的方法。换句话说,如果有人使用文字处理器,您不希望条形码阅读器突然在其工作中插入随机信息。

  3. You need an application or service to "listen" to the barcode reader and interact with the database. You could write it so that it pops up a dialog or something in the event of a misread, incorrect attendee, etc.; however if the computer needs to be used for something else while attendance is being taken, that could be annoying.
  4. 您需要一个应用程序或服务来“监听”条形码阅读器并与数据库进行交互。您可以编写它以便在出现误读,不正确的与会者等时弹出对话框或其他内容;但是,如果在考勤时需要将计算机用于其他东西,那可能会很烦人。

Hopefully your barcode reader vendor has some information available to you which can help you solve problem 1. As for problem 2, I don't have any advice except to consider rewriting your application as a service or application that you can minimize.

希望您的条形码阅读器供应商可以获得一些可以帮助您解决问题的信息1.至于问题2,除了考虑将您的应用程序重写为可以最小化的服务或应用程序之外,我没有任何建议。

#2


0  

I would imagine the scanner comes with software that in one way or another, would let you execute a command when a barcode scan event occurs.

我想,扫描仪附带的软件会以某种方式让您在条形码扫描事件发生时执行命令。

then just craft the command

然后只需制作命令

php attendance.php "...barcode data..."

I bet the scanner comes with documentation that would be at least somewhat helpful.

我打赌扫描仪附带的文档至少会有所帮助。

#1


3  

This depends on how your barcode reader works, mostly. I infer from your description that:

这主要取决于条形码阅读器的工作方式。我从你的描述中推断:

  • The barcode reader, when activated, sends the data and emulates Enter
  • 条形码阅读器激活后,会发送数据并模拟回车

  • The data is populated in the active input element, or, I assume, anywhere that keyboard characters are accepted. Can be tested by opening a text editor and seeing if the data is accepted followed by a newline.
  • 数据填充在活动输入元素中,或者,我假设,接受键盘字符的任何位置。可以通过打开文本编辑器进行测试,看看数据是否被接受后跟换行符。

Next, you have a web application, which doesn't run in the background. Technically it's still active on the browser even while minimized, but once minimized the browser is no longer the application with focus, and therefore the data doesn't go to it.

接下来,您有一个Web应用程序,它不在后台运行。从技术上讲,即使在最小化的情况下,它仍然在浏览器上处于活动状态,但一旦最小化,浏览器就不再是具有焦点的应用程序,因此数据不会发挥作用。

So you have two problems:

所以你有两个问题:

  1. You need a way to get data from the barcode reader without affecting the current application. In other words, if someone is using a word processor, you don't want the barcode reader to suddenly insert random information in their work.
  2. 您需要一种从条形码阅读器获取数据而不影响当前应用程序的方法。换句话说,如果有人使用文字处理器,您不希望条形码阅读器突然在其工作中插入随机信息。

  3. You need an application or service to "listen" to the barcode reader and interact with the database. You could write it so that it pops up a dialog or something in the event of a misread, incorrect attendee, etc.; however if the computer needs to be used for something else while attendance is being taken, that could be annoying.
  4. 您需要一个应用程序或服务来“监听”条形码阅读器并与数据库进行交互。您可以编写它以便在出现误读,不正确的与会者等时弹出对话框或其他内容;但是,如果在考勤时需要将计算机用于其他东西,那可能会很烦人。

Hopefully your barcode reader vendor has some information available to you which can help you solve problem 1. As for problem 2, I don't have any advice except to consider rewriting your application as a service or application that you can minimize.

希望您的条形码阅读器供应商可以获得一些可以帮助您解决问题的信息1.至于问题2,除了考虑将您的应用程序重写为可以最小化的服务或应用程序之外,我没有任何建议。

#2


0  

I would imagine the scanner comes with software that in one way or another, would let you execute a command when a barcode scan event occurs.

我想,扫描仪附带的软件会以某种方式让您在条形码扫描事件发生时执行命令。

then just craft the command

然后只需制作命令

php attendance.php "...barcode data..."

I bet the scanner comes with documentation that would be at least somewhat helpful.

我打赌扫描仪附带的文档至少会有所帮助。