Most such scanners can be configured to trip the OnLayoutKeystroke trigger and possibly the onObjectExit or OnObjectSave triggers so that this can be fully automated.
The user scans their bar code and the scan trips a script trigger to put the cursor in a global text field. The end of the scanned data includes a tab, enter or Return character that, via field behavior settings, causes the field to be exited--tripping a second trigger that uses the data thus scanned to log a person in or out.
See this thread for some preliminary ideas on scripting and triggers: Need help writing script to integrate barcode scanning
And a key wrinkle to your project is detecting and correctly handling cases where a person is trying to log in or log out twice in a row--which will happen any time an employee manages to get past your scanner to enter or exit without swiping their card.
Why is it important to have a global text field?
This seems simple but it is so confusing. Thanks Philmodjunk for any help you can give me.
It's not absolutely important, but it can make your scripting simpler in most cases.